Lottery Spawn Revisted

brawndo
Posts: 11
Joined: Sun Jul 22, 2012 1:15 pm

Lottery Spawn Revisted

Post by brawndo » Wed Dec 12, 2012 10:08 pm

I've proposed a a few implementations for lottery spawn in the past. The whole idea came with little interest from most, and was lost in the cracks during the move to these forums. Alas, months passed, hard drives crashed, work got busy, got married, ect ect, life happened. Anyways I recently took the time to finally fix my computer, and although I lost the code for my previous lottery spawn implementations, the idea is still basically the same. So here I am, looking to get some feedback on whether it would be worthwhile for me to follow through on the following idea.

At the moment lottery NM's are not lottery NM's, they only have an extended respawn time. My goal is to create a method, which mimics retail, to the best of my ability. The player should be required to kill place holders (PH), that given the NM's window is open, have a chance to cause the NM to spawn. When this NM spawns, it should spawn in the documented range (i.e. FFXI-Wiki). Upon death the ToD is updated, and players will have to wait until the window is open again.

This is a fairly straight forward process, we can just substitute the NM for the PH that causes the NM to spawn. But that is no fun and the pop location becomes very predictable. The best scenario would be for the NM to randomly spawn in some location within its range. At the moment, I do no know enough to create a method to create a random position that is legal (i.e. not in a wall, not in the air). So the next best thing is to just randomly record positions within the NM range, store these positions in the database,and select from those positions. This at least keeps the spawn semi-random, and less predictable.

So here is what I'm proposing:

Update all NMs to SpawnType 128 and MobType 2:
  • 1) Few NM's actually have their SpawnType set to 128 (makes sense, otherwise they would never spawn)
  • 2) Some NM's are not register as NM's so their MobType will need to be updated.
Create NM spawn points:
  • 1) Record 120 random positions (x,y,z) within the NM's spawn range.
  • 2) From this set randomly select 50 positions, and store these positions in a table `nm_spawn_points`
    • a) table columns: mobid, pos, pos_X, pos_y, pos_z (mobid & pos are the PK)
Create an 'UpdateNMSpawnPoint' function:
  • 1) Take the NM mobid, as an input.
  • 2) Using the NM mobid, and a random number 0-49, query the 'nm_spawn_point' table, and retrieve positions x, y, and z.
  • 3) Update the NMs m_SpawnPoint.x, m_SpawnPoint.y, and m_SpawnPoint.z variables with the new postions.
  • 4) NM now spawns in the new position.
Create a 'DeterMob' function:
  • 1) Take in a mobid, and Boolean value is the input.
  • 2) If Boolean is True:
    • a) Set the the given mobid's AllowRespawn to false, this will prevent it from respawning.
  • 2) else:
    • a) Set the given mobid's AllowRespawn to true, this will allow the mob to respawn as normal.
Create 'GetMobRespawnTime' function:
  • 1) Takes in a mobid, and returns the mobs respawn time in seconds.
Modify 'SpawnMob':
  • 1) Add a third parameter, which allows a user to specify a delay (in seconds) for spawning a mob.
    • a)SpawnMob(123456789, '', 300) --> Spawn mob 123456789 in 300 seconds or 5 minutes
With these additions to the core, scripting the NM's becomes a piece of cake.

Create 'MobIDs.lua' (very similar to TextIDs.lua):
  • 1) Although, mobids very rarely change, we should still have a easily accessed LUA similar to TextIDs for easier updates, in the event they do change.
  • 2) For each NM, determine the mobid for the Place Holders.
  • 3) Store these ids in a table within the zone's MobIDs.lua file.
  • 4) Also store the mobid of the NM within the MobIDs.lua file.
Create the Place Holder LUA:
  • 1) On death, verify the mob is a PH by checking that is mobid is within the NM_PH table. (There are many Rock Lizards but only a few are Leaping LIzzy's PH)
  • 2) If the mob is a PH, check is the NM's window is open.
  • 3) If the NM's window is open, verify that it hasn't spawned, or in process of spawning, by checking its current action.
  • 4) If the NM hasn't spawned give 'x' chance for the pH to spawn the NM.
  • 5) If 'x' chance is met:
    • a) Set PH AllowRespawn to false using DeterMob(PH, True)
    • b) Update the NM's spawnpoint using UpdateNMSpawnPoint(NM)
    • c) Spawn the NM, delay by the PH respawn time using SpawnMob(NM, '', GetMobRespawnTime(PH))
    • d) Save the PH's mobid as a server variable
Create the NM LUA:
  • 1) On NM death:
    • a) Retrieve the PH mobid from store server variable
    • b) Set the PH's AllowRespawn to trueusing DeterMob(PH, False)
    • c) Set the PH to spawn, delay by the PH respawn time using SpawnMob(PH, '', GetMobRespawnTime(PH))
    • d) Update the NM's server variable with (time of death + delay for window to open)

Proof Of Concept:
I have created all the functions, and implemented this for Leaping Lizzy. You will need to update the mob_groups entry for Leaping Lizzy to SpawnType 128. At the moment, if the Rock Lizard is a PH, it will have a 5% chance of popping LL, given LL's window is open and isn't already spawned. When LL is killed, its window is set to reopen in an hour. You can modify these settings with the LUA's, I just set some arbitrary number. Attached is a patch file to give this all a test.

If there is interest in this, my first step would be to fill the `nm_spawn_points` table, for each lottery NM. I have a list of every NM, from earlier this year. Followed by creating the LUAs which should be straight forward and could easily be made into a template.

I look forward to any feed back, suggests, and whether or not I should go though with this.
Attachments
LotterySpawn.zip
Don't forget to update/modify the SQL tables!
(4.54 KiB) Downloaded 213 times
Last edited by brawndo on Sat Dec 15, 2012 12:38 pm, edited 1 time in total.

Ayame
Posts: 129
Joined: Sat Jul 21, 2012 10:35 pm

Re: Lottery Spawn Revisted

Post by Ayame » Thu Dec 13, 2012 4:03 am

I would like to see this get implemented this would make nm camping more fun ^^ and interesting lol.

Flunklesnarkin
Posts: 238
Joined: Wed Sep 05, 2012 10:48 am

Re: Lottery Spawn Revisted

Post by Flunklesnarkin » Fri Dec 14, 2012 8:21 pm

Awesome work, this would certainly make camping NM's more fun.

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Lottery Spawn Revisted

Post by whasf » Fri Dec 14, 2012 10:53 pm

scheduled to go on the test server for a day or two for testing before comitting.
-- Whasf

brawndo
Posts: 11
Joined: Sun Jul 22, 2012 1:15 pm

Re: Lottery Spawn Revisted

Post by brawndo » Sat Dec 15, 2012 6:19 am

Thank you very much whasf, given it tests out fine, I will begin working on more NM's otherwise it will be back to the drawing boards.
Last edited by brawndo on Sat Dec 15, 2012 12:44 pm, edited 1 time in total.

Ezekyel
Developer
Posts: 62
Joined: Sat Jul 21, 2012 11:42 pm

Re: Lottery Spawn Revisted

Post by Ezekyel » Sat Dec 15, 2012 10:12 am

Good Job Brawndo ^^
New Gilgamesh Server --> http://gilgamesh.servegame.com

brawndo
Posts: 11
Joined: Sun Jul 22, 2012 1:15 pm

Re: Lottery Spawn Revisted

Post by brawndo » Sat Dec 15, 2012 12:40 pm

Thank you very much Ezekyel.

I have updated the patch file, as I failed to realize a mobs action after death is no longer determined by SpawnType, instead its determined by AllowRespawn. 'DeterMob' now adjusts AllowRespawn (true or false) instead of SpawnType (0 or 128). The initiating PH should no longer respawn until after the NM is killed.

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Lottery Spawn Revisted

Post by whasf » Sat Dec 15, 2012 4:23 pm

It's on the test server. The patch didn't fully install on 2099, I had to manually add those new LUA functions. Caused about 5 minutes of confusion for me, darn unresolved externals.

Please test!
-- Whasf

brawndo
Posts: 11
Joined: Sun Jul 22, 2012 1:15 pm

Re: Lottery Spawn Revisted

Post by brawndo » Sun Dec 16, 2012 4:59 pm

Awesome! I apologize for the confusion. I look forward to hearing some feedback. I'm anxious to continue for other NM's.

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Lottery Spawn Revisted

Post by whasf » Mon Dec 17, 2012 7:35 pm

I added it to the SVN. r2105
-- Whasf

Post Reply