Page 1 of 1
Getting a spawn when the zone is vacant of players
Posted: Fri Oct 14, 2016 8:53 am
by Gangrenous
So I have a need to check if a spawn is there when no players are present. I know the spawn id, name, etc. I even have other spawns there. The zone is always running. The catch is I want to check a spawn in Kylong Plains from an NPC in Antonica.
How can you do this though?
Code: Select all
local spawn2 = GetSpawn(Spawn, 1234)
That requires the Spawn object. You cannot get the spawn, unless you have the spawn, and of course I cannot get the spawn without the spawn. I cannot simply do it by the spawn ID. Am I going to have to create a new function?
Re: Getting a spawn when the zone is vacant of players
Posted: Fri Oct 14, 2016 3:25 pm
by Jabantiz
Not possible currently as you need either a spawn in the same zone or a pointer to the zone for the various GetSpawn functions. There is no way to get a zone pointer for a different zone through lua currently.
Re: Getting a spawn when the zone is vacant of players
Posted: Fri Oct 14, 2016 5:12 pm
by Gangrenous
Oh no doubt. Okay, no worry. I have other tricks up my sleeve.
Re: Getting a spawn when the zone is vacant of players
Posted: Fri Oct 14, 2016 9:43 pm
by Gangrenous
Figured a way around my problem. I had to do some manipulating. So second question. I want to move a player as he enters the zone, using the
I think you cannot, because you are not actually in the zone yet. I kind of tricked it by sending an existing NPC a function. That works but you zone twice, having to use the zone function. Is there a way to move a player without zoning them twice? I mean you are already in the zone.
New function?
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 12:18 am
by Jabantiz
Why not just zone them to those coords instead of zoning then moving? Just provide the cords in the lua
Zone() function.
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 6:08 am
by Gangrenous
Because I am working on boats. I cannot get the coordinates of the boat, because I cannot get them in the source zone. I have to get those coordinates in the destination zone. Does that make sense? Also if a player goes link dead, comes back into the zone later...I want to be able to put him on the boat if it is in the zone still. So I want to capture that when the player is coming into the zone, I want to put him on the boat. He is already zoning, so no sense in zoning him twice.
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 8:46 am
by Gangrenous
I figured it out. I used some of the code from the function to move a player to a spawn, created a new function called MovePlayer. May not be pretty, but it works for me.
Code: Select all
void Client::MovePlayer(float x, float y, float z, float heading){
GetPlayer()->SetX(x);
GetPlayer()->SetY(y);
GetPlayer()->SetZ(z);
GetPlayer()->SetHeading(heading);
EQ2Packet* app = GetPlayer()->Move(x, y, z, GetVersion());
if(app)
QueuePacket(app);
}
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 3:22 pm
by Jabantiz
Boats that cross zones have special packets fyi.
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 5:25 pm
by Gangrenous
Jabantiz wrote:Boats that cross zones have special packets fyi.
I am doing it a ghetto way, but it will work and be unnoticeable to players.
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 7:35 pm
by Gangrenous
Now if you know of some way of doing this easier, definitely let me know. But before I started this process I was under the understanding that boats were not working and definitely not able to take players across zones.
Re: Getting a spawn when the zone is vacant of players
Posted: Sat Oct 15, 2016 7:51 pm
by Jabantiz
They don't work currently, no one has looked into the packets or the process to get it working yet. I was just pointing out that there are special packets for it if you wanted to try and do it the correct way, no clue what would be involved with it though.