Page 1 of 1

Signal another NPC

Posted: Mon May 30, 2016 1:29 pm
by Gangrenous
I know I asked this before but I cannot find the post after multiple searches. I need to signal another NPC. How would I go about doing that? So basically I was to tell NPC one to send a signal to NPC two. Once NPC two gets the signal I want it to react. What I am attempting to do, and someone may have a better idea of how to do it, is to record the spell effects.

Re: Signal another NPC

Posted: Mon May 30, 2016 3:09 pm
by Jabantiz
You can get pointers to other spawns with the various GetSpawn functions and then use that pointer to do whatever you want for example

Code: Select all

function hailed(NPC, Spawn)
    spawn2 = GetSpawn(Spawn, 1234) -- Get the closest spawn with a DB ID of 1234
    -- make sure pointer is valid before using
    if spawn2 ~= nil then
        Attack(spawn2, Spawn) -- Have spawn2 attack the player
    end
end
As you are talking about spell effects you might also want to look at the casted_on function that is triggered on a spawn every time a spell or entity command is used on them.

Re: Signal another NPC

Posted: Mon May 30, 2016 5:35 pm
by Gangrenous
Holy crap that worked.