Invulnerable units

Invulnerable units

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
gajop
Moderator
Posts: 3040
Joined: 05 Aug 2009, 20:42

Invulnerable units

Post by gajop »

Is it possible to set a flag for a specific player unit (not UnitDef nor feature), that would mark that unit invulnerable - i.e. completely immune to any kind of damage or negative effect, targeted or otherwise.
Again, much like the 'infinite resource' request, this would allow for unit AI to avoid shooting as such units, and it's much easier to work with other negative effects (such as slow), rather than having to do your own custom checks.
An example of how it would be set is

Code: Select all

Spring.SetUnitInvulnerable(number unitId, boolean invulnerable)
Rationale: It would be useful in custom games - you don't want the player to be able to attack certain structures, or you want to force the player to kill stuff in the right order. It may also be useful in skirmish games if you can imagine creating some sort of missiles/turrets/bombs that can only be hit at certain times, or "event units" such as bombers that you don't want people to be able to shoot down f.e, or just not at all times.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6194
Joined: 29 Apr 2005, 01:14

Re: Invulnerable units

Post by FLOZi »

Can be done per unitID with UnitPreDamaged callin, you'd have to inform the AI via some other means though.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7031
Joined: 16 Nov 2004, 13:08

Re: Invulnerable units

Post by zwzsg »

Have UnitPreDamaged() or UnitDamaged() return 0 for the units you want to be invulnerable.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Invulnerable units

Post by Niobium »

Relevant:
Spring.SetUnitNeutral(number unitID, boolean neutral) -> nil
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Invulnerable units

Post by KDR_11k »

Niobium wrote:Relevant:
Spring.SetUnitNeutral(number unitID, boolean neutral) -> nil
That's what Fibre does to prevent the invulnerable units from screwing things up.
Post Reply

Return to “Game Development”