PDA

View Full Version : How to label and know wich units are on the battlefield



Patrizius
06-12-2008, 19:41
ok,lets consider this.I want to have full control of the army via script during the battle in the campaign. i can do that with a script,but i have to know how much units you hahve in the battlefield as the game crashes if you label a unit that doesn't exist...Is there a way to label units and know how much they are?

HouseOfHam
06-12-2008, 22:43
You have a talent for asking questions that have no solution. :)

Kinda makes a whole bunch of commands useless (unless you want to write a script for a custom battle where you know exactly how many units you have), doesn't it?

Bardo
06-12-2008, 23:27
Someway, I agree HouseOfHam, it is hard to use battle scripts in campaign, but it is sometimes possible.
If I remember right, it is possible to label units, even when they do not exist in battle, and the game doesn't crash. And it is also possible to check some conditions from these units without ctds. It is when you try to execute a command over the unit when it ctd. I'm not sure, but I think it worked this way latest time I tried it.
This way it is possible to use some commands without risk of ctds, if you previously check a condition like I_UnitFormation.
This is an example of battle script that was working for me, to half the size of general units. Regretably itcrashed when the general was an elephant unit so I never used it:


script

label_unit 0 0 0 general_00
label_unit 0 1 0 general_01
label_unit 1 0 0 general_11
label_unit 1 1 0 general_12

if I_UnitFormation general_00 = horde
reduce_unit_strength general_00 51
end_if

if I_UnitFormation general_01 = horde
reduce_unit_strength general_01 51
end_if

if I_UnitFormation general_11 = horde
reduce_unit_strength general_11 51
end_if

if I_UnitFormation general_12 = horde
reduce_unit_strength general_12 51
end_if

end_script

Maybe you can find some similar working scripts to avoid general suicidals, or to change the melee_state of the generals in the middle of the battle. I have never tried with units other than generals, though.
This is something I would like to test in the future, but I don't expect much of these kind of scripts.

Patrizius
06-13-2008, 10:05
no it doesn't work this way.i have maded some xtra tests and....
You can label without CDT only the first 1-2 non existing units in numerical order.
So this example works all the times :) .But i will test the I_UnitFormation...
Maybe it's the solution ;)

Patrizius
06-13-2008, 12:10
You have a talent for asking questions that have no solution. :)



For me there are only problems how have no solution yet :2thumbsup:

Patrizius
06-13-2008, 12:13
This is an example of battle script that was working for me, to half the size of general units. Regretably itcrashed when the general was an elephant unit so I never used it:


do you thought about to test if your general was an elephant unit ;)?

Edited:
I realised it was impossible,even by using an event as the only event how support something like infer_unit is the "unit attacking unit" one. :(