Most asked questions

Top  Previous  Next

Q: I need some code for a vertical mirror - can you help?

A: First of all make sure that your mirror entity won't be rotated in the level (give it the correct angles when you create it) . Here's some code for a vertical mirror that is placed on the south, with its reflective surface towards north:

function init_vmirror(); // put init_vmirror(); in main

view vmirror {};

function init_vmirror()
     camera.portal = vmirror;
     vmirror.noshadow = on; // suppress shadows in the mirror
     vmirror.noparticle = on; // suppress particles in the mirror
     vmirror.portalclip = on; // clip at portal plane
     while (1)
           proc_late(); // place it at the end of the function list
           vmirror.genius = camera.genius;
           vmirror.aspect = camera.aspect;
           vmirror.arc = -camera.arc;
           vmirror.fog = camera.fog;
           vmirror.x = camera.x;
           vmirror.y = 2 * camera.portal_y - camera.y;
           vmirror.z = camera.z;
           vmirror.pan = -camera.pan;
           vmirror.tilt = camera.tilt;
           vmirror.roll = camera.roll;


Q: You make the second level in a game and use the same script as before. When you click run, does it always have to go at the beginning of the game?

A: Every time you click run the first level_load instruction is executed and this takes you to the first level. If you have created another level, you must load it using another level_load instruction at the end of the first level. Use any entity and attach it an action like this:

function second_level();

action moveto_level2

   my.enable_impact = on;
   my.event = second_level;

function second_level()
   wait (1);
   if (you != player) {return;}
   level_load (your_second_level);


Q: In my game the camera passes through some of the walls from time to time and I want these walls to disappear when this happens. What should I do?

A: Create your walls as wmb entities (one entity for every wall; split big walls in several smaller walls) and attach it an action like this:

action smart_walls
   while (1)
       if (vec_dist (my.x, camera.x) < 100) // play with this value
           my.invisible = on;
           my.invisible = off;
       wait (1);


Q: I have windows Xp and I tried to run the office level. I did not modify it. I just opened and tried to run it. This is what I got: Engine malfunction w/30/ <OFFICE.WMB>can't open file

A: Before running it, you must build the office.level; open the office level and choose File -> Build WMB -> OK.


Q: I started learning WDL and I made a pong-like game with the help of Rémi's tutorial. I want to make a block that sinks 10 units in the ground or disappears when it is hit by the ball.

A: Here's some code:

function do_crazystuff();

action special_brick

   my.enable_impact = on;
   my.event = do_crazystuff;

function do_crazystuff()
   wait (1);
   if (my.flag1 == 1) {ent_remove (my);} // bricks that have flag1 set will disappear, the other ones will sink into the ground every time they are hit
   else {my.z -= 10;}


Q: I cannot get that 'camera follows path' code snippet from AUM6 to work. Any step by step guide would be much appreciated.

A: Here are the steps:

1) Type "include <cutcam.wdl>;" below the other include lines in office.wdl

2) Open office.wdl, right click on the map and add any model to your level.

3) Right click and choose Properties

4) Click behavior and then the folder icon to see the list of the actions

5) Select cutcamera_init and press Ok.

6) Create a path named "campath"

7) Save, build and run.


Q: Is there a way to make the m16 bullets travel farther?

A: Set m16's skill5 to 2000.01 or bigger.


Q: I know that you have to press "k" for the crosshair but in which script is it defined so I can change it?

A: Loot at function pan_cross_toggle() in weapons.wdl.


Q: When I pick up a weapon it isn't placed ok. How do I change its position in first person perspective?

A: Try different skill1...skill3 values for that weapon in Wed until your gun is positioned ok.


Q: Is it possible to have make a multiplayer game where different players are in different levels (maps)?

A: Yes, it is possible - this is what mutisession does.