cash 15 Posted March 3, 2016 I placed two soldier in editor . 1-st named sol , 2-nd named sol1, placed a trigger : activation Radio "alfa" , in the init field of a trigger has write following code : while {alive sol1} do { sol doMove (position sol1);} ,command doMove is running once but not loop .May be it's my mistake , if somebody know what how to fix the problem , i'll be grateful for any help. Share this post Link to post Share on other sites
haleks 8206 Posted March 3, 2016 You might need to spawn your code. Try this : 0 = [] spawn { while {alive sol1} do { sol doMove (position sol1); sleep 1; }; }; EDIT : ...wait, what do you mean "init field of a trigger", did you mean the on Act field? Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 3, 2016 while is limited to 10000 loops in unscheduled environment, which trigger on Act is, so do what haleks said Share this post Link to post Share on other sites
MarkCode82 21 Posted March 3, 2016 As an additional "spawning" the code converts it from the unscheduled environment to the scheduled and will not halt at 10,000 iterations. It will be "infinite" for as long as the condition remains true. Share this post Link to post Share on other sites
cash 15 Posted March 4, 2016 You might need to spawn your code. Try this : 0 = [] spawn { while {alive sol1} do { sol doMove (position sol1); sleep 1; }; }; EDIT : ...wait, what do you mean "init field of a trigger", did you mean the on Act field? Thank you very much , it is working now . But anyway i am not understand why this code is not working without "spawn". i am use this code same as bohemia wiki example and there no any "spawn" argument. They should did more advanced example of usage their commands . Share this post Link to post Share on other sites
sarogahtyp 1105 Posted March 4, 2016 i think u should learn something about scheduled and non-scheduled environment cause thats the key of ur mistake.there is no need to discuss that for every given example at the wiki.also killzone kid explains the problem on the notes of the wiki page useful links: killzone kids scripting tutorial BI wiki - code optimization 1 Share this post Link to post Share on other sites
Tajin 348 Posted March 4, 2016 They should did more advanced example of usage their commands . There are several ways how and where those commands can be used, so it really depends. The biki just shows the command in its most basic form. Simply put, you can't use endless loops directly in init because all init-code needs to finish before the mission starts. 1 Share this post Link to post Share on other sites