Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Problem With sending actor.goto commands form array.  (Read 1957 times)

0 Members and 1 Guest are viewing this topic.

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 351
    • View Profile
    • Jyujinkai's WME Development Blog
Problem With sending actor.goto commands form array.
« 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.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 351
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Problem With sending actor.goto commands form array.
« Reply #1 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.??
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 351
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Problem With sending actor.goto commands form array.
« Reply #2 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)
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe
 

Page created in 0.039 seconds with 24 queries.