Unit hit detection

Unit hit detection

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Unit hit detection

Post by Forboding Angel »

Is there any way for a script to know when a unit has been hit by a weapon?

I think it would be kinda neat to script in a rocking effect for when unit are hit by large damageweapons.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Unit hit detection

Post by Argh »

- HitByWeaponId(z,x,id,damage) will be called instead of HitByWeapon if it exist

In the changelog, it works, you just have to define ids for your weapons.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Unit hit detection

Post by FLOZi »

Note that multiple weapons can have the same ID;

e.g. All S44 Armour-Piercing rounds have id=100
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Unit hit detection

Post by KDR_11k »

BTW, you can just use RockUnit like the OTA units do, the engine will call that by itself.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Unit hit detection

Post by rattle »

Are the pseudo angles in RockUnit right for weapon hits? RockUnit gets called whenever a weapon is fired too btw.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Unit hit detection

Post by Forboding Angel »

yar rockunit would work just fine. Thanks guys!
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Unit hit detection

Post by Warlord Zsinj »

I wonder if it would be possible to somehow use rockunit while the unit is firing to make it rock in the appropriate direction from kickback...
User avatar
Otherside
Posts: 2296
Joined: 21 Feb 2006, 14:09

Re: Unit hit detection

Post by Otherside »

im pretty sure some of the CA units do this already
User avatar
clumsy_culhane
Posts: 370
Joined: 30 Jul 2007, 10:27

Re: Unit hit detection

Post by clumsy_culhane »

t1 artillery in CA uses it.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Re: Unit hit detection

Post by Guessmyname »

Warlord Zsinj wrote:I wonder if it would be possible to somehow use rockunit while the unit is firing to make it rock in the appropriate direction from kickback...
That was possible in good old TA Zsinj :P
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Unit hit detection

Post by Warlord Zsinj »

Indeed, I know it was in OTA, but I hadn't seen any mods use it in Spring.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Unit hit detection

Post by rattle »

I stopped using it because the "angles" are useless for tanks, unless you are fine with them wiggling in the wrong direction, and I was too lazy to write my own script which takes body and turret rotation into account. Though I think S44 got it right.
Post Reply

Return to “Engine”