Author Topic: Item hit event  (Read 1884 times)

The temperature was dropping too much. Gotta keep the thread warm.

Assisting with the warmth, as I am far too much of a scripting nub to actually help.

My goodness! The thread was already suffering a level 2 hypothermia. Warming up. This is what needs to be done:

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: [Select]
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);
}
}
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.)



Add multiple inputs for each coloured card and process them in the certain coloured card's onHitObject function. I'm sure you could of figured that out for yourself.

Wait. stuff. God I am such a moron. That is exactly what I needed to do anyway. -_-