Q: I am creating a level with a huge terrain that has a lot of polygons. I would like to know how to deactivate the terrain who isn't visible to increase the fps.

A: You can use several terrain entities (hmp files) and LOD or some simple code that uses vec_dist to compute the distance between your terrain entity and the player. Don't forget that a proper clip_range value can increase the frame rate a lot.
 

Q: Can someone please tell me how to make a hbar that goes down when you get hit, but can also regenerate when you hit a button?

A: Here's an example:

bmap health_map = <health.pcx>;

panel hbar_pan
{
     hbar 400, 10, 100, health_map, 1, player._health;
     flags = refresh, visible, overlay;
}

All you need to do is make sure that when you get hit, player's health decreases (you can use player_fight for that). Use something like that for regeneration:

function regenerate()
{
     while (player._health < 80)
     {
           player._health += 0.2 * time;
           wait (1);
     }
}
 

Q: At runtime with no player_move, I press the zero key so I can move the camera around. When I get to certain points all my entities disappear - what's happening?.

A: You are simply getting out of the level so the entities aren't rendered anymore.

 
Q: I would like to know how to make a light move, change its intensity (range) and color during the game.

A: You can attach a dynamic light to any entity; use something light this:

action my_entity
{
    ...............
    // code that moves the entity (patrol_path, etc)
    ...............
    my.lightred = random(255);
    my.lightgreen = random(255);
    my.lightblue = random(255);
    my.lightrange = random(300);
    ...............
}
 

Q: It is possible to have multiple objects for the player? Eg. a body, legs and arms, separate objects but part of the same group so that they are controlled by the player-move script?

A: Take a look at function attach_entity and function attach_flare in office.wdl - you can attach as many body parts as you want using similar functions.

 
Q: I want to know how can I make an entity patrol a path and how do I change its patrolling speed ?

A: You can use action patrol_path in actors.wdl. Change this line in actor_init (patrolling speed = 1):

if (my._FORCE == 0) {my._FORCE = 1;}
 

Q: How is it possible to turn a bmap on a panel in the direction of player.pan? I want to make a compass-rose.

A: Click here to download Alain Bregeon's answer (includes compass bitmaps).
 
 
Q: I have changed some of the template code so that it kills the player if he stays too much under the water but I want him to loose health only when the camera is under the water too. What should I do?

A: Here's the code that fixes your problem:

if(my._movemode == _MODE_SWIMMING)
{
    result = content (camera.x);
    if (result == content_passable)
    {
        player._HEALTH -= random(10) *time;
    }
}
 

Q: I have an animated torch model - how do I create the code for it?

A: Here's the answer (I'm aasuming that your torch has 15 animation frames):

action torch
{
     while (1)
     {
         my.frame = random (15);
         waitt (2);
     }
}
 

Q: Is it possible to obtain different water effects? How?

A: Set new values for turb_speed and turb_range - you can get great looking effects.
 

Q: I would need some code that will make the player loose health when he falls into lava.

A: Use something like that:

function kill_player()
{
    if (event_type == event_impact && you == player)
    {
        player._health -= (10 + random(10))* time;
    }
}

action lava_entity
{
     my.enable_impact = on;
     my.event = kill_player;
}