Page 2 of 4
Posted: Sun Jun 01, 2008 6:26 pm
by LethalEncounter
Yah, those are bugs/things that haven't been implemented yet. Could you post these in the bugs forums so that I don't forget about them?
Posted: Sun Jun 01, 2008 11:05 pm
by Zcoretri
Sure, I will copy post to bugs forum

Posted: Fri Jun 13, 2008 8:24 pm
by link2009
I don't know if you did this deliberately LE, but it seems that you're missing a SetX function, seeing as how you already included SetY and SetZ.
Code: Select all
int EQ2Emu_lua_SetY(lua_State* state){
Spawn* spawn = lua_interface->GetSpawn(state);
float value = lua_interface->GetFloatValue(state, 2);
lua_interface->ResetFunctionStack(state);
if(spawn)
spawn->SetY(value);
return 0;
}
int EQ2Emu_lua_SetZ(lua_State* state){
Spawn* spawn = lua_interface->GetSpawn(state);
float value = lua_interface->GetFloatValue(state, 2);
lua_interface->ResetFunctionStack(state);
if(spawn)
spawn->SetZ(value);
return 0;
}
Posted: Sat Jun 14, 2008 7:10 am
by LethalEncounter
You are using old code, as none of the SetX/SetY/SetZ exist anymore. They were replaced with SetPosition(spawn, x, y, z)
Posted: Fri Aug 08, 2008 11:27 pm
by John Adams
I am planning on updating the LUA functions list tomorrow, and thought of a new command we could use during zone development. I didn't see it in the code yet, but I'd like a function that generates an animation on the NPC.
Paula Marx wanders the grassy area, stops and gathers for a moment, before moving on. I assume the gathering is a visual_state (2809 gathering_search, 2810 gathering_success).
Thanks
-J
Posted: Sat Aug 09, 2008 5:56 pm
by John Adams
Back to this real quick. If I wanted to spawn an NPC and have it's script "remember" it's spawn coordinates, could I use:
x=GetX(NPC)
y=GetY(NPC)
z=GetZ(NPC)
?
The script I am trying to make will wander an NPC from it's spawn point, to another few points, then return to IT's spawn point - and I was hoping to use 1 script for many spawns. Maybe I need a LUA script reference guide.
Posted: Sat Aug 09, 2008 6:02 pm
by John Adams
Actually, nevermind. I was just being impatient as usual. I am being thrown off by some odd behavior with movement, so LE when you get a chance, come check out my movements for the Sapswill invaders that approach the guard post on the goodie island.
Things appear to be "sticking" and warping. But the GetX thingy, worked like a champ!
Posted: Sat Sep 20, 2008 7:20 am
by LethalEncounter
I added a new function called SetPlayerProximityFunction(Spawn, range val, In Range Function, OOR Function). Example:
Code: Select all
function spawn(NPC)
SetPlayerProximityFunction(NPC, 10, "InRange", "LeavingRange")
end
function InRange(NPC, Player)
Say(NPC, GetName(Player) .. " is in range with a distance of: " .. GetDistance(NPC, Player))
end
function LeavingRange(NPC, Player)
Say(NPC, GetName(Player) .. " is now out of range with a distance of: " .. GetDistance(NPC, Player))
end
gives the output:
(1221919684)[Sat Sep 20 09:08:04 2008] \aPC 2 Marv Boilfist:Marv Boilfist\/a says, "Lethal is in range with a distance of: 7.551794052124"
(1221919708)[Sat Sep 20 09:08:28 2008] \aPC 2 Marv Boilfist:Marv Boilfist\/a says, "Lethal is now out of range with a distance of: 11.774223327637"
Note that the distance is recalculated every 2 seconds to avoid too much processing, so be sure to make your ranges large enough to fire before the player enters the range and then leaves it. The OOR function is also optional. The use I see for this function is specifically for all the proximity chatting that occurs when you run in range of an NPC, but I designed it to be a little more flexible for anything you can think of.
Posted: Sat Sep 20, 2008 10:08 am
by Scatman
Wicked! Can't wait to test this bad boy out. Thanks LE!
Posted: Sat Sep 20, 2008 11:21 am
by John Adams
Very nice indeed, thank you!
Posted: Sat Sep 20, 2008 10:01 pm
by John Adams
This works perfectly. Very nice indeed!
Re: LUA Functions Sticky
Posted: Sat Feb 28, 2009 12:00 pm
by John Adams
Scat/LE, I have updated the
LUA Functions Wiki - so hopefully we can change the opening post to point to this Wiki page now, and do our function updates there.
This first page is a list of the functions, and each one has a drill-down to the function page itself. I will provide a few examples, so if anyone else out there has time to spare, let's fill these pages in. LUA is one of the cores to our server customization, and without adequate docs, we'll be answering questions all day instead of developing servers.

Re: LUA Functions Sticky
Posted: Mon Mar 09, 2009 8:34 pm
by ZexisStryfe
Looking over these lists something occured to me. We need two more Set functions- SetAdventureClass and SetTradeskillClass.
In tradeskilling choosing you class is done through conversations with the trainers, and I would also like the Set Adventure Class function so that I can have an adventuring trainer do the same.
Re: LUA Functions Sticky
Posted: Thu Mar 26, 2009 2:00 am
by Xanibunib
How about a "follow" command that would go under the "spawn" function to make one NPC auto follow another... like ...
Would use this to make things like dogs follow guards...
Re: LUA Functions Sticky
Posted: Fri Mar 27, 2009 6:50 pm
by LethalEncounter
It is on svn now. Btw you might notice "Combined Packet!" and "Combined App Packet!" being printed to your console window. It is normal. I'm just trying to track down the desync issue. If you think you see a client sending a bunch of jibberish packets could you please make a post with your console text? I'd really be interested in it.
