Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,238 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Invalid Call in event .... #385109
10/13/11 04:26
10/13/11 04:26
Joined: Oct 2011
Posts: 21
O
oODarkPassionOo Offline OP
Newbie
oODarkPassionOo  Offline OP
Newbie
O

Joined: Oct 2011
Posts: 21
Hello,

i'm working on my RTS project.
Ok the situation is this. Ähm if i shoot an enemy to death, the enemy died and 1 copy of that enemy should spawn at the same place and walk away.
It is simple laugh


So if i shoot the emeny the function "got_shot" will started then the new spider (copy) will spawn and the spawned spider should walk away (function enemy_move).

And there is the problem, when the function calls ent_create(...., enemy_move) i get the "Invalid Call in event enemy_move" - Error.

I searched here for the problem an tested the wait-cmd but nothing helps frown


Ok thats the part of the code:

Code:
function got_shoota()
{
	var i;
	
	if(you.skill30 != 1) {return;}
	my.skill99 = 1;
	ent_morph(my,spiderd_mdl);
}

function enemy_move()
{
		 var anim_percentage;
       VECTOR temp;
       my.skill99 = 0;
       
       my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY);
       my.event = got_shot;
       
       while(my.skill99 == 0)
       {
           //while(1)
		 	  //{
		 	c_move (me, vector(2 * time_step, 0, 0), nullvector, GLIDE);
  			ent_animate(me, "walk", walk_percentage, ANM_CYCLE); // "walk" Animations-Loop
   		walk_percentage += 3 * time_step; // 3 = Animationsgeschwindigkeit für "walk"
   		wait (1);
   	 }
   	 
   	 set(my,PASSABLE);
   	
}

function got_shot()
{
	if(you.skill30 != 1) {return;}
	my.skill99 = 1;
	ent_morph(my,spiderd_mdl);
	ent_create(spider_mdl,you.x,enemy_move);
	
}



Sry for my bad english i hope you understand me laugh

Thank you for your help

oODarkPassionOo

Re: Invalid Call in event .... [Re: oODarkPassionOo] #385137
10/13/11 12:27
10/13/11 12:27
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The invalid call is "ent_create" in your event "got_shot", no function that can cause another event (such as c_trace, c_move, ...) is allowed to be called inside an event to avoid infinite loops.
Simply place the ent_create call in your enemy_move function after the while loop.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Invalid Call in event .... [Re: Superku] #385141
10/13/11 13:14
10/13/11 13:14
Joined: Oct 2011
Posts: 21
O
oODarkPassionOo Offline OP
Newbie
oODarkPassionOo  Offline OP
Newbie
O

Joined: Oct 2011
Posts: 21
Hi,

thank you very much, now it works fine laugh

best regards


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