Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Akow), 1,403 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
why does this action crash? #320243
04/20/10 16:09
04/20/10 16:09
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
hi!

It crashes when i use this action on one of my models:
-----------------------------------
action friend_move()
{
my = me;
my.HEALTH = 100;


while(my.HEALTH > 0)
{

if(vec_dist(my.x, player.x) < 900 && player.HEALTH > 0)
{
}

wait(1);
}
}
------------------------------------------

I can't find the problem

why don't it work?


thanks!


- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: why does this action crash? [Re: Muhsin] #320251
04/20/10 16:33
04/20/10 16:33
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Firstly, "my = me;" is a a pointless piece of code, they are always the set the same in the guts of the engine.

So, on to your problem.
You havent checked anywhere to see IF 'player' has a valid value(entity).
Try this instead.
Code:
action friend_move()
{
   my.HEALTH = 100;
   while(my.HEALTH > 0)
   {
      if(player)    //means the same as "if(player != NULL)"
      {
         if(vec_dist(my.x, player.x) < 900 && player.HEALTH > 0)
         {
            //do something 
         }
      }
      wait(1);
   }
}


//Advanced programming version
action friend_move()
{
   my.HEALTH = 100;
   while(my.HEALTH > 0)
   {
      if(player)   if(vec_dist(my.x, player.x) < 900 && player.HEALTH > 0)
      {
         //do something 
      }
      wait(1);
   }
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: why does this action crash? [Re: EvilSOB] #320257
04/20/10 16:44
04/20/10 16:44
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
thank you! i added "If(player)" and now it works!


thank you very much!!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: why does this action crash? [Re: Muhsin] #320264
04/20/10 17:26
04/20/10 17:26
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
no probs dude.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1