Signal another NPC

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Signal another NPC

Post by Gangrenous » Mon May 30, 2016 1:29 pm

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.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Signal another NPC

Post by Jabantiz » Mon May 30, 2016 3:09 pm

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.

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: Signal another NPC

Post by Gangrenous » Mon May 30, 2016 5:35 pm

Holy crap that worked.
Resident Dirty Hippy

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests