LUA Functions Request
Moderator: Team Members
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Another LUA function we might need, unless MovementLoop() allows this;
Watching Courier Dirvel in Graystone yard - he walks to specific coordinates, and when he gets there, he stops, and says/animates/emotes a phrase before moving on to the next spot.
I am assuming the movement loop just sets coords, and is not a line-by-line execution... so I didn't think to insert the Say() commands in between the loop entries. Figured I'd just ask rather than waste time thinking I'm not doing it right.
Thanks
Watching Courier Dirvel in Graystone yard - he walks to specific coordinates, and when he gets there, he stops, and says/animates/emotes a phrase before moving on to the next spot.
I am assuming the movement loop just sets coords, and is not a line-by-line execution... so I didn't think to insert the Say() commands in between the loop entries. Figured I'd just ask rather than waste time thinking I'm not doing it right.
Thanks
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
I was getting pretty tired last night and wasn't feeling creative heh, but let me visually display it, you tell me if this is how movement script works:
See, I assumed that when the LUA function read the "MovementLoopAddLocation()", it did them all at once and now they were all in memory in some array that were cycled through sequentially. But if that means a Function can be called between them, then that is the solution. And I like it. 
Code: Select all
function spawn(NPC)
x = GetX(NPC)
y = GetY(NPC)
z = GetZ(NPC)
MovementLoopAddLocation(NPC, x + 7 , y, z - 8 , 2, math.random(5, 15))
say_1(NPC)
MovementLoopAddLocation(NPC, x - 5 , y, z - 10, 2, math.random(5, 15))
say_2(NPC)
MovementLoopAddLocation(NPC, x - 10, y, z + 9 , 2, math.random(5, 15))
say_3(NPC)
MovementLoopAddLocation(NPC, x + 5 , y, z + 8 , 2, math.random(5, 15))
say_4(NPC)
end
function say_1(NPC)
Say("I am at the first spot!")
end
function say_2(NPC)
Say("I am at the second spot!")
end
function say_3(NPC)
Say("I am at the third spot!")
end
function say_4(NPC)
Say("I am at the fourth spot!")
end
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
That is exactly how it works. My change would add an additional argument to MovementLoopAddLocation that would tell it a custom LUA spawn script function to call after it gets to that particular location.I assumed that when the LUA function read the "MovementLoopAddLocation()", it did them all at once and now they were all in memory in some array that were cycled through sequentially
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
I just tested this and it seems to be doing the same thing that would happen if you just put the Say function in the spawn(). Here's what I'm doing:
When I do a /reload spawnscripts and /repop, the NPC is saying "1", "2", "3", right when she is spawned then starts moving and never says "1", "2", "3" again.
This script is for Gethe Huggs in the Outpost of the Overlord (paula marx counter-part).
Code: Select all
function spawn(NPC)
MovementLoopAddLocation(NPC, 22.19, -6.86, 183.95, 2, 30, say1(NPC))
MovementLoopAddLocation(NPC, 30.76, -6.33, 196.28, 2, 30, say2(NPC))
MovementLoopAddLocation(NPC, 20.70, -6.85, 206.43, 2, 30, say3(NPC))
end
function respawn(NPC)
spawn(NPC)
end
function say1(NPC)
Say(NPC, "1")
end
function say2(NPC, Spawn)
Say(NPC, "2")
end
function say3(NPC, Spawn)
Say(NPC, "3")
endThis script is for Gethe Huggs in the Outpost of the Overlord (paula marx counter-part).
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Who is online
Users browsing this forum: No registered users and 0 guests