Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Jyujinkai on December 30, 2008, 05:59:01 PM

Title: Problem With sending actor.goto commands form array.
Post by: Jyujinkai on December 30, 2008, 05:59:01 PM
Hi there...

I have a number of actors stored in an array.

I am using this code to loop through the array and (just for a test) do somthing, in this case walk to a point on screen.

Code: WME Script
  1. for (var a=enemy_count; a>=0; a = a-1)
  2.                         {
  3.                         var temp = EnemysToFight[a];
  4.                         temp.GoTo(562, 525);
  5.                         Game.Msg(a);
  6.                         }

enemy count is the number of items in the array.
EnemysToFight = The name of the array.

Anyway the thign is it works... the actors all move one by one to the point i said to but ... I still get an error even though everything looks like it works?

Runtime error. Script 'scripts\EnemyAttackLoop.script', line 11
Call to undefined method 'GoTo'. Ignored.
Title: Re: Problem With sending actor.goto commands form array.
Post by: Jyujinkai on December 30, 2008, 06:03:30 PM
I think i have to use the != null somhow.. but not sure... sao basicly if a=null then loop again.??
Title: Re: Problem With sending actor.goto commands form array.
Post by: Jyujinkai on December 30, 2008, 06:51:25 PM
I got it fixed.. thanks JERROT

changed

Code: WME Script
  1. for (var a=enemy_count; a>=0; a = a-1)

Code: WME Script
  1. var i=enemy_count;
  2.                 i=i-1;
  3.                         for (var a=i; a>=0; a = a-1)