Author Topic: Input Event - onTorchHit  (Read 1264 times)

Anyways, I'm making an RP of some sorts, and it uses the new Torch Item a good deal. I thought an input event for using the torch on a brick would make for a interesting new experience.
Here's the problem:
I can't script worth stuff.

I know this goes in there somewhere:


function TorchjWeaponImage::onPreFire(%this, %obj, %slot)
{
   %obj.playthread(2, armattack);
}

function TorchjWeaponImage::onStopFire(%this, %obj, %slot)
{   
   %obj.playthread(2, root);
}

function torchProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client)
{

And i'm pretty sure I got the code for the event right too, I just don't know the format or where to insert these codes.

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(onTorchHit,%obj.client);
   }
}

If anyone can insert this into the Torch script so that it works, please do so.

Thanks, here's the Torch script if you don't already have it.
« Last Edit: April 09, 2011, 02:14:12 AM by eddierocks2000 »


That is pretty helpful.
I'll mess around with that later.

So i've been plugging in stuff to this code over and over and can't get it to work.
I honestly don't know what i'm doing but here's what I have:

Quote
registerInputEvent(fxDTSBrick,onTorchHit,"Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "Minigame Minigame");

function TorchjWeaponImage::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(onTorchHit,%obj.client);
   }
}
I've tried using the projectile instead of the image, and onCollision, instead of onHitObject.
I thought it worked, and it registers the event in the input list, but it never has any effect.

So when i'm testing it, ill put:
onTorchHit --> Player --> Kill
But when I hit it nothing happens.

Help please.

I also tried this approach:

Quote
registerInputEvent("fxDTSBrick","onTorchHit","Self fxDTSBrick" TAB "Player Player" TAB "Client GameConnection" TAB "MiniGame MiniGame" TAB "Owner(Player) Player" TAB "Owner(Client) GameConnection",1);
function fxDTSBrick::onTorchHit(%obj,%client)
{
   $InputTarget_["Self"] = %obj;
   $InputTarget_["Player"] = %client.Player;
   $InputTarget_["Client"] = %client;
   
   if(%client.minigame == %obj.getGroup().client.minigame)
   {
      $InputTarget_["MiniGame"] = %obj.getGroup().client.minigame;
   }
   
   $InputTarget_["Owner(Player)"] = %obj.getGroup().client.Player;
   $InputTarget_["Owner(Client)"] = %obj.getGroup().client;
   %obj.processInputEvent("onTorchHit",%client);
}
Same problem.

Try modding some other stuff like the onpickaxehit events.

Try modding some other stuff like the onpickaxehit events.

I know how to do that, and have before.
But then the torch loses the emitter, and burn function.
« Last Edit: April 10, 2011, 06:03:47 AM by eddierocks2000 »

Still here.
Still need help.
Please.

Problem: Although the event registers, it has no effect.

There has to be someone who cares enough to help me out...

Honestly now, I doubt this is very complicated at all.