Author Topic: Wand Trigger Problems  (Read 347 times)

I am making a wand that is normal, but I have made a right click code, but the problem is, I will not work, there is no console error either.


Here is the code

Code: [Select]
package FireRad
{
   function Armor::onTrigger(%this, %player, %slot, %val, %obj, %but)
{
if(%player.getMountedImage(0) == FireRadImage.getID() && %but == 4)
{
if((getSimTime() - %obj.lastFireRad) < 5000)
{
  if(isObject(%player.client))
{
%transform = %obj.getTransform();
%obj.client.camera.setOrbitMode(%obj, %transform, 0.5, 8, 8, 1);
%obj.client.camera.mode = "Orbit";
%obj.client.setControlObject(%obj.client.camera);
%obj.schedule(100,startFireRad);
}
}
else
{
messageClient(%client, '', 'You must wait before using the radius again.');
}
}
Parent::onTrigger(%this, %player, %slot, %val);
}
};
ActivatePackage(FireRad);
« Last Edit: February 15, 2013, 07:24:34 PM by Advanced Bot »

There is no %obj or %but vars. Use %player instead of %obj and %slot instead of %but. You also will want to check if %val is true to only detect when it's pushed and not pushed or released.

There is no %obj or %but vars. Use %player instead of %obj and %slot instead of %but. You also will want to check if %val is true to only detect when it's pushed and not pushed or released.

I have tried that and it is still not working...

Code: [Select]
  function Armor::onTrigger(%this, %player, %slot, %val, %obj, %but)
{
if(%player.getMountedImage(0) == FireRadImage.getID() && %slot == 4 && %val == 1)
{
if((getSimTime() - %player.lastFireRad) < 5000)
{
   if(isObject(%player.client))
{
%transform = %player.getTransform();
%player.client.camera.setOrbitMode(%player, %transform, 0.5, 8, 8, 1);
%player.client.camera.mode = "Orbit";
%player.client.setControlObject(%player.client.camera);
%player.schedule(100,startFireRad);
}
}
else
{
messageClient(%client, '', 'You must wait before using the radius again.');
}
}
Parent::onTrigger(%this, %player, %slot, %val);
}

Okay, nevermind, I have fixed something, no clue what I did, but I have fixed it, it works now.

Code: [Select]
function Armor::onTrigger(%this,%obj,%slot,%val)
{
Parent::onTrigger(%this,%obj,%slot,%val);
if(%slot == 4 && %val)
{
if(%obj.getMountedImage(0) == FireRadImage.getID())
{
%transform = %obj.getTransform();
%obj.client.camera.setOrbitMode(%obj, %transform, 0.5, 8, 8, 1);
%obj.client.camera.mode = "Orbit";
%obj.client.setControlObject(%obj.client.camera);
%obj.schedule(100,startFireRad);
}
else
{
messageClient(%client, '', 'You must wait before using the radius again.');
}
}
}