Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 1431

WML Workshop • Re: Sacrifice survival

$
0
0
Yup, that was a reason why units werent spawned after unstoring them. Now it works.
Below working code:

Code:

[spoiler]#define SEND_SACRIFIED_UNIT X Y{IF_VAR ai_target equals "Take that fort!" (    [then]    {VARIABLE sacrificed.goto_x {X}}    {VARIABLE sacrificed.goto_y {Y}}    [/then])}{VARIABLE ox {X}}{VARIABLE_OP ox add 29.5} # 14*2+3/2{VARIABLE_OP ox divide 3}{VARIABLE oy {Y}}{VARIABLE_OP oy add 29.5} # 14*2+3/2{VARIABLE_OP oy divide 3}{VARIABLE temp_find_variable_x 0}[while][variable]name=temp_check_variableequals=$null[/variable][do][if][variable]name=temp_find_variable_xless_than=$ox[/variable][then]{VARIABLE_OP temp_find_variable_x add 1}[/then][else]{VARIABLE_OP temp_check_variable add 1}{VARIABLE_OP temp_find_variable_x sub 1}[/else][/if][/do][/while]{CLEAR_VARIABLE temp_check_variable}{VARIABLE temp_find_variable_y 0}[while][variable]name=temp_check_variableequals=$null[/variable][do][if][variable]name=temp_find_variable_yless_than=$oy[/variable][then]{VARIABLE_OP temp_find_variable_y add 1}[/then][else]{VARIABLE_OP temp_check_variable add 1}{VARIABLE_OP temp_find_variable_y sub 1}[/else][/if][/do][/while]{CLEAR_VARIABLE temp_check_variable}    [message]message="Variable X: $oxRounded variable X: $temp_find_variable_xVariable Y: $oyRounded variable Y: $temp_find_variable_y"    [/message][unstore_unit]    variable=sacrificed    find_vacant=yes#    x,y=$ox,$oy    x,y=$temp_find_variable_x,$temp_find_variable_y    {COLOR_HARM}    text="Reborn!"[/unstore_unit]#enddef[/spoiler]

Statistics: Posted by ChaosRider — Today, 3:23 pm



Viewing all articles
Browse latest Browse all 1431

Trending Articles