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.
- 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)
- 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.
- 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.
- 1) Takes in a mobid, and returns the mobs respawn time in seconds.
- 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
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.
- 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
- 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.