Q: How can I move just a single row of vertices in a certain direction in Med?
A: Select the row as shown in the first picture, and then move it upwards or downwards like in the second picture.

Q: I'd just like to know how I can find out how many guys are touching an entity.
A: Use something like this:

var number_of_guys = 0;

panel guycounter_pan
{
pos_x = 0;
pos_y = 0;
digits = 0, 0, 3, _a4font, 1, number_of_guys;
flags = overlay, refresh, visible;
}

function count_guys()
{
if (you.skill25 == 0)
{
number_of_guys += 1;
you.skill25 = 1;
}
}

action touched_object
{
my.enable_impact = on;
my.event = count_guys;
}

Q: Is it possible to code your full screen flare effect from Aum34's faq in such a way that it will work ok if the pan angle for the sun isn't zero?
A: Here's the code for the improved version. Place any model in your level and attach it the "my_own_sun" action.

var angles_to_sun[3];

bmap flarepan_tga = <flarepan.tga>;

entity* aum_sun;

panel flare_pan
{
pos_x = 0;
pos_y = 0;
bmap = flarepan_tga;
flags = overlay, refresh, transparent, visible;
}

action my_own_sun
{
// my.invisible = on; // remove the comment if you want to hide the sun model
my.passable = on;
aum_sun = my;
}

starter get_sun_angles()
{
while (aum_sun == null) {wait (1);}
while (player == null) {wait (1);}
vec_set (temp.x, aum_sun.x);
vec_sub (temp.x, player.x);
vec_to_angle (angles_to_sun, temp); // got the (pan, tilt) angles from the initial position of the player to the sun
while (1)
{
camera.pan %= 360;
temp.x = 0.2 * abs(camera.pan - angles_to_sun[0]); // play with 0.2
temp.y = 0.2 * abs(camera.tilt - angles_to_sun[1]); // play with 0.2
flare_pan.alpha = 100 / ((temp.x + 1) * (temp.y + 1));
wait (1);
}
}

Q: I'd like to see some code sample that moves the player like in modern games (WS = forward / back, AD = strafe left / right, mouse rotates the camera view).
A: Here's a good starting point; you will have to add inertia and friction, but the rest of the code is here.

action my_player
{
while (1)
{
vec_set (camera.pos, my.pos);
camera.pan = my.pan;
camera.tilt += 6 * mouse_force.y * time;
my.pan -= 10 * mouse_force.x * time;
vec_set (temp, my.x);
temp.z -= 1000;
trace_mode = ignore_me + ignore_passable + use_box;
temp.z = -trace (my.x, temp);
temp.x = 8 * (key_w - key_s) * time;
temp.y = 6 * (key_a - key_d) * time;
ent_move (temp, nullvector);
wait (1);
}
}

Q: I'd like to use your Splinter Cell code from Aum32 with shootable lights. Is this possible?
A: The value set for tex_light isn't affected by dynamic lights, so you will have to fake the effect. The enemies should scan the dynamic lights, being less aggressive if the lights in the area are out (if their skill1 is 0 in my example).

function light_off()
{
my.skill1 = 0;
}

action dynamic_light
{
my.skill1 = 1;
my.enable_impact = on;
my.enable_shoot = on;
my.event = light_off;
while (my.skill1 == 1)
{
my.lightrange = 300;
my.lightred = 200 + random (50);
my.lightgreen = 200 + random (50);
my.lightblue = 150;
wait (1);
}
my.lightrange = 0;
}

Q: How can I make the player scan for entities?
A: Use something like this:

action player_scanner
{
player = me; // I'm the player
my.invisible = on;
while (1)
{
my.skill1 = 15 * (key_w - key_s) * time; // move with w / s
my.skill2 = 10 * (key_a - key_d) * time; // straf with a / d
vec_set (temp, my.x);
temp.z -= 1000;
trace_mode = ignore_me + ignore_passable + use_box;
my.skill3 = -trace (my.x, temp);
my.pan -= 5 * mouse_force.x;
my.tilt += 5 * mouse_force.y;
move_mode = ignore_passable + ignore_passents + glide;
ent_move(my.skill1, nullvector);
wait (1);
camera.x = my.x;
camera.y = my.y;
camera.z = my.z + 30;
camera.pan = my.pan;
camera.tilt = my.tilt;
temp.pan = 60; // horizontal angle
temp.tilt = 30; // vertical angle
temp.z = 200; // scanning range
scan_entity (my.x, temp);
}
}

function i_am_scanned()
{
my.ambient = 100;
}

action entities_scanned
{
my.ambient = -100;
my.enable_scan = on;
my.event = i_am_scanned;
}

Q: How do I get a model to constantly look at the mouse cursor?
A: Click here to download the modified rpg project from Aum34.

Q: Can anyone tell me how can I create a bullet for my 3rd person character?
A: Use the snippet below:

var players_gun;

string bullet_mdl = <bullet.mdl>;

function remove_bullet()
{
wait (1);
ent_remove (me);
}

function move_players_bullet()
{
my.pan = you.pan;
my.tilt = you.tilt;
my.enable_entity = on;
my.enable_impact = on;
my.enable_block = on;
my.event = remove_bullet;
while (my != null)
{
my.skill1 = 20 * time; // bullet speed
my.skill2 = 0;
my.skill3 = 0;
move_mode = ignore_you + ignore_passable;
ent_move (my.skill1, nullvector);
wait (1);
}
}

function players_bullet()
{
proc_kill(4);
while (mouse_left == 1) {wait (1);}
ent_create (bullet_mdl, players_gun, move_players_bullet);
}

action third_player
{
player = me;
while (1)
{
vec_for_vertex (players_gun, my, 6); // origin of the bullet = vertex #6 on player's model
my.skill1 = 15 * (key_w - key_s) * time;
my.skill2 = 10 * (key_a - key_d) * time;
vec_set (temp, my.x);
temp.z -= 1000;
trace_mode = ignore_me + ignore_passable + use_box;
my.skill3 = -trace (my.x, temp);
my.pan -= 5 * mouse_force.x;
if (key_w + key_s > 0) // walking
{
ent_cycle("walk", my.skill46);
my.skill46 += 10 * time;
my.skill46 %= 100;
}
else // standing
{
ent_cycle("idle", my.skill46);
my.skill46 += 2 * time;
my.skill46 %= 100;
}
if (mouse_left == 1)
{
players_bullet();
}
move_mode = ignore_passable + ignore_passents + glide;
ent_move(my.skill1, nullvector);
camera.x = player.x - 200 * cos(player.pan);
camera.y = player.y - 200 * sin(player.pan);
camera.z = player.z + 200;
camera.pan = player.pan;
camera.tilt = -30;
wait (1);
}
}

Q: I use your car scripts as a base for my driving script, but I ran into trouble with handling slopes and aligning the vehicle to slopes. Can you help?
A: Include these lines of code in the while loop that moves the cars.

temp.tilt = 0;
temp.roll = 0;
temp.pan = -my.pan;
vec_rotate(normal, temp);
temp.tilt = -asin(normal.x);
temp.roll = -asin(normal.y);
my.tilt += 0.1 * ang(temp.tilt - my.tilt); // play with 0.1
my.roll += 0.1 * ang(temp.roll - my.roll); // play with 0.1

Click here to download one of the carai projects; it includes this change for player's car.