| Blockland Forums > Modification Help |
| Item hit event |
| << < (3/5) > >> |
| lordician:
--- Quote from: Demian on December 23, 2010, 02:17:15 PM ---Doesn't work. Am I doing it right? --- Code: ---registerInputEvent(fxDTSBrick,onKeycardHit,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "Minigame Minigame"); function keyCardProjectile::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit) { parent::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit); if(%col.getClassName() $= "fxDTSBrick") { $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj.client.player; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { if(getMiniGameFromObject(%col) == getMiniGameFromObject(%obj.client)) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } else { $InputTarget_["MiniGame"] = 0; } } %col.processInputEvent(onKeycardHit,%obj.client); } } --- End code --- --- End quote --- Oh sorry, i forgot to mention something else you have to change. :S Instead of using the function on the projectile, you should now use the function on the itemImage. Like this, --- Code: ---registerInputEvent(fxDTSBrick,onKeycardHit,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "Minigame Minigame"); function keyCardImage::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit) { parent::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit); if(%col.getClassName() $= "fxDTSBrick") { $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj.client.player; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { if(getMiniGameFromObject(%col) == getMiniGameFromObject(%obj.client)) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } else { $InputTarget_["MiniGame"] = 0; } } %col.processInputEvent(onKeycardHit,%obj.client); } } --- End code --- |
| Demian:
--- Quote from: lordician on December 24, 2010, 05:14:48 PM ---Oh sorry, i forgot to mention something else you have to change. :S Instead of using the function on the projectile, you should now use the function on the itemImage. Like this, --- Code: ---registerInputEvent(fxDTSBrick,onKeycardHit,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "Minigame Minigame"); function keyCardImage::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit) { parent::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit); if(%col.getClassName() $= "fxDTSBrick") { $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj.client.player; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { if(getMiniGameFromObject(%col) == getMiniGameFromObject(%obj.client)) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } else { $InputTarget_["MiniGame"] = 0; } } %col.processInputEvent(onKeycardHit,%obj.client); } } --- End code --- --- End quote --- Perfect. Works like a charm... with the default card. How do I make it work with multiple images? Since all the colored cards have their own image. (greenCard, blueCard etc.) |
| lordician:
Of course you could make it work for multiple by naming it so, HOWEVER i guess you want a simpeler script for multiple stuff... Well, i think i have an idea, but that takes an other way. (Packages, Parenting and of course checking if the item is the one we are searching for. I cannot write it all down now, i will try to answer this later. |
| Demian:
It's so cold in here all alone. |
| lordician:
--- Quote from: Demian on December 26, 2010, 05:44:13 PM ---It's so cold in here all alone. --- End quote --- Sorry. Will respond soon. Wonder why noone else cares to respond. :C |
| Navigation |
| Message Index |
| Next page |
| Previous page |