Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,302 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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