Question on ENABLE_IMPACT

Posted By: MarcsVision

Question on ENABLE_IMPACT - 10/26/09 17:15

i would like to have my users transfer to a new level when it hits object "blip". i have the script as:

action blip ()
{
my.ENABLE_CLICK = ON;//when users hits blip
my.event = load_race;//user goes to race level
}

function load_race ()
{
wait (1);
level_load ("dragrace1.wmb");
}

but for some reason i get a syntax error in MAIN in the line my.ENABLE_IMPACT = ON;
those any one see a problem that im missing?
-----------------------------------------------------
Also, i was told to place "me = null" in the top of my level function. what those me = null do?

Thank you!
Posted By: Enduriel

Re: Question on ENABLE_IMPACT - 10/26/09 18:17

Taken from the manual, this is how you define EVENTS:

Code:
// The following example shows how to use events for an object that flies ahead until it collides with a block or entity.
// The event function then plays a collision sound and lets the object ricochet from the surface. 


function bounce_event() 
{
  switch (event_type)
  {
    case EVENT_BLOCK:
      ent_playsound(my,whamm,50);   
      vec_to_angle(my.pan,bounce); // change direction
      return;
    case EVENT_ENTITY: 
      ent_playsound(my,boingg,50);  // play a different sound
      vec_to_angle(my.pan,bounce); // change direction
      return;
  }
}  

action bounceball() 
{
  my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make entity sensitive for block and entity collision
  my.event = bounce_event;
  while(1)
  {
    c_move(me,vector(5*time_step,0,0),nullvector,0); // move ahead until obstacle is hit
    wait(1);
  }
}



so change your my.ENABLE_CLICK = ON to my.emask |= ENABLE_CLICK
Posted By: MarcsVision

Re: Question on ENABLE_IMPACT - 10/26/09 19:23

That work perfect. thanks alot
Posted By: MarcsVision

Re: Question on ENABLE_IMPACT - 10/26/09 20:10

What does "me = null;" script do for the function?
Posted By: Ottawa

Re: Question on ENABLE_IMPACT - 10/26/09 23:03

Hi!

Here's a quote from the manual to that effect wink

Quote:

Functions assigned to or called by entities - that means all functions in which the my pointer is not zero - are automatically terminated at their next wait call. All other functions in which my is zero, such as the main() function, will keep running and won't change, even if a different script was assigned in WED to the new level.



© 2024 lite-C Forums