• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(24320)

Field Marshal
Jan 5, 2004
5.296
40
anyone know the syntax to the switch_allegiance command ?

i suspect that an example would be useful...

thanks in advance !
 
type = switch_allegiance which = [unit id type/-1 random land/-2 random naval/-3 random air] value = [unit id id] where = [country] # value will be ignored if which = -1/-2/-3
 
ADukes: type = switch_allegiance which = [unit id type/-1 random land/-2 random naval/-3 random air] value = [unit id id] where = [country] # value will be ignored if which = -1/-2/-3

that info is in the event commands.txt file. it does not show me how to switch the allegiance of a specific enemy unit. what info is meant by "[unit id type]" (i assume land, naval, air). however, i cannot figure out what to use in the value field, specificially what constitutes the field "[unit id id]".

FWIW, i have tried "value = { id = { type = 4712 id = 540743 } } where = XXX " and "value = { type = 4712 id = 540743 } where = XXX ". they both crash the game ! :eek: . . XXX = current owner of the unit

ideas ? hmmm. i will try brackets "[]"s instead of "{}"s, although from what i have seen, the "{}"s are supposed to be used...

thanks in advance ! :cool:
 
ADukes: type = switch_allegiance which = 4712 value = 540743 where = XXX ; .. XXX = new owner of the unit

after many tries (and some days) to make the modified event work, i gave up and decided to rewrite it. Lo and behold, the second thing i noticed is that i still had a "which = land" in the event ! ! :wacko:

fixed that error, and presto, it works ! ! :D

many, many thanks ! !
GW
 
For value = [unit id id] as well?
Incidentally...how do we figure out the unit id of a unit created/added through an event?
 
how do we figure out the unit id of a unit created/added through an event?

When I mod a .inc file unit ID's are assigned a random string and then start at 1 for each 'type' - so I assume that you just find the last (highest) number and that will give the last ID extant in that countries order of battle, then add 1 (unless they spawn as a Corps/Division setup (IE Fleet of Iran with Battleship 'Die Infidel Die!') where it would be add 2)

HOWEVER

This is all conjecture. The game may add up all unit ids after a scenario start and just assign them to the latest one created.