Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,128 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Disabling action of entity without destroying entity #376767
07/06/11 15:59
07/06/11 15:59
Joined: Aug 2010
Posts: 26
J
JHA Offline OP
Newbie
JHA  Offline OP
Newbie
J

Joined: Aug 2010
Posts: 26
Hello
Does anyone no if it is possible to put an action to "disabled" mode for awhile without destroying the actual entity, the action is associated. So for example if I

Ball=ent_create("ball.mdl",TempBallPos,DestroyBallIfOutsite);

is it possible to put action:"DestroyBallIfOutsite" "off" for awhile and then put it on again, without removing the entity "Ball"?

regards
Jarkko

Re: Disabling action of entity without destroying entity [Re: JHA] #376768
07/06/11 16:07
07/06/11 16:07
Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
pararealist Offline
Senior Member
pararealist  Offline
Senior Member

Joined: Dec 2006
Posts: 434
UK,Terra, SolarSystem, Milky W...
have a flag (e.g actionOff) in the action that
if (actionOff == true) wait(1)
will skip the action.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.
Re: Disabling action of entity without destroying entity [Re: JHA] #376769
07/06/11 16:07
07/06/11 16:07
Joined: Dec 2002
Posts: 616
Austria
Stromausfall Offline
User
Stromausfall  Offline
User

Joined: Dec 2002
Posts: 616
Austria
there are several methods, for example :
Code:
void EntityFun()
{
  // wait until skill1 of the entity isn't zero anymore !
  while(my.skill1 == 0)
  {
    wait(1);
  }

  // destroy entity here..
  ...
}



and when you want to 'activate' the function again, simply change the skill1 one of the entity to a value not equal zero !

but you could of course work with events, the way you should choose to accomplish this, pretty much depends on the circumstance, when the function should be 'activated' and when 'deactivated' (for example when it hits a wall or something like that !)


get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread
Re: Disabling action of entity without destroying entity [Re: JHA] #376770
07/06/11 16:08
07/06/11 16:08
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
well you could put a big if inside the balls function and then have all your code within that, then to disable the code, just make the IF false, example

Code:
action DestroyBallIfOutsite()
{
 while(1)
 {

  if (BALL_ISACTIVE ==ON)
  {
   my.pan += 5 *time_step;
   // ... all code goes here ...
  }

 wait(1);
 }
}




then you can just toggle the behaviour on and off by switching BALL_ISACTIVE to 1 or 0 ...

oh, just saw pararealist's reply, basically the same idea

Re: Disabling action of entity without destroying entity [Re: darkinferno] #376782
07/06/11 18:15
07/06/11 18:15
Joined: Aug 2010
Posts: 26
J
JHA Offline OP
Newbie
JHA  Offline OP
Newbie
J

Joined: Aug 2010
Posts: 26
Thanks guys. Stromausfall's solution works best in my case because I have several balls and they can have independently actions on or off.
But thanks for everyone.


Moderated by  HeelX, Spirit 

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