Forum

> > Stranded II > Scripts > Unit_ID
Forums overviewStranded II overview Scripts overviewLog in to reply

English Unit_ID

3 replies
To the start Previous 1 Next To the start

old Unit_ID

Luke81
User Off Offline

Quote
Hello.

Is there a script changing Unit_ID during the game?

For example, after killing an animal I would like a new-spawned animal to get the ID of the killed one.

Is it possible?

old Re: Unit_ID

Assassin moder
User Off Offline

Quote
Its not, units and any other entity will always get +1 of their Id per map

old Re: Unit_ID

JasJack67
Super User Off Offline

Quote
you can however assign a "variable" to each animal...and the one that gets killed(in the example you gave above) you can change the variable to match.

in the "definitions" of each animal you can add variables.

Then, the new spawned animal can be scripted to do what you intended it to do via the matching variable.

(they would be "global" variables, accessible in script from any other scripts.)

example:
unit2 $var1=1
unit3 $var2=2
unit4 $var3=3

unit2 with definition $var1=1 gets killed.
new unit4 spawns having $var3=3.

so you script ( maybe on:create{ ): $var3 = 1

now what ever you had scripted for unit2 (IF $var1=1) to do, you can this script instead (IF $var3=1) do this ELSEIF $var1=1) do this . .checking for the newly spawned animal/s first.
edited 5×, last 23.06.22 10:44:24 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview