Q:
I liked the "Intelligent music" article from Aum38; how can I
make the music change from gentle to tense and back every time
I come close to / get away from the entity?
A:
Click here to download the modified script.
Q: I would
need some code for an actor that waits
until the player has come close to it and then rotates towards the player,
plays a sound and creates 3 entities. Can you help?
A: Click here to get the standalone script.
Q:
I liked your "Editable texts" article from Aum38; I
was wondering if I could use that code to display some numbers for my
game.
A:
Click here to download the modified script file; it
displays a random number from 0 to 10,000 every 2 seconds.

Q:
I am using the race script that was developed in
Aum. How can we make player's car create sparks when it
hits the wall?
A:
Click here to download the modified carai4 project.
Q:
I am using the access code from Aum 33;
how
do I edit the door script to make it open upwards?
A: Click here to
download the modified access.wdl file.
Q:
I haven't figured out how to make
a script file for my models when I use the
A5 export from milkshape. Can you help?
A:
Let's examine the content of a typical qc script file:
//
header: not used entries (just let them be)
$final 0
$pad 0.0
$eye 0.0 0.0 0.0
$flags 0
// skin size and name
$skinwidth 512
$skinheight 256
$skin soldier.pcx
// animation frames
$sequence stand 1 5
$sequence walk 6 31
$sequence run 32 61
It starts with the header (ignore that part) and then goes on with the width, height of the skin (in pixels) and the skin name. This model has 3 animations: stand, walk and run and you can see their corresponding frame numbers; add more sequences if you need them. Copy and paste the yellow lines above into a text file created by notepad, and then rename it to mymodel.qc (just an example). Make sure to give the same name to the exported model (mymodel.mdl in my example). The exported model could have a weird looking skin, but you can load it again using Med's skin editor and everything will work fine.
Q:
I need a script which makes an entity invisible and visible every
few seconds. If you shoot the entity and it is visible the player will get
some points. Can you please help me?
A: Here's the snippet that does what
you want:
var my_score = 0;
function you_hit_me()
{
my_score += 10;
}
action my_entity
{
my.enable_impact = on; // sensitive to impact with other entitites
(any weapon that fires rockets or bullets)
my.event = you_hit_me;
while (1)
{
my.invisible = on;
my.passable = on;
sleep (3); // invisible for 3 seconds
my.invisible = off;
my.passable = off;
sleep (3); // visible for 3 seconds
}
}
panel score_pan
{
layer = 10;
pos_x = 10;
pos_y = 10;
digits = 7, 15, 3, _a4font, 1, my_score;
flags = overlay, refresh, visible;
}
Q:
I need a simple level changing script when I move over
an entity and then I want to play a movie file for a
cutscene. Can you help me?
A:
Use the script below:
string level2_wmb = <level2.wmb>;
action level_changer
{
while (vec_dist (my.x, player.x) > 100) {wait (1);} // wait
until the player has come close enough
my = null; // keep the function running even after level_load
level_load (level2_wmb);
wait (3); // wait until the level is loaded
media_play ("cutscene.avi", null, 100); // now play the
movie
}
Q: I
wish to create a game involving combat where 2 people fight each other
using swords. It would be neat to be able to
show sparks flying when swords meet.
Is it possible with the physics engine to get the position of the collision
(or some other smarter technique) so I can see which
parts of the models collided?
A: The easiest method is to use
separate models for the swords. Set "my.enable_impact = on;" for
them and then check if they have collided or not by testing if you.skill35
= certain_value or not (set skill35 = certain_value only
for the swords). Visit Acknex Unlimited to get
a script
that allows you to attach weapons to characters.