Most asked questions

Top  Previous  Next

Q: I am using your security camera from Aum22. How can I scan for entities every second instead of using a random value?

A: Replace action security_camera with the one below:

 

action security_camera

{

my.ambient = -100;

my.skill1 = my.pan;

init_alarm();

while (1)

{

    while (my.pan < my.skill1 + rotating_angle)

    {

       my.pan += 1 * time; // rotating speed

       my.skill2 += 3 * time;

       if (my.skill2 > 50)

       {

           start_scanning();

           my.skill2 = 0;

       }

       wait (1);

    }

    while (my.pan > my.skill1 - rotating_angle)

    {

       my.pan -= 1 * time; // rotating speed

       my.skill2 += 3 * time;

       if (my.skill2 > 50)

       {

           start_scanning();

           my.skill2 = 0;

       }

    wait (1);

    }  

    wait (1);

  }

}

Q: I'm using your security camera (Aum22). What can I do so that whenever the camera scans for entities, a small red light on the camera will be turned on and off?

A: Add another skin to the camera model, painting a red light where you need it, and add a new function like this at the beginning of the script file:

 

function blinker()

{

my.skin = 2;

sleep (0.5);

my.skin = 1;

}

 

Call this function right after each function start_scanning() call:

 

action security_camera

{

.............................

start_scanning();

blinker();

.............................

start_scanning();

blinker();

.............................

}

 

 

Q: Can you tell me how can I use health packs for the player from Sword Combat (Aum12)?

A: Use the code below:

 

action sword_combat_medic

{

  my.passable = on;

  while (player == null) {wait (1);}

  while (vec_dist(my.x, player.x) > 70)

  {

      my.pan += 2 * time;

      wait (1);

  }

  ent_remove(my);

  player.healthpoints = min(200, player.healthpoints + 100); // limit healthpoints to 200

}

 

 

Q: How could I create an abyss which would kill the player if it falls into it?

A: Create an invisible wmb entity that has the shape of the abyss (make it a little smaller) and use the code below:

 

function kill_player();

 

define health skill30; // use your own skill here

sound scream_wav = <scream.wav>;

 

function kill_player()

{

  snd_play(scream_wav, 100, 0);

  while (player.z > -1000) // the player will fall until it goes 1000 quants   below the origin in my example

  {

      player.z -= 50 * time;

      wait (1);

  }

  player.health = 0; // the player is dead

}

 

starter player_abyss()

{

  while (player == null) {wait (1);}

  while (1)

  {

     vec_set (temp.x, player.x);

     temp.z -= 10000;

     trace_mode = ignore_me + ignore_passable + ignore_models + ignore_sprites +   scan_texture;

     trace (player.x, temp);

     if (str_cmpi ("brickdark", tex_name)) // use this texture for your   wmb abyss

     {

         kill_player();

         return; // get out of here

      }

     wait (1);

  }

}

 

action abyss // attach this simple action to your abyss wmb entity to make   it invisible

{

  my.invisible = on;

}

 

 

Q: I was wondering if you can attach a sprite to a model and turn it on and off, depending on how close the model is to the camera.

A: Use the code below:

 

function set_sprite();

string sprite_pcx = <sprite.pcx>;

action my_model

{

  ent_create (sprite_pcx, my.x, set_sprite);

  // put the rest of the code for your model here

}

function set_sprite()

{

  while (1)

  {

     my.x = you.x;

     my.y = you.y;

     my.z = you.z + 50; // place the sprite 50 quants above the origin of the model

     if (vec_dist (camera.x, my.x) < 100)

     {

        my.invisible = off; // show the sprite

     }

     else

     {

        my.invisible = on; // hide the sprite

     }

     wait (1);

  }

}

 

 

Q: I'd like to have a pulsing crosshair: white cross - red cross - white cross.... Can you help?

A: Use this snippet:

 

bmap whitecross_pcx = <whitecross.pcx>;

bmap redcross_pcx = <redcross.pcx>;

starter pulsing_crosshair()

{

  while (1)

  {

      mouse_map = whitecross_pcx;

      sleep (1); // play with this value

      mouse_map = redcross_pcx;

      sleep (1); // play with this value

  }

}

 

 

Q: How can I create a shootable target that spins when you shoot it?

A: Use the example below:

 

function rotate_me();

 

action shootable_target

{

  my.oriented = on;

  my.enable_impact = on;

  my.enable_entity = on;

  my.enable_shoot = on;

  my.event = rotate_me;

}

 

function rotate_me()

{

  var rot_speed = 40;

  while (rot_speed > 0.5)

  {

     my.tilt += 2 * rot_speed * time;

     rot_speed -= 3 * time;

     wait (1);

  }

}

 

aum44_faq1

 

Q: How can I create a swarm of particles (bees, whatever) that keep rotating around the player?

A: Use this example:

 

bmap bees_map = <bees.tga>;

 

function remove_bees()

{

  my.x = player.x + 100 * cos(my.lifespan);

  my.y = player.y + 100 * sin(my.lifespan);

  my.lifespan -= 5 * time;

}

 

function swarm_init()

{

  my.lifespan = 500;

  my.alpha = 50 + random(50);

  my.bmap = bees_map;

  my.flare = on;

  my.move = on;

  my.size = 10;

  my.z = player.z + (100 - random(200));

  my.function = remove_bees;

}

 

starter swarm()

{

  while (player == null) {wait (1);}

  while (1)

  {

     effect(swarm_init, 10 * time, player.x, normal);

     wait (1);

  }

}