

Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!Hi, i'm trying to work out how to script a trigger_damage that only triggers when damaged by a particular weapon (eg. raygun or gravity spikes)
Is there a way to check for what weapon inflicted the damage on the trigger, or do I need to do something like wait for the trigger to trigger, and then check which weapon the player had at the time?
How would i go about checking for the weapon?
I've tried a few things like trying to define current weapon = player GetCurrentWeapon
and desired weapon = "raygun" and then maybe an if statement to check if current weapon and desired weapon match.
Then if they match maybe I'd need a while loop to tell the trigger to wait till current and desired weapon match??
I'm not sure how to go about it
function init()
{
while(1)
{
desiredweapon = getWeapon("ray_gun"); // Weapon you want the player to have when shot
// weapon = getWeapon(string);
trig = getent("trigger", "targetname");
trig waittill( "trigger", player );
current_weapon = player getCurrentWeapon();
if( current_weapon == desiredweapon )
{
// do dis
// break; // if you only want this to happen once.
}
}
}