| Blockland Forums > Modification Help |
| Variable Events |
| << < (4/4) |
| otto-san:
--- Quote from: Ash on May 16, 2011, 03:14:01 AM ---1) Use VCE 2) Make a special "money" variable 3) ??? 4) Profit No confusing scripting necessary. --- End quote --- He wants to make a script. |
| Ash:
--- Quote from: otto-san on May 16, 2011, 05:44:53 PM ---He wants to make a script. --- End quote --- And I'm saying that he doesn't need to do that. |
| Daenth:
Just a question... doesn't the first line override the "addItem" event? --- Code: ---registerOutputEvent("Player", "AddItem", "datablock ItemData", "Money" 1); function Player::addItem(%player,%image,%client) { for(%i = 0; %i < %player.getDatablock().maxTools; %i++) { %tool = %player.tool[%i]; if(%tool == 0) { if(%client.money = "Money") { %player.tool[%i] = %image; %player.weaponCount++; messageClient(%client,'MsgItemPickup','',%i,%image); break; } else return; } } } function fxDtsBrick::ifMoneyValid(%brick,%client) { $inputTarget_Self = %brick; $inputTarget_Player = %client.player; $inputTarget_Bot = %brick.vehicle; $inputTarget_Client = %client; $inputTarget_Minigame = getMinigameFromObject(%client); if(%client.money >= "Money"); %brick.processInputEvent("ifMoneyValid",%client); } function fxDtsBrick::ifMoneyInvalid(%brick,%client) { $inputTarget_Self = %brick; $inputTarget_Player = %client.player; $inputTarget_Bot = %brick.vehicle; $inputTarget_Client = %client; $inputTarget_Minigame = getMinigameFromObject(%client); if(%client.money < "Money"); %brick.processInputEvent("ifMoneyValid",%client); } --- End code --- Cleaned up the code a bit and fixed a few things, it doesn't do what you want it to do though... or work. It would be much easier with VCE. |
| Nexus:
--- Quote from: Daenth on May 19, 2011, 08:46:51 PM ----snip- --- End quote --- OP already admitted that this code was garbage that he added so it wouldn't look like a request. I don't think he actually wants it to have anything to do with the AddItem event. And I don't think you can do those "if" tests with strings like that. |
| Greek2me:
--- Quote from: Ash on May 16, 2011, 07:12:22 PM ---And I'm saying that he doesn't need to do that. --- End quote --- He does. I think he's doing this for a scripting contest. Also, - Do not put ; after an if statement. - The >= operator is for comparing integers (greater than or equal to). if(%client.money >= "Money"); You are trying to compare a string with an integer operator. I also don't think you want anything to do with a string. You should replace "Money" with something like $MyMoneyMod::maxMoney |
| Navigation |
| Message Index |
| Previous page |