EVENT_IMPACT and EVENT_DETECT problem

Posted By: jpxtreme

EVENT_IMPACT and EVENT_DETECT problem - 02/23/11 20:08

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);
}

}
Posted By: jpxtreme

Re: EVENT_IMPACT and EVENT_DETECT problem - 02/24/11 06:16

please help me.
Posted By: Schubido

Re: EVENT_IMPACT and EVENT_DETECT problem - 02/24/11 07:40

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;
...


© 2024 lite-C Forums