Page 1 of 1

Veridical Conflux

Posted: Wed Oct 07, 2015 12:35 pm
by wadski
Hey guys, I'm looking into scripting veridical confluxes for my server, and if they function like retail, contribute. But i'm at a stump. I found some lua text from a few years back. But it doesnt work. Just if i want to activate the conflux and price, then says i dont have enough cruor (have over 15k)

In the old lua script it looks like this. I tried making a conflux.lua for globals and making a require line in the script also to no avail. Any help would be appreciated.

Code: Select all

-----------------------------------
-- Area: Abyssea Altepa
-- NPC: Veridical Conflux #01
-- Type: Standard NPC
-- @zone 218
-- @pos 412 -1 288 218
-----------------------------------
package.loaded["scripts/zones/Abyssea-Altepa/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");

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

function onTrade(player,npc,trade)
end;

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

function onTrigger(player,npc)
   
   mask = player:getVar("ConfluxMask[Altepa]");
   activated = player:getMaskBit(mask,0);
   cruor = player:getVar("cruor");
   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
   testvar = (600 + 800) * cost
   if(activated) then
    --  player:startEvent(0x0854, (600 + 800 * 65536) * cost, (1000 + 1200 * 65536) * cost, (1400 + 1600 * 65536) * cost, (1800 + 2000 * 65536) * cost, mask, 9, 1, cruor);
		player:startEvent(0x0854, 1, cost, cost, cost, mask, 9, 1, cruor);
   else
      player:startEvent(0x0855, 50 * cost, 0, 0, 0, 0, 0, 2, cruor);
   end
   
end;

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

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

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

function onEventFinish(player,csid,option)
--	 printf("CSID: %u",csid);
--	 printf("RESULT: %u",option);
	 
	 local price = cost;
	
	if (csid == 0x0855) then
		if(option == 1) then
			player:setVar("ConfluxMask[Altepa]",mask + 1);
			player:setVar("cruor",cruor - 50 * price);	
		end
		
	
	elseif (csid == 0x0854) then
	--	if(option == 65537) then
	--		player:setVar("cruor",cruor - 1);
	--		player:setPos(410,0,287,255);
			print("price: %u",testvar);
	--	elseif(option == 1) then
	--		player:setVar("cruor", cruor - price);
		--	player:setPos(404,0,288);
	--	end
		
	end
	
	
end;


Re: Veridical Conflux

Posted: Wed Oct 07, 2015 6:31 pm
by kjLotus
the event can't check how much cruor you have, it has to know from an event param - so if you didn't pass in the cruor (or put it in the wrong param), the event is going to think you have 0 cruor

Re: Veridical Conflux

Posted: Thu Oct 08, 2015 11:40 am
by wadski
kjLotus wrote:the event can't check how much cruor you have, it has to know from an event param - so if you didn't pass in the cruor (or put it in the wrong param), the event is going to think you have 0 cruor

Yep, realized that after some trial an error and now i got this

Code: Select all

-----------------------------------

-- Area: Abyssea Altepa

-- NPC: Veridical Conflux #01

-- Type: Standard NPC

-- @zone 218

-- @pos 412 -1 288 218

-----------------------------------

package.loaded["scripts/zones/Abyssea-Altepa/TextIDs"] = nil;

-----------------------------------



require("scripts/globals/settings");

require("scripts/globals/status");

require("scripts/globals/keyitems");

require("scripts/globals/abyssea");

require("scripts/zones/Abyssea-Altepa/TextIDs");



-----------------------------------

-- onTrade Action

-----------------------------------



function onTrade(player,npc,trade)

end;



-----------------------------------

-- onTrigger Action

-----------------------------------



function onTrigger(player,npc)

   local Cruor = player:getCurrency("Cruor");

   mask = player:getVar("ConfluxMask[Altepa]");

   activated = player:getMaskBit(mask,0);

   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

   testvar = (600 + 800) * cost

   if(activated) then

    --  player:startEvent(0x0854, (100 + 100 * 65536) * cost, (1000 + 1200 * 65536) * cost, (1400 + 1600 * 65536) * cost, (1800 + 2000 * 65536) * cost, mask, 9, 1, cruor);

      player:startEvent(0x0854, 1, cost, cost, cost, mask, 9, 1, Cruor);

   else

      player:startEvent(0x0855, 50 * cost, 0, 0, 0, 0, 0, 2, Cruor);

   end

   

end;



-----------------------------------

-- onEventUpdate

-----------------------------------



function onEventUpdate(player,csid,option)

--    printf("CSID: %u",csid);

--    printf("RESULT: %u",option);

end;



-----------------------------------

-- onEventFinish

-----------------------------------



function onEventFinish(player,csid,option)

--    printf("CSID: %u",csid);

--    printf("RESULT: %u",option);

    

    local price = cost;

   

   if (csid == 0x0855) then

      if(option == 1) then

         player:setVar("ConfluxMask[Altepa]",mask + 1);

         player:setVar("cruor",cruor - 50 * price);   

      end

      

   

   elseif (csid == 0x0854) then

   --   if(option == 65537) then

   --      player:setVar("cruor",cruor - 1);

   --      player:setPos(410,0,287,255);

         print("price: %u",testvar);

   --   elseif(option == 1) then

   --      player:setVar("cruor", cruor - price);

      --   player:setPos(404,0,288);

   --   end

      

   end

   

   

end;

Everything works. i can get 3 confluxes functioning but its something to do with activated = player:getMaskBit(mask,0); that wont let me use more than 3.

Re: Veridical Conflux

Posted: Fri Oct 09, 2015 5:41 pm
by whasf
Use more bits then! :-)

Re: Veridical Conflux

Posted: Sun Oct 11, 2015 10:47 pm
by TeoTwawki
https://gist.github.com/TeoTwawki/b560b2183b1d27573ee8

Cannibalize anything that can help you. That's a slightly modified version of Troak's scripts.

Re: Veridical Conflux

Posted: Mon Oct 12, 2015 4:10 pm
by wadski
Thx! But the link 404'd on me =(

Re: Veridical Conflux

Posted: Mon Oct 12, 2015 4:13 pm
by wadski
whasf wrote:Use more bits then! :-)
Yeah, i tried a few different ones, but not getting the right ones or no idea which ones to use. almost there though! =)

Re: Veridical Conflux

Posted: Mon Oct 12, 2015 10:29 pm
by TeoTwawki
Corrected my link.

Re: Veridical Conflux

Posted: Mon Oct 19, 2015 12:01 pm
by wadski
teotwawki wrote:Corrected my link.

Awesome thx teo! =)

Re: Veridical Conflux

Posted: Thu Mar 01, 2018 10:25 pm
by warlord1352
Did you ever get that script to work?