Blockland Forums > Modification Help
Item hit event
Demian:
The temperature was dropping too much. Gotta keep the thread warm.
takato14:
Assisting with the warmth, as I am far too much of a scripting nub to actually help.
Demian:
My goodness! The thread was already suffering a level 2 hypothermia. Warming up. This is what needs to be done:
--- 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.)
Demian:
Please?
Demian:
Pretty please?