Veridical Conflux

Post Reply
wadski
Posts: 46
Joined: Sun May 24, 2015 6:09 pm

Veridical Conflux

Post by wadski » Wed Oct 07, 2015 12:35 pm

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;


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

Re: Veridical Conflux

Post by kjLotus » Wed Oct 07, 2015 6:31 pm

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

wadski
Posts: 46
Joined: Sun May 24, 2015 6:09 pm

Re: Veridical Conflux

Post by wadski » Thu Oct 08, 2015 11:40 am

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.

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

Re: Veridical Conflux

Post by whasf » Fri Oct 09, 2015 5:41 pm

Use more bits then! :-)
-- Whasf

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Veridical Conflux

Post by TeoTwawki » Sun Oct 11, 2015 10:47 pm

https://gist.github.com/TeoTwawki/b560b2183b1d27573ee8

Cannibalize anything that can help you. That's a slightly modified version of Troak's scripts.
Last edited by TeoTwawki on Mon Oct 12, 2015 10:28 pm, edited 1 time in total.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

wadski
Posts: 46
Joined: Sun May 24, 2015 6:09 pm

Re: Veridical Conflux

Post by wadski » Mon Oct 12, 2015 4:10 pm

Thx! But the link 404'd on me =(

wadski
Posts: 46
Joined: Sun May 24, 2015 6:09 pm

Re: Veridical Conflux

Post by wadski » Mon Oct 12, 2015 4:13 pm

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! =)

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Veridical Conflux

Post by TeoTwawki » Mon Oct 12, 2015 10:29 pm

Corrected my link.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

wadski
Posts: 46
Joined: Sun May 24, 2015 6:09 pm

Re: Veridical Conflux

Post by wadski » Mon Oct 19, 2015 12:01 pm

teotwawki wrote:Corrected my link.

Awesome thx teo! =)

warlord1352
Posts: 34
Joined: Sat Feb 10, 2018 1:52 am

Re: Veridical Conflux

Post by warlord1352 » Thu Mar 01, 2018 10:25 pm

Did you ever get that script to work?

Post Reply