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

Scripting with a trigger_damage

broken avatar :(
Created 11 years ago
by sedozz
0 Members and 1 Guest are viewing this topic.
1,858 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 4 January 2015
Last active: 1 year ago
Posts
184
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Battlefield is giving COD the hands rn
Signature
I just spent two hours moving trees around.
×
sedozz's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
sedozz's Contact & Social Linkssedozzsedozz
I currently have a script that moves a clip brush once a trigger_damage is activated. In radiant, i have the trigger_damage with the KVP of accumulate,40, and no spawnflags. I was under the impression that the accumulate KVP would determine the damage that needs to accumulate before the trigger is activated. However, it appears that no matter how much I shoot the trigger, it does not activate. It does, however, activate if a grenade explodes near it, or an RPG impacts it. To be clear, there are NO SPAWNFLAGS on thetrigger restricitng the trigger to splash and projectile only, I checked.

The function being triggered is below, and is very simple. I'd appreciate any help!

Code Snippet
Plaintext

init()
{
//VARS INIT

w1_t = getEnt("w1_t", "targetname");
w1_c = getEnt("w1_c", "targetname");
thread run(w1_t, w1_c);
}

run(trig, clip)
{
trig waittill("trigger"); //Trigger_damage in radiant
clip delete(); //DYNAMIC PATH IS A MUST FOR PROPER NODING
trig delete();
}

Also, as a second question, in the above, I'm sure there is a more elegant way to write it. I'm fairly sure I could use an array, as in the actual script, ive copied the VAR INIT section 30 times, changing the targetnames to be w2_t, w3_t etc. I just want to be sure that if I activate one trigger it doesnt move the worng brush.
Last Edit: March 19, 2015, 01:47:44 pm by sedozz
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
not sure about the accumulate damage stuff, never messed with that. For setting it up as an array:

Make the triggers target the clip they need to move ( select trigger, then the clip and press 'w' )
Give all triggers the same targetname ( i used shoot_trigger in the example), and then do this:

Code Snippet
Plaintext

triggers = getentarray( "shoot_trigger", "targetname" );
array_thread( triggers,::shootme);

shootme()
{
     self waittill( "trigger" );
     clip = getent( self.target, "targetname" );
     clip connectpaths();
     clip delete();
     self delete();
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 4 January 2015
Last active: 1 year ago
Posts
184
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Battlefield is giving COD the hands rn
×
sedozz's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
sedozz's Contact & Social Linkssedozzsedozz
I need all of the clips to be separately named though correct? Also is the connect paths needed if the clips are dynamic paths?

I really need help with that accumulate dammit haha

Thanks tough, I appreciate the response!
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Connectspaths is needed yes, and this only move's the clips that are targeted by that trigger.
So if you only link ( target ) one clip with a trigger, only one clip will move.

EDIT:
No need to give the clips each a targetname by hand. If you use the 'w' to connect them to a trigger, it does this for you.



Srry about the damage stuff, rlly dont know about that. Dont you need to gicve the trigger some kind of 'health' kvp so it knows when it's accumulated enough damage? Just guessing, not on a computer with radiant atm..

Double Post Merge: March 19, 2015, 05:57:08 pm
If you cant get it working with the spawnflags, you can use this script to get the same result:

Code Snippet
Plaintext

main()
{
triggers = getentarray( "shoot_trigger", "targetname" );
array_thread( triggers,::shootme);
}

shootme()
{
my_health = 500;

while(1)
{
self waittill( "damage", amount, attacker );
if( isplayer( attacker )
my_health-=amount;

if( my_health <= 0 )
break;
}
clip = getent( self.target, "targetname" );
clip connectpaths();
clip delete();
self delete();
}

Last Edit: March 19, 2015, 05:57:51 pm by BluntStuffy

 
Loading ...