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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
EVENT_IMPACT and EVENT_DETECT problem #360383
02/23/11 20:08
02/23/11 20:08
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
Please take a look at this code.

My problem is that I can't combine EVENT_IMPACT and EVENT_DETECT at the same time. When I test it EVENT_IMPACT won't work if EVENT_DETECT is activated.

EVENT_IMPACT is working if I remove EVENT_DETECT.

How can I make the two work together.

function viol_func()
{
my.event = NULL;
if (event_type == EVENT_IMPACT)
{
set(viol_damageproperty,VISIBLE);
viol_cntr += 1;
wait(-3);
reset(viol_damageproperty,VISIBLE);

viol_trigger = 0;

count_damageprop += 1;

if(tutorial_mode == 1)
{
tutorial_failure_event();
}

}


my.event = viol_func;
}

function carinit_event()
{
my.event = NULL;
if(event_type == EVENT_DETECT)
{
you.skill12 = 0;
wait(-5);
you.skill12 = aispeed;
}

my.event = carinit_event;
}

action FollowPath_3()
{
var temp2 = 0;
my.emask |= ENABLE_IMPACT | ENABLE_DETECT;
my.event = viol_func;
my.event = carinit_event;
my.skill11 = 0;
my.skill12 = aispeed;
while(1);
{

blah blah blah

c_move(me,vector(my.skill12*time_smooth,0,0),nullvector,GLIDE | IGNORE_PASSABLE | IGNORE_FLAG2 | ACTIVATE_TRIGGER);

c_scan(my.x,my.pan,vector(200,200,500),SCAN_ENTS);

blah blah blah

wait(1);
}

}

Last edited by jpxtreme; 02/24/11 06:17.
Re: EVENT_IMPACT and EVENT_DETECT problem [Re: jpxtreme] #360461
02/24/11 06:16
02/24/11 06:16
Joined: Aug 2008
Posts: 81
J
jpxtreme Offline OP
Junior Member
jpxtreme  Offline OP
Junior Member
J

Joined: Aug 2008
Posts: 81
please help me.

Re: EVENT_IMPACT and EVENT_DETECT problem [Re: jpxtreme] #360465
02/24/11 07:40
02/24/11 07:40
Joined: Nov 2010
Posts: 96
Vienna
S
Schubido Offline
Junior Member
Schubido  Offline
Junior Member
S

Joined: Nov 2010
Posts: 96
Vienna
You can assign only one event function to an entity and need to handle all events this function:

Code:
function EventHandler()
{
 switch (event_type)
  {
    case EVENT_IMPACT: // handle event impact 
      set(viol_damageproperty,VISIBLE);
      ...       return;
    case EVENT_DETECT: // handle event detect 
      you.skill12 = 0;
      ...       
      return;
  }

}

...
my.event = EventHandler;
...




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