[Core, Lua, Sql] Bastok 8-1 (Includes Bastok 7-2)

Post Reply
Hypnotoad
Posts: 15
Joined: Fri Dec 14, 2012 7:25 am

[Core, Lua, Sql] Bastok 8-1 (Includes Bastok 7-2)

Post by Hypnotoad » Sun Feb 17, 2013 2:27 am

v1.1 - Updated checks for opening weighted doors from the inside to use onTrigger instead of region.

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"
Details:
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;
CRegion has been changed to a 2 parameter constructor, is now takes a boolean as the 2nd parameter.
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);
Scripts Changes:
  • 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
Details: In script changes the weight door system of Quicksand_Caves has been reworked to include handling of a player on the opposite side of the weight door. This change now lets the player open the door from the opposite side once they have gone through the weight door.
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
The following SQL is the sql changes since the file upload limit is 2:

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';
Changes to the code to enter a region were changed primarily to ease the use of its Lua function. To implement the weight doors of Quicksand Caves to work from both sides regions were added to the inside door. These regions allow the manual opening of the door when a player walks near the side opposite the weight stone.
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;
Please refer to this FFXIClopedia link for the quest walkthrough:
The Chains That Bind Us

Bastok7-2And8-1.patch
(48.92 KiB) Downloaded 418 times
Last edited by Hypnotoad on Mon Feb 25, 2013 5:09 pm, edited 8 times in total.

bluekirby0
Developer
Posts: 707
Joined: Sun Jul 22, 2012 12:11 am

Re: [Core, Lua, Sql] Bastok 8-1

Post by bluekirby0 » Sun Feb 17, 2013 5:05 am

"What side of the door" checks are implemented on several door without the use of regions by just checking if your position is > or < than a certain value on X and Z planes. You don't need a region to do it. That said, your region setting update is very welcome as it simplifies it immensely. Will test this out when i have time.

Hypnotoad
Posts: 15
Joined: Fri Dec 14, 2012 7:25 am

Re: [Core, Lua, Sql] Bastok 8-1

Post by Hypnotoad » Sun Feb 17, 2013 6:57 am

I see what you mean.

I'll be updating this shortly with your suggested changes.

PrBlahBlahtson
Developer
Posts: 539
Joined: Sun Jul 22, 2012 12:17 am

Re: [Core, Lua, Sql] Bastok 8-1

Post by PrBlahBlahtson » Mon Feb 18, 2013 10:46 pm

Looking over the script by request.

Code: Select all

+function onMobDisengage(mob)
+	npc = GetNPCByID(17629728);
+	npc:hideNPC(1);
+	
+	mobsup = GetServerVariable("BastokFight8_1");
+	SetServerVariable("BastokFight8_1",mobsup - 1);
+	
+	self = mob:getID();
+	DespawnMob(self);
+end;
If I'm understanding this correctly, if any NM loses interest, it's going to immediately depop without any chance to reclaim and recover. Is that correct behavior, or should there be a normal 180ish second despawn timer?

Also, please try to use local variables when possible, so we don't have a bunch of vars hanging around in memory waiting to confuse another script. :)
local missionStatus = player:getVar("MissionStatus");
I'm... not entirely sure how I feel about the use of a ServerVar to track kills/despawns. I ran into the same problem with the NMs for Knight Stalker (Temple of Ugly, qm15 I think?), and I really don't like how I did it, either. It was just generally messy. To be honest, your method is probably neater that mine.

Either way, setting a circular region may be useful in the future, and I like the onMobDisengage function, because I can abuse it for a mob "mode"/animationsub system in the future.

Hypnotoad
Posts: 15
Joined: Fri Dec 14, 2012 7:25 am

Re: [Core, Lua, Sql] Bastok 8-1

Post by Hypnotoad » Wed Feb 20, 2013 1:57 am

Bump for v1.2.

May start going through Lua files to check if a forced despawn is widely needed by in action scripts.

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

Re: [Core, Lua, Sql] Bastok 8-1

Post by whasf » Wed Feb 20, 2013 7:18 pm

Please post as one big patch file so everything gets done at once.
-- Whasf

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: [Core, Lua, Sql] Bastok 8-1 (Includes Bastok 7-2)

Post by kjLotus » Tue Feb 26, 2013 6:55 pm

done

Post Reply