Blockland Forums > Modification Help
Blockland Weapon Buy System
heedicalking:
Cool. I can't wait for a release so I could see the code. I need to get a buy function for my Colony RPG thing.
HellsHero:
--- Quote from: heedicalking on March 13, 2010, 08:39:32 PM ---Cool. I can't wait for a release so I could see the code. I need to get a buy function for my Colony RPG thing.
--- End quote ---
Since I think the release will be a while... Here's the main buy function:
--- Code: ---function setWBuyInven(%this,%item,%slot,%name,%cost,%special) //client-itemName-slotNumber-GuiName-Price-NonItemBuying
{
if(!%this.player.CanWeaponBuy) {
messageClient(%this,'',"\c2You are not in a Buy zone so you cannot buy anything from the shop.");
return; }
else {
echo(%this.WBuyMoney);
echo(%cost);
if(%this.WBuyMoney <= %cost) {
messageClient(%this,'',"\c2You do not have enough money to buy "@%name@" for $"@%cost@".");
return; }
else {
%player = %this.player;
if(%special == 1) {
commandToClient(%this,'UpdateWBuyArmHUD_0');
%this.WBuyMoney = %this.WBuyMoney-%cost;
%this.player.changeDatablock("PlayerNoArmour");
%this.player.setEnergyLevel(0); }
if(%special == 2) {
commandToClient(%this,'UpdateWBuyArmHUD_1');
%this.WBuyMoney = %this.WBuyMoney-%cost;
%this.player.changeDatablock("PlayerLightArmour");
%this.player.setEnergyLevel(50);
messageClient(%this,'',"\c2You have bought "@%name@" for $"@%cost@"!"); }
if(%special == 3) {
commandToClient(%this,'UpdateWBuyArmHUD_2');
%this.WBuyMoney = %this.WBuyMoney-%cost;
%this.player.changeDatablock("PlayerHeavyArmour");
%this.player.setEnergyLevel(100);
messageClient(%this,'',"\c2You have bought "@%name@" for $"@%cost@"!"); }
if(isObject(%player) && %special <= 0) {
%slot--;
messageClient(%this,'',"\c2You have bought "@%name@" for $"@%cost@"!");
%this.WBuyMoney = %this.WBuyMoney-%cost;
%player.tool[%slot]=%item.getID();
messageClient(%this,'MsgItemPickup','',%slot,%item.getID());
}
%this.WBuyPrint();
}
}
}
--- End code ---
Aren't I nice? All you have to do is figure out how to use it correctly.
tikitai:
dust plz
HellsHero:
--- Quote from: tikitai on March 13, 2010, 09:36:49 PM ---dust plz
--- End quote ---
What?
Dr.Pain:
--- Quote from: HellsHero on March 13, 2010, 09:40:14 PM ---What?
--- End quote ---
He means the map.