UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Scritpting a trigger that only reacts to a particular weapon.

broken avatar :(
Created 7 years ago
by battleduck
0 Members and 1 Guest are viewing this topic.
3,859 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 February 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
battleduck's Groups
battleduck's Contact & Social Links
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?
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
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?

I don't think its really possible to do something like that, you could check what weapon the player is holding instantly after it is triggered.

They did do something like this on revelations with the apothicon servant but I doubt it was a damage trigger they used.
Last Edit: November 08, 2016, 12:56:43 pm by reckfullies
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 February 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
battleduck's Groups
battleduck's Contact & Social Links
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
Marked as best answer by battleduck 7 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 1 year ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
Signature
Completed maps:
Kingdom Hearts - World at War Link
Minecraft - Black ops 3 Link

WIP:
~

×
shinged's Groups
shinged's Contact & Social LinksShingedvinny545TheShingedMatarra_
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

Code Snippet
Plaintext
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.
        }
    }
}

Wrote this in school so its untested.

Here's a list of all the weapons https://confluence.ugx-mods.com/display/UGXMODS/BO3+%7C+Weapon+List
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 February 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
battleduck's Groups
battleduck's Contact & Social Links
Thanks a lot buddy. I'll give a go when I get home from work tonight. Much appreciated.

Double Post Merge: November 09, 2016, 09:45:20 am
It works! awesome, thanks a lot dude.
Last Edit: November 09, 2016, 09:45:20 am by battleduck
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
i cant even get the standard "damage trigger" to work with any gun or explosive.

 
Loading ...