Probably fixes a bug with the spawns not getting their normal movement back.

This commit is contained in:
Lari Nieminen 2009-07-26 14:53:45 +00:00
parent 28ec5cc16e
commit c564317690

View File

@ -58,42 +58,46 @@ Note: You need to use map settings for the scenario to work right."
[/filter]
[/store_unit]
{FOREACH spawns id}
{VARIABLE movement $spawns[$id].max_moves}
{VARIABLE_OP movement multiply 0.33}
{VARIABLE_OP movement add 1}
{VARIABLE unit_name $spawns[$id].name}
[unit]
side=$timid_ai_side
type=$spawns[$id].type
x=$spawns[$id].x
y=$spawns[$id].y
generate_name=yes
random_traits=no
[modifications]
[object]
[effect]
apply_to=movement
set=$movement
[/effect]
[effect]
apply_to=movement_costs
replace=true
[movement_costs]
flat=1
sand=2
forest=2
impassable=3
unwalkable=3
deep_water=3
[/movement_costs]
[/effect]
[/object]
[/modifications]
[status]
poisoned="no"
slowed="on"
[/status]
[/unit]
{VARIABLE less_max_moves $spawns[$id].max_moves}
{VARIABLE_OP less_max_moves multiply 0.33}
{VARIABLE_OP less_max_moves add 1}
# store the original max_moves so they can be restored later
{VARIABLE spawns[$id].variables.original_max_moves $spawns[$id].max_moves}
# give the unit only a third of its normal max movement for now
{VARIABLE spawns[$id].max_moves $less_max_moves}
{VARIABLE spawns[$id].side $timid_ai_side}
{VARIABLE spawns[$id].generate_name yes}
{VARIABLE spawns[$id].slowed yes}
{CLEAR_VARIABLE spawns[$id].name}
[unstore_unit]
variable=spawns[$id]
[/unstore_unit]
[object]
silent=yes
duration=forever
[filter]
x,y=$spawns[$id].x,$spawns[$id].y
[/filter]
[effect]
apply_to=movement_costs
replace=true
[movement_costs]
flat=1
sand=2
forest=2
impassable=3
unwalkable=3
deep_water=3
[/movement_costs]
[/effect]
[/object]
{NEXT id}
{CLEAR_VARIABLE spawns}
[store_unit]
@ -153,7 +157,7 @@ Note: You need to use map settings for the scenario to work right."
#enddef
# copies the units over from SIDE1 to SIDE2
# and removes all objects
# and removes all temporary limitations of movement_type and max_moves
#define ADJUST_AGGRESSION SIDE1 SIDE2
[if]
[have_unit]
@ -169,6 +173,8 @@ Note: You need to use map settings for the scenario to work right."
[/store_unit]
{FOREACH ai_unit id}
{VARIABLE ai_unit[$id].side {SIDE2}}
{CLEAR_VARIABLE ai_unit[$id].movement_costs}
{VARIABLE ai_unit[$id].max_moves $ai_unit[$id].variables.original_max_moves}
[unstore_unit]
variable=ai_unit[$id]