Abyssea - Altepa

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

Re: Abyssea - Altepa

Post by kjLotus » Wed Aug 21, 2013 9:32 am

Xx_DeMoLiSH wrote:Change the first param after the csid to 600 or something and set your chars cruor to 1234.
Try to teleport and it'll display the teleport animation but if you use (600 + 800 * 65536) instead of 600 in the event params it seems like the server reads that as 52429400 and expects the player to have 52429400 cruor cause it wont let you teleport/show the animation
don't use the big number for checking cruor, just for passing into the csid

Troak
Posts: 27
Joined: Thu Jan 31, 2013 12:57 am

Re: Abyssea - Altepa

Post by Troak » Wed Aug 21, 2013 6:36 pm

The following code seems to get it to be working properly, although I'm sure the code can be made more efficient. I plan on trying to centralize a lot of the conflux code so it doesn't clutter up every single conflux lua file.

Code: Select all

-----------------------------------
-- Area: Abyssea-Altepa
-- NPC:  Veridical Conflux #01
-- Aybssea Teleport NPC
-----------------------------------

require("scripts/globals/keyitems");

-----------------------------------
-- onTrade Action
-----------------------------------

function onTrade(player,npc,trade)
end; 

-----------------------------------
-- onTrigger Action
-----------------------------------

function onTrigger(player,npc)
	
	local mask = player:getVar("ConfluxMask[Altepa]");
	local activated = player:getMaskBit(mask,0);
	local cruor = player:getVar("Cruor");
	local cost = 1
	if(player:hasKeyItem(IVORY_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(player:hasKeyItem(CRIMSON_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(player:hasKeyItem(INDIGO_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(activated) then
		player:startEvent(0x0854, (600 + 800 * 65536) * cost, (1000 + 1200 * 65536) * cost, (1400 + 1600 * 65536) * cost, (1800 + 2000 * 65536) * cost, mask - 1, 9, 1, cruor);
	else
		player:startEvent(0x0854, 50 * cost, 0, 0, 0, 0, 0, 2, cruor);
	end
	
end; 

-----------------------------------
-- onEventUpdate
-----------------------------------

function onEventUpdate(player,csid,option)
printf("Update: CSID: %u",csid);
printf("Update: RESULT: %u",option);

local cruor = player:getVar("Cruor");
local cost = 1
if(player:hasKeyItem(IVORY_ABYSSITE_OF_CONFLUENCE)) then
	cost = cost - 0.2
end
if(player:hasKeyItem(CRIMSON_ABYSSITE_OF_CONFLUENCE)) then
	cost = cost - 0.2
end
if(player:hasKeyItem(INDIGO_ABYSSITE_OF_CONFLUENCE)) then
	cost = cost - 0.2
end
if(csid == 0x0854 and option == 0x20001 and cruor - 800 * cost >= 0) then
	player:setVar("Cruor",cruor - 800 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x30001 and cruor - 1000 * cost >= 0) then
	player:setVar("Cruor",cruor - 1000 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x40001 and cruor - 1200 * cost >= 0) then
	player:setVar("Cruor",cruor - 1200 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x50001 and cruor - 1400 * cost >= 0) then
	player:setVar("Cruor",cruor - 1400 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x60001 and cruor - 1600 * cost >= 0) then
	player:setVar("Cruor",cruor - 1600 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x70001 and cruor - 1800 * cost >= 0) then
	player:setVar("Cruor",cruor - 1800 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
elseif(csid == 0x0854 and option == 0x80001 and cruor - 2000 * cost >= 0) then
	player:setVar("Cruor",cruor - 2000 * cost);
	player:updateEvent(1,0,0,0,0,0,0,0);
end
end;

-----------------------------------
-- onEventFinish
-----------------------------------

function onEventFinish(player,csid,option)
printf("Finish: CSID: %u",csid);
printf("Finish: RESULT: %u",option);

	local mask = player:getVar("ConfluxMask[Altepa]");
	local activated = player:getMaskBit(mask,0);
	local cruor = player:getVar("Cruor");
	local cost = 1
	if(player:hasKeyItem(IVORY_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(player:hasKeyItem(CRIMSON_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(player:hasKeyItem(INDIGO_ABYSSITE_OF_CONFLUENCE)) then
		cost = cost - 0.2
	end
	if(csid == 0x0854 and activated == false and cruor - 50 * cost >= 0) then
		player:setMaskBit(mask,"ConfluxMask[Altepa]",0,true);
		player:setVar("Cruor",cruor - 50 * cost);
	end
end;

User avatar
demolish
Developer
Posts: 262
Joined: Thu Jul 26, 2012 7:12 am

Re: Abyssea - Altepa

Post by demolish » Thu Aug 22, 2013 3:56 pm

That should be all NPCs with some basic dialog, use the confluxes from Troak's post:
viewtopic.php?f=20&t=1540
Attachments
Abyssea-Altepa.zip
(20.3 KiB) Downloaded 317 times
<Giblet[NewBrain]> kj with this first step would be fine on my shit
Click here for a guide on scripting missions.

Post Reply