v1.2 - onMobDespawn, better handling of mission NMs reset, changes to scripts to use "local" (More info at bottom)
These are the changes I made [and tested] to fix Bastok mission 8-1 "The Chains That Bind Us."
The quest is fully handled. Included in the post is the SQL changes. There are 2 patch files also included for download.
Core changes:
- New Lua function "onMobDisengage"
- CRegion function that determines a region by a single coordinate plane
- Changes to the function used to load lua regions
- v1.2: New Lua function "onMobDespawn"
The lua function "onMobDisenage" is similiar to "onMobEngage". There is no "mob target" parameter.
Function is called in ActionDisenage() of ai_mob_dummy.cpp.
This Lua function is be written as such:
Code: Select all
function onMobDisenage(mob)
-- do things
end;
This 2nd parameter is used to check if the region being is to be treated as a circle.
It is a distance check in a 2d plane, this means it only checks if the target is within a certain coordinate in a range that has no height.
The lua function in the core that calls CRegion enters the 2nd, 3rd, 4th for the distance check.
The parameters are X, Radius, Z. This is later checked by the isPointInside function, which called by ZoneServerRegion.
In the new handling, the last 3 parameters (5, 6, 7) much be filled as zero to change the function.
This Lua function is written as such:
Code: Select all
zone:registerRegion(region ID, X, Radius, Z, Unused, Unused, Unused);
- New npc file qm4.lua, qm6.lua
- New mobs files Centurio_IV-VII, Princeps_IV-XLV, Triarius_IV-XIV
- Changes to scripts/zones/Quicksand_Caves/zone.lua
- Handling for Bastok 8-1 by Iron_Eater.lua
- Handling for Bastok 8-1 completion in missions.lua
- Reworking of registerRegion in zone.lua to use a the changed registerRegion function
- v1.2: Changes for more use of the local keyword
- v1.2: NM Reseting better handling
Bastok 8-1 handling is fully working, changes are to Iron Eater for cutscnes and mid-way dialogue.
Added file qm6 is to handle the ??? for popping the NMs in Quicksand Caves. File qm4 is the later ??? for the follow up cutscene to the NMs fight.
SQL Changes:
- Update to the Bastok 8-1 NMs spawn coordinates
Code: Select all
-- Centurio_IV-VII
Update `mob_spawn_points` SET `pos_x` = '-468.0', `pos_y` = '0.001',`pos_z` = '625.0' ,`pos_rot` = '27'
WHERE `mobid` = '17629187';
-- Triarius_IV-XIV
Update `mob_spawn_points` SET `pos_x` = '-468.0', `pos_y` = '0.001',`pos_z` = '617.0' ,`pos_rot` = '240'
WHERE `mobid` = '17629188';
-- Princeps_IV-XLV
Update `mob_spawn_points` SET `pos_x` = '-468.0', `pos_y` = '0.001',`pos_z` = '620.0' ,`pos_rot` = '27'
WHERE `mobid` = '17629189';
In order to implement a reset system on the chance of wipe, I implemented the onMobDisengage lua function.
This function is called when a mob disengages a target, usually due to the targets death.
Bastok 8-1 NM popping has a a timer set to prevent popping in succession, mobs depop when they disengage.
v1.2:
I have revamped Bastok 8-1 for better reseting. The scripted NMs will call "onMobDisengage" when they run out of targets and initiate a 120 second (2 minutes) despawn. This timer will not persist if they are re-engaged. After the full 120 seconds of no engagement, the mob will despawn via the use of the new function "onMobDespawn." This new function is called when a mob despawns, regardless of whether they were alive or dead. Due to this new handling, the onMobDeath function has been removed from the NM scripts.
Other changes:
Use of the new "onMobDespawn" is simply:
Code: Select all
function onMobDespawn(mob)
end;
The Chains That Bind Us