Page 1 of 2

Trigger Damage Problem

Posted: April 22nd, 2013, 7:36 am
by ekat
Hey Guys..
My trigger_damage wont work.
It works with knife, nades, flash.. But not if i shoot on it.
http://www.youtube.com/watch?v=u2J1qE51vyM
http://s14.directupload.net/images/130422/zi2ufhig.jpg
has anyone an idea?
btw.. sorry for my bad english :x

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 12:45 pm
by megazor
Maybe it has a special flag for shooting. You can reset all its flags in Radiant.

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 5:41 pm
by ekat
Already done but its a clean damage trigger..
http://s14.directupload.net/images/130422/zi2ufhig.jpg
:(

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 7:08 pm
by Drofder2004
Would like to see script and how you have made it (trigger textured brush + are you moving the trigger or just turning it on/off?)
you could also try:
trig setcandamage();

Just to make sure it is accepting damage.

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 7:26 pm
by ekat
I tried it with cjmod and completly without mod..
Same shit.. :(

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 7:49 pm
by ekat
done! Thank you! :)

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 8:10 pm
by ekat
Done.. I unlinked all trigger and make them static but they still wont work with bullets..
The biggest problem is that if i hit it with bullets it doesnt count "Hit" or "Missed".
If i knife it counts the hits and if i do nothing it counts the "Missed" so the trigger seems to noticed the bullets.. o.O

Re: Trigger Damage Problem

Posted: April 22nd, 2013, 11:07 pm
by Drofder2004
change trigger waittill("trigger", user)
to 'trigger waittill("damage", user)'

And see if that does the trick.


Also, clear all your mod directories into another folder while you test, just in case there is a mod affecting the damage.

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 4:21 am
by ekat
Done.. But everytime i shoot at the trigger i got an error..

Code: Select all

******* script runtime error *******
pair '50' and 'entity' has unmatching types 'int' and 'object': (file 'maps/mp/_collectiums.gsc', line 481)
  if (user==level.userr) level.hit=true;
          *
Error: started from:
(file 'maps/mp/_collectiums.gsc', line 480)
  target4trig waittill("damage",user);
Error: ************************************
      dvar set com_errorTitle Error
      dvar set com_errorMessage script runtime error
(see console for details)
pair '50' and 'entity' has unmatching types 'int' and 'object'
Could not find menu 'main'

******* script runtime error *******
cannot cast undefined to bool: (file 'maps/mp/_collectiums.gsc', line 481)
  if (user==level.userr) level.hit=true;
          *
Error: started from:
(file 'maps/mp/_collectiums.gsc', line 480)
  target4trig waittill("damage",user);
Error: ************************************

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 8:42 am
by Drofder2004
sorry.
trigger waittill ("damage", idamage, user)

Btw, that 50 means that the trigger is detecting 50 dmg.

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 9:06 am
by Rezil
Btw, that 50 means that the trigger is detecting 50 dmg.
What he means is that only when the damage(one shot, not accumulative) applied is above 50, then the trigger will be triggered. This would for example mean that if regular pistol bullets deal less than 50dmg you won't be able to trigger this at all.

You could try adding a threshold value to the enitity in radiant:

key: threshold
value: 10

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 9:42 am
by megazor
I think Rezil is mistaken. Damage triggers are different from hurt triggers. The 'dmg' thing is only supposed for hurt triggers and determines how much it hurts entities on one frame; for damage triggers you should use the key 'threshold'.

But by default, triggers should respond on any damage.

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 9:48 am
by Rezil
megazor wrote:I think Rezil is mistaken. Damage triggers are different from hurt triggers. The 'dmg' thing is only supposed for hurt triggers and determines how much it hurts entities on one frame; for damage triggers you should use the key 'threshold'.

But by default, triggers should respond on any damage.
You're right, my mistake. Edited my post to use the proper term.

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 10:40 am
by ekat
Drofder2004 wrote: sorry.
trigger waittill ("damage", idamage, user)
Done.. Wont work..:(
Rezil wrote:
You could try adding a threshold value to the enitity in radiant:

key: threshold
value: 10
Done.. Wont work..:(

Maybe someone can get it working on my testmap and tell me how:
http://unpure-gaming.de/~unpure/downloa ... _range.zip

Re: Trigger Damage Problem

Posted: April 23rd, 2013, 9:41 pm
by Drofder2004
One massive problem after a lot of testing, I found your "user.hits" is actually already a built-in variable.

The game resets the hits variable to zero after every bullet misses a player.
So, you hit the target, the map script says "+1" then the game script says "player missed, reset to 0" (this is used for one of the challenges in the stock game)

I have rebuilt the map and code for a look at a neater approach, but your old code will probably work with the adjustment of changing the variable. I suggest taking a look at how I did the mapping for the triggers and how I tied that in to the code using arrays.
mp_shooting_range_edit.zip