LUA Functions Request

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

Moderator: Team Members

Post Reply
LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Oct 07, 2008 4:25 pm

I just added the following LUA functions:
GetSpawn(Spawn, spawn_id) - Returns the closest Spawn to the Spawn argument that matches the spawn_id. The value returned as well as the first argument can be a NPC, Widget, Sign, Object and in the case of the argument even a Player.
GetZoneID(Zone) - Returns the zone id for the zone. Pass in a Zone object retrieved with the GetZone function.
GetZoneName(Zone) - Returns the zone name for the zone. Pass in a Zone object retrieved with the GetZone function.
I am not done with the SpawnSet function yet. I am trying to decide the best way to implement it. Because of the way that EQ2 handles spawn updates, it is going to be difficult to see players different updates for the same spawn.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Mon Oct 13, 2008 11:11 pm

LE, when using GetZone(), is the parameter for that allowed to take a Spawn?
This works in a quest

Code: Select all

Spawn(GetZone(Player), 2530174, false, GetX(Player), GetY(Player), GetZ(Player))
But this doesn't in a spawnscript

Code: Select all

Spawn(GetZone(Spawn), 2530174, false, GetX(NPC), GetY(NPC), GetZ(NPC))
Another thing,
I am trying to add an ObtainItem quest step but it does not appear to be updating. I tried buying the item off a merchant and also just using /summonitem to spawn it. I looked at the source and I appear to be passing in the parameters correctly. Here's the line:

Code: Select all

AddQuestStepObtainItem(Quest, 5, "I must buy an external hard drive for the programmer. Hanna Deeppockets should have one.", 1, 100, "I must buy an external hard drive for the programmer so he can back up his work in a safe place. He says Hanna Deeppockets sells them. I can find her to the west of Murrar Shar.", 15069)
Lol, don't ask about the quest step =D

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Oct 14, 2008 2:20 pm

Scatman wrote:LE, when using GetZone(), is the parameter for that allowed to take a Spawn?
This works in a quest

Code: Select all

Spawn(GetZone(Player), 2530174, false, GetX(Player), GetY(Player), GetZ(Player))
But this doesn't in a spawnscript

Code: Select all

Spawn(GetZone(Spawn), 2530174, false, GetX(NPC), GetY(NPC), GetZ(NPC))
Can you paste the full function that you are using that in?
Scatman wrote: Another thing,
I am trying to add an ObtainItem quest step but it does not appear to be updating. I tried buying the item off a merchant and also just using /summonitem to spawn it. I looked at the source and I appear to be passing in the parameters correctly. Here's the line:

Code: Select all

AddQuestStepObtainItem(Quest, 5, "I must buy an external hard drive for the programmer. Hanna Deeppockets should have one.", 1, 100, "I must buy an external hard drive for the programmer so he can back up his work in a safe place. He says Hanna Deeppockets sells them. I can find her to the west of Murrar Shar.", 15069)
Lol, don't ask about the quest step =D
heh, currently the only way to update the quest is through looting. However, I'll change it to allow any method of item retrieval.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 4:42 pm

Code: Select all

function SpawnGoblin(NPC, Spawn)
   Spawn(GetZone(Spawn), 8, false, GetX(NPC), GetY(NPC), GetZ(NPC))
   if GetQuestStep(Spawn, 47) == 2 then
      SetStepComplete(Spawn, 47, 2)
   end
   Say(NPC, "He stole my code! " .. GetName(Spawn) .. ", get him!")
end
When I comment out the Spawn function, the function gets executed with that Say statement so I know the SpawnGoblin function is being entered.
Ok, no rush on the item update, just making sure I was getting it right. Thanks.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Oct 14, 2008 5:06 pm

Are you sure that Spawn is being passed correctly? Does it work correctly if you use NPC instead of Spawn?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 5:31 pm

Spawn is being passed correctly because in the Say() function, my name is being said in the text when I comment out the Spawn() function. I did try using NPC as well and it didn't work. I also tried using Spawn in the getters for location and that didn't work either.
If you want to see the whole quest I can send it to ya or it's on John's DB editor. It's a spawn script for "The Disgruntled Programmer" in Queen's Colony.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Oct 14, 2008 5:50 pm

Have you seen any errors in your console log? it gives them if it can't find the zone or spawn.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 6:04 pm

No I didn't. I made sure I had /luadebug start on too.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Post by LethalEncounter » Tue Oct 14, 2008 7:04 pm

k, those particular errors wouldn't have been sent to the LUA error interface, only to the console.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 7:32 pm

Oh okay. I'll have to ask John to check then next time he's on.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Tue Oct 14, 2008 8:35 pm

There are no console errors at that point in the script.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 8:42 pm

Did you run it again yourself? And if you did, did you take out the comment on the Spawn() line?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Tue Oct 14, 2008 8:47 pm

I killed the gobs til I found the first part, then went back to the quest giver and he whispered his plan to me, and nothing. No response, no errors, nothing.
When I do the same thing with Spawn() commented out, I at least get the conversation text.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Post by Scatman » Tue Oct 14, 2008 9:24 pm

I did a little more testing and found two things. One is that if I pass in a Player reference to the GetZone() function for the Spawn() function, it works. The mob spawns as it should.
The second thing, is if I give the Spawn() function a spawn id that doesn't have a zonespawnentry for that zone, it doesn't spawn. If I do, it works.
So when I satisfy both those two things it works. I've taking one out and leaving the other in and it does not work.
*edit*
Well we added a spawngroup to the goblin we're trying to spawn and restarted the server but it still didn't work so I guess it doesn't need to have a spawngroup to spawn. Trying to figure out why one spawn will work but another won't...

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Post by John Adams » Thu Dec 04, 2008 9:59 pm

We'll need the ability to hide ProvidesQuest() for certain races. Ie., a Dwarf should not be able to get the Half-Elf mentor quest. I just tried adding a Spawn reference to spawn(NPC, Spawn) and putting an "if GetRace(Spawn) == 14 then ProvidesQuest(..) end". No workie :(
I didn't think it would work, but I wanted to try. So eventually we'll need to expand on either ProvidesQuest() with a raceID or ALL param, or allow function spawn() to use the Player reference.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests