don't use the big number for checking cruor, just for passing into the csidXx_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
Abyssea - Altepa
Re: Abyssea - Altepa
Re: Abyssea - Altepa
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;
Re: Abyssea - Altepa
That should be all NPCs with some basic dialog, use the confluxes from Troak's post:
viewtopic.php?f=20&t=1540
viewtopic.php?f=20&t=1540
- Attachments
-
- Abyssea-Altepa.zip
- (20.3 KiB) Downloaded 316 times
Click here for a guide on scripting missions.<Giblet[NewBrain]> kj with this first step would be fine on my shit