| Blockland Forums > Modification Help |
| Breaking onActivate |
| << < (3/5) > >> |
| jes00:
--- Quote from: Amade on November 09, 2011, 04:03:53 PM ---I'm having trouble believing you're unable to do this. Have you tried to script this? --- End quote --- Err, yes. I tried to have the onActivate function call another function that calls itself to sell the ore. but then it would give you a chat message every time it sells one ore : / |
| cheese6:
--- Code: ---function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec) { if(%client.ore <= 1) { %client.gold += %client.ore; messageClient(%client'',"\c6You got \c3" @ %client.ore @ " \c6gold and you now have \c3" @ %client.gold @ "\c6 gold."); %client.ore = 0; } messageClient(%client,'',"\c3You need more than 1 ore to sell ore."); Parent::OnActivate(%obj, %player, %client, %pos, %vec); } --- End code --- |
| jes00:
--- Quote from: cheese6 on November 09, 2011, 06:27:59 PM --- --- Code: ---function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec) { if(%client.ore >= 1) { %client.gold += %client.ore; messageClient(%client'',"\c6You got \c3" @ %client.ore @ " \c6gold and you now have \c3" @ %client.gold @ "\c6 gold."); %client.ore = 0; } messageClient(%client,'',"\c3You need more than 1 ore to sell ore."); Parent::OnActivate(%obj, %player, %client, %pos, %vec); } --- End code --- --- End quote --- Does not work but also does not break onActivate event. --- Code: ---package sellBrickOnActivate { function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec) { Parent::onActivate(%obj, %player, %client, %pos, %vec); if(%client.ore <= 1) { %client.gold += %client.ore; messageClient(%client,'',"\c6You sold your resources for \c3" @ %client.ore @ " \c6gold."); %client.ore = 0; } messageClient(%client,'',"\c3You do not have enough resources to sell."); } }; activatePackage(sellBrickOnActivate); --- End code --- |
| Superb:
Change if(%clien.tOre <= 1) to if(%client.Ore > 0) Its pretty obvious, you should spend lest time having people write code for you, and more time reading torque script documents to learn the basics. |
| Ipquarx:
--- Quote from: Superb on November 20, 2011, 01:33:22 PM ---Change if(%client.Ore <= 1) to if(%client.Ore > 0) --- End quote --- It's pretty obvious, you should spend less time mashing, and more time spellchecking. |
| Navigation |
| Message Index |
| Next page |
| Previous page |