Page 1 of 1

Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 13:47
by The Dark Lord
Is it possible to do this? I couldn't find any scripts that could help me to achieve this.

Re: Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 15:10
by Krom
IIRC there's no such script command.

Re: Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 15:36
by The Dark Lord
Would you consider adding a script that affects regeneration time of life points? This allows use of 'hero units'... :)

Re: Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 16:42
by Esthlos
Would you consider adding a script that affects regeneration time of life points? This allows use of 'hero units'... :)
This should be very easy to do... a States.UnitHealth and an Actions.UnitSetHealth would be enough for this, imho.
  Code:
function TKMUnit.GetHealth: Byte; begin result := fHitPoints; end; procedure TKMUnit.SetHealth(aHP: Byte); begin if aHP <= 0 then fHitPoints := 0 else if aHP >= HitPointsMax then fHitPoints := HitPointsMax else fHitPoints := aHP; end;
Anyway, as far as I know this is what comes closest to that at the moment:
  Code:
procedure OnUnitAfterDied(aUnitType, aOwner, aX, aY); begin if aUnitType >= 14 then Actions.GiveGroup(aOwner, aUnitType, aX, aY, 0, 1, 1) else Actions.GiveUnit(aOwner, aUnitType, aX, aY, 0); end;

Re: Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 18:28
by Krom
Problem with that, is that there's no in-game indication of how much HP unit has got and if he is invulnerable.

Re: Making a group/unit invulnerable

PostPosted: 30 Jan 2016, 21:28
by The Dark Lord
There is alsno no in-game indication if I spawn 1000 enemy knights on top of your storehouse at the start of the mission... Except the 1000 knights. Abusers are going to abuse, why punish the righteous? :(

Re: Making a group/unit invulnerable

PostPosted: 31 Jan 2016, 06:58
by Krom
There is alsno no in-game indication if I spawn 1000 enemy knights on top of your storehouse at the start of the mission... Except the 1000 knights. Abusers are going to abuse, why punish the righteous? :(
There were none and next second there's 1000 - that is indication.

Added to proposals list (https://github.com/Kromster80/kam_remak ... ipting.txt)

Re: Making a group/unit invulnerable

PostPosted: 31 Jan 2016, 07:04
by Krom
  Code:
procedure TKMUnit.SetHealth(aHP: Byte); begin if aHP <= 0 then fHitPoints := 0 // Sidenote: type Byte can not possibly be less than 0 by design else if aHP >= HitPointsMax then fHitPoints := HitPointsMax else fHitPoints := aHP; end;
There's a better way:
  Code:
procedure TKMUnit.SetHealth(aHP: Byte); begin // We don't want to accidentally kill the unit by setting HP to 0 fHitPoints := EnsureRange(aHP, 1, HitPointsMax); end;

Re: Making a group/unit invulnerable

PostPosted: 31 Jan 2016, 09:52
by Esthlos
There's a better way:
  Code:
procedure TKMUnit.SetHealth(aHP: Byte); begin // We don't want to accidentally kill the unit by setting HP to 0 fHitPoints := EnsureRange(aHP, 1, HitPointsMax); end;
Didn't know about the EnsureRange function :$

Why are UnitHPGet and UnitHPMax Actions instead of States? (?)

Re: Making a group/unit invulnerable

PostPosted: 31 Jan 2016, 11:06
by vovets1
+1 to this idea as a Magic Arena developer.

Re: Making a group/unit invulnerable

PostPosted: 08 Nov 2016, 11:06
by Rey
Andreas just fix this, PR is on the way. Will see in the next release.
Check it out: https://www.youtube.com/watch?v=x3aV6zEaCXs

Re: Making a group/unit invulnerable

PostPosted: 08 Nov 2016, 14:51
by Esthlos
Andreas just fix this, PR is on the way. Will see in the next release.
Check it out: https://www.youtube.com/watch?v=x3aV6zEaCXs
It would also be awesome if the next KaM release also had:
  • Actions.UnitTypeChange (at least for warriors)
  • Actions.CreateFromTile (unit is created by walking in from a tile, so that we can make units exit buildings, caves, or even come in from the map's borders)
  • Actions.KillToTile (the reverse of CreateFromTile, even limiting it to the 4 adjacent tiles would still be nice)
:D

Re: Making a group/unit invulnerable

PostPosted: 09 Nov 2016, 00:59
by Ben
Problem with that, is that there's no in-game indication of how much HP unit has got and if he is invulnerable.
The game Empire Earth has a small graphical indication when a unit or building has been modified by "scripts." Adding such a mechanic to KaM could be quite useful, though it's much harder to do since soldiers are typically controlled as a collective unit rather than individually.

Now, it is[/] possible to select individual soldiers in KaM. Say, for example, that you select a knight within a group of knights. This respective individual knight's stats have been modified. This could be shown by a special icon of sorts on the screen where his condition and commands are shown. This icon could be displayed automatically when a unit is edited or manually through an additional script, whichever is easier/has more support with the community.

Furthermore, a similar feature of changing a soldier's or citizen's name could be quite useful. Best would be replacing the soldier's type with his name (change the label "knight" to "King John." for example). This would be both a very popular and useful feature, as mission makers have already put unique units in their missions.


Whew. There's my wall of text of the week. I typed all of that on my phone so please forgive any silly autocorrections I might have not replaced.

Re: Making a group/unit invulnerable

PostPosted: 09 Nov 2016, 04:22
by Krom
Changing units name will be fun indeed :-)

Re: Making a group/unit invulnerable

PostPosted: 10 Nov 2016, 18:23
by RandomLyrics
Good idea! States.UnitHp, Actions.UnitSetHp would be nice :) for my maps i use "Respawn" method, but its not cool :P