Custom Shop using different currency (Cruor, Bayld, etc)

Post Reply
bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Custom Shop using different currency (Cruor, Bayld, etc)

Post by bluesolarflare » Thu Jun 04, 2015 12:25 pm

Hello,

I am looking to create a shop that instead of using gil to purchase items, uses Cruor or Bayld. Is it possible that this can be coded into a shop script?

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

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by whasf » Thu Jun 04, 2015 4:06 pm

I don't think so, I think the client is hard-coded that way for shops.
-- Whasf

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

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by TeoTwawki » Thu Jun 04, 2015 5:01 pm

Can't use actual shop windows to do it. You can make NPC's deduct any "point" type via script, but you've no way to create a a menu for the player to select from.
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

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by bluesolarflare » Thu Jun 04, 2015 5:55 pm

Yeah that was pretty much my fallback. I set up a normal shop with the price in gil, but I have a condition to check for bayld. If the player doesn't have enough to purchase the lowest item, a system message pops up saying they need X amount purchase anything. Once they have enough, the shop opens and they can purchase with gil and it deducts bayld as well. The only problem I have is finding a way to force close the shop (requiring another bayld check) after the purchase so they can't stay in the menu to buy infinite items.

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by bluesolarflare » Thu Jun 04, 2015 9:02 pm

Actually ran into a problem. Is there a way to track a purchase so that a rule can be used to delCurrency? I was thinking through the system message "you buy a ___ from the shop" but I don't know how to script that portion.

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

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by TeoTwawki » Thu Jun 04, 2015 11:16 pm

Nope. This is simply not a thing you can get working exactly how you want by script.

You could possibly edit the core where it deals with shops but then you have the problem of how to tell your custom shops from regular shops (and you'd need to know C++ for that). There is no easy road to a real shop that uses anything but gil.
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

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by bluesolarflare » Fri Jun 05, 2015 2:09 pm

Thanks for the reply. I was able to setup a different system that gave me somewhat what I wanted:

Talking to the NPC opens up the store to "sell" endgame gear. The price is set fairly high in gil, but there is a system message that states that if you do not have the gil, you can exchange certain vanilla 99 armor and he will upgrade it to the same pieces he sells but deduct the same amount of bayld listed. There is a check to ensure that when a player trades the vanilla gear that they have enough bayld for the transaction.

The vanilla gear can only be obtained through the mogstore which has certain requirements that need to be met (currently level 99 but plan to expand it to full Zilart clear)

bluesolarflare
Posts: 129
Joined: Wed May 27, 2015 4:23 pm

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by bluesolarflare » Sat Aug 15, 2015 9:58 pm

If anyone is curious here is the code I used as an example. It uses Mweya Plasm as the currency and when the player trades an Exuine Coat, if they have 17,500 plasm, the NPC upgrades it to a Manibozo Jerkin.

Code: Select all

function onTrade(player,npc,trade)
balance = 0;
jerkin = 17500; // This is how much the upgraded item costs
local uplasm = player:getCurrency("mweya_plasm");
if (trade:hasItemQty( 10475, 1 )) then   
	if (uplasm >= jerkin) then    //This is a check to see if the player has enough plasm 
              player:delCurrency("mweya_plasm", 17500);
	player:tradeComplete();
	player:addItem(27918,1);
	player:messageSpecial(ITEM_OBTAINED,27918,1);
	else
	balance = jerkin - uplasm;  //variable to determine how much is needed if not enough
	player:PrintToPlayer( "I'm sorry, you need "..balance.." more Plasm for me to upgrade that armor");
end
else
player:PrintToPlayer("I can't do anything with that armor...");
end



end; 



kennxonline
Posts: 56
Joined: Sun Mar 23, 2014 2:58 pm

Re: Custom Shop using different currency (Cruor, Bayld, etc)

Post by kennxonline » Fri Feb 05, 2016 11:07 pm

how would one do this using conquest points?

Post Reply