Most asked questions

Top  Previous  Next

Q: How do you merge models in MED?

A: Open the first model and then choose File -> Merge and load the second model. You will have to skin the resulting model again.

 

aum28_shot8

 

 

Q: How can I avoid being detected by the enemies if the player has morphed to another model?

A: Set enable_scan to off for the player and the enemies will not be able to detect it anymore (if they use scan_entity, like they should).

 

Q: I use hit_smoke and hit_sparks for one of my weapons to make it look like a cloud of dust if you shoot the ground; my problem is it also does it if I shoot a human model...is there an easy way to stop this?

A: Open weapons.wdl, look for function _hit_point_effect and add the new (red) lines of code to it:

 

function _hit_point_effect()

{

    // flash at hit point?

    if((fire_mode & MODE_HIT) == HIT_FLASH)

    {

         weaponTmpSyn = YOU;  // save YOU value

         create(small_flash,TARGET,_blowup);

         YOU = weaponTmpSyn;

    }

 

    // smoke at hit point?

    if(fire_mode & HIT_SMOKE)

    {

            if (you == null)

           {

               emit(20,TARGET,particle_smoke); // emit smoke

           }

    }

 

    if(fire_mode & HIT_SPARKS)

    {

           if (you == null)

           {

                 emit(20,TARGET,particle_scatter); // emit sparks

           }

    }

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

}

 

Q: I just upgraded from demo to Extra... all the actors now have a white square at their feet where they touch the ground. Any ideas?

A: That's the old shadow system running weird with some video cards / drivers. Open animate.wdl, look for action drop_shadow and change it as shown:

 

ACTION drop_shadow

{

   return;

   IFDEF CAPS_FLARE;

        if(VIDEO_DEPTH >= 16)

        {

             create(SHADOWSPRITE,MY.POS,move_shadow);

        }

        else

        {

             create(SHADOWFLAT,MY.POS,move_shadow);

        }

   IFELSE;

            create(SHADOWFLAT,MY.POS,move_shadow);

   ENDIF;

}

 

Q: How many events can an action have?

A: An action can have a single function event but it can react to as many events as you want. Here's an example:

 

function how_tor_react( );

 

action i_am_sensitive

{

   my.enable_block = on;

   my.enable_click = on;

   my.enable_touch = on;

   my.enable_scan = on;

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

   my.event = how_to_react;

}

 

function how_to_react( )

{

   if (event_type == event_block)

   {

       // event_block was triggered

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

   }

   if (event_type == event_click)

   {

       // event_click was triggered

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

   }

   if (event_type == event_touch)

   {

       // event_touch was triggered

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

   }

   if (event_type == event_scan)

   {

       // event_scan was triggered

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

   }

}

 

Q: I have created a 2D / 3D side scroller game and I want the camera to track a point X distance in front of the player.

A: Use this piece of code as a starting point:

 

var horizontal_offset = 100;

var vertical_offset = 50;

var camera_distance = 400;

 

view side_view // used as an alternative to the camera view

{

    layer = 15;

    pos_x = 0;

    pos_y = 0;

    size_x = 640;

    size_y = 480;

    flags = visible;

}

 

starter init_view()

{

    camera.visible = off;

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

    while (1)

    {

         side_view.x = player.x + horizontal_offset;

         side_view.y = player.y - camera_distance;

         side_view.z = player.z + vertical_offset;

         side_view.pan = player.pan + 90; // 0, 90, 180 or 270

         wait (1);

    }

}

 

Q: How do I use handle and ptr_for_handle?

A: Any entity, action, string, bmap, panel or pointer gets a unique ID number when it is loaded or created. Handle is used to store that unique number in a var or a skill and ptr_for_handle retrieves the entity,action, string... back using that var or skill. Read the Perfect AI article inside this magazine to see an example.

 

Q: When I start the level, my warlocks turns around and walk back against the wall. How can I make them just stand? I use the premade action actor_walk_fight.

A: You have set a small value for _HEALTH. Increase skill9 and everything will go back to normal.

 

Q: How do I get a health bar to be displayed above an enemy's head?

A: Add a line of code at the beginning of the action attached to your enemies

 

ACTION actor_ai_one

{

    ent_create (healthbar_mdl, my.pos, display_health);

    // set up and call helper functions

    // Health-

    if (MY._HEALTH <= 0) { MY._HEALTH = 75; } // default 75 health

 

    // Armor-

    if (MY._ARMOR <= 0) { MY._ARMOR = 0; } // default 0 armor

 

     // Force-

    if (MY._FORCE == 0) { MY._FORCE = 1.5; }  // default force

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

}

 

and then copy and paste this piece of code at the beginning of your war.wdl file:

 

string healthbar_mdl = <healthbar.mdl>;

 

function display_health( )

{

    my.passable = on;

    while (you != null)

    {

         my.x = you.x;

         my.y = you.y;

         my.z = you.z + 50;

         my.scale_y = you._health / 10;

         vec_set(temp, camera.x);

         vec_sub(temp, my.x);

         vec_to_angle (my.pan, temp);

         my.tilt = 0;

         wait (1);

    }

    my.invisible = on;

}

 

aum28_shot9