F:
Ich hätte gern einen Fernseher in meinem Projekt, der sich je nach
Nähe zum Spieler ein- bzw. abschaltet. Können Sie helfen?
A: Geben Sie Ihrem Fernseher
(einem Sprite) diese Action:
var tv_handle;
action tv_sprite
{
while (player == null) {wait (1);}
while (1)
{
if (vec_dist(player.x, my.x) < 200) // the
player has come closer than 200 quants?
{
if (tv_handle == 0) // the
movie isn't playing
{
tv_handle
= media_play ("globe.avi",
bmap_for_entity (my, 0), 100); // then start playing it!
}
}
else
{
media_stop (tv_handle);
tv_handle = 0; // reset the
handle manually
}
wait (1);
}
}
F: Ich
war leider nicht in der Lage, das Skript für den intelligenten Fahrstuhl
auf spätere A6 Updates anzupassen. Können Sie helfen?
A: Klicken Sie hier, um die modifizierte Version
herunterzuladen.
F:
Ich möchte gern ein Bild anzeigen, wenn sich der Spieler am Ende
des Spiels einem unsichtbaren Objekt nähert.
A: Verwenden Sie
diesen Code:
bmap gameover_pcx = <gameover.pcx>;
panel gameover_pan
{
bmap = gameover_pcx;
flags = overlay, refresh;
}
action invisible_object
{
my.invisible = on;
while (player == null) {wait (1);}
while (vec_dist(player.x, my.x) > 100) {wait (1);} // wait until
the player has come closer than 100 quants to this object
gameover_pan.visible = on; // show the panel
while (key_any == on) {wait (1);} // wait until the player releases
the any key (if this is the case)
while (key_any == off) {wait (1);} // now wait until the player
presses a key (any key!)
exit; // shut down the engine
}

F:
Können Sie mir verraten, wie man einen Effekt wie ein Lichtschwert
aus Star Wars hinbekommt?
A: Mit diesem Code:
bmap flare_pcx = <flare.pcx>;
var sword_vertex;
var ray_size;
var temp_left;
function remove_flares()
{
my.lifespan = 0; // remove the particle
}
function attach_rays()
{
my.bmap = flare_pcx;
my.flare = on;
my.bright = on;
my.size = 7;
my.function = remove_flares;
}
action monster_with_sword
{
while (1)
{
ray_size = 1;
ent_cycle("stand", my.skill1); // play "stand" frames
animation
my.skill1 += 0.4 * time; // animation speed
my.skill1 %= 100; // loop animation
vec_for_vertex (sword_vertex, my, 333); // set
the vertex that will be used for the base of the sword here
effect (attach_rays, 1, sword_vertex, normal);
while (ray_size > 0)
{
vec_for_normal (temp_left,
my, 235);
vec_normalize (temp_left,
ray_size);
vec_add (sword_vertex,
temp_left);
effect (attach_rays,
1, sword_vertex, normal);
ray_size -= 0.01;
}
wait (1);
}
}

F:
Ich benutze den Sternen-Code aus der “Planet Survivor”-Serie. Ist
es möglich den Code so zu modifizeren, dass die Sterne immer vor meinem
Raumschiff sind, auch wenn ich dessen Ausrichtung ändere und es bewege?
A: Sicher. Verwenden Sie diesen Code:
bmap star_tga = <star.tga>;
string gibbit_mdl = <gibbit.mdl>;
var starfield_speed = 2; // controls the global speed of the starfield
function size_particles()
{
my.size += 0.01 * time;
}
function particle_init()
{
temp.x = -(2 + random (15)) * starfield_speed;
temp.y = 0;
temp.z = 0;
vec_add (my.vel_x, temp);
my.bmap = star_tga;
my.alpha = 40 + random(60); // play with this value
my.size = 5 + random(5);
my.bright = on;
my.move = on;
my.lifespan = 500;
my.function = size_particles;
}
function init_starfield()
{
my.invisible = on;
my.passable = on;
while (1)
{
vec_set(temp, vector(1000, 0, 0)); // keep the
starfield generator 1000 quants in front of the camera all the time
vec_rotate(temp, camera.pan);
vec_add(temp, camera.x);
vec_set(my.x, temp);
temp.x = my.x + 500 - random(1000);
temp.y = my.y + 500 - random(1000);
temp.z = my.z + 500 - random(1000);
effect (particle_init, 15 * time, temp, normal);
wait (1);
}
}
starter particle_generator()
{
while (player == null) {wait (1);}
ent_create (gibbit_mdl, player.x, init_starfield);
}
F:
Ich würde gern zwischen meinen Levels hin und her gehen ohne den
Pan des Spielers zu ändern. Wie kann ich das erreichen?
A: Benutzen Sie diesen
Code:
var players_pan; // global variable
string
level1_wmb = <office.wmb>;
string level2_wmb = <level2.wmb>;
function change_levels_12
{
players_pan = player.pan; // store the initial pan
wait (1);
if (you != player) {return;} // the entity that collided with me
isn't the player?
me = null; // keep this function running even after load_level
level_load (level2_wmb); // load the new level
sleep (0.1); // wait a bit
player.pan = players_pan; // restore the initial pan
}
function change_levels_21
{
players_pan = player.pan; // store the initial pan
wait (1);
if (you != player) {return;} // the entity that collided with me
isn't the player?
me = null; // keep this function running even after load_level
level_load (level2_wmb); // load the new level
sleep (0.1); // wait a bit
player.pan = players_pan; // restore the initial pan
}
action level_12 // place an entity in the level and attach it this action
{
my.enable_impact = on; // this entity is sensitive to impact
my.event = change_levels_12; // changes the level when the player
runs into it
}
action level_21 // place an entity in the level and attach it this action
{
my.enable_impact = on; // this entity is sensitive to impact
my.event = change_levels_21; // changes the level when the player
runs into it
}
F: Wie
kann ich einen Zylinder aus Partikeln anzeigen?
A: Mit diesem Code:
var cylinder_radius = 20;
var cylinder_height = 40;
var temp_angle = 0;
bmap effect_tga = <effect.tga>;
function particle_cylinder();
function fade_particles();
action cylinder
{
my.invisible = on;
my.passable = on;
while(1)
{
temp.x = my.x + cylinder_radius * cos(temp_angle);
temp.y = my.y + cylinder_radius * sin(temp_angle);
temp.z = my.z + random(cylinder_height);
effect(particle_cylinder, 100 * time, temp.x,
nullvector);
temp_angle += 31; // experimental value
wait(1);
}
}
function particle_cylinder()
{
temp.x = 0;
temp.y = 0;
temp.z = random(2) + 2;
vec_set(my.vel_x,temp);
my.bmap = effect_tga;
my.size = 2;
my.flare = on;
my.bright = on;
my.move = on;
my.streak = on; // if your engine version supports it
my.alpha = 50 + random(50);
my.lifespan = 50;
my.function = fade_particles;
}
function fade_particles()
{
my.alpha -= 2 * time;
if(my.alpha < 0)
{
my.lifespan = 0;
}
}

F:
Ich habe ein Panel bestehend aus 3 Knöpfen; kann ich einen oder zwei davon
situationsbedingt aus- bzw. einblenden?
A: Verbergen Sie die Knöpfe,
indem Sie sie mit der pan_setpos Funktion aus dem Bildschirm bewegen:
bmap test_pcx = <test.pcx>;
bmap
confirmyes1_pcx = <confirmyes1.pcx>;
bmap confirmyes2_pcx = <confirmyes2.pcx>;
bmap confirmyes3_pcx = <confirmyes3.pcx>;
panel test_pan
{
bmap = test_pcx;
button = 90, 136, confirmyes3_pcx, confirmyes1_pcx, confirmyes2_pcx,
null, null, null;
flags = refresh, visible;
}
function hide_button()
{
pan_setpos(test_pan, 3, 0, vector(1000, 1000, 0)); // moving a
button (=3) to (1000, 1000) pixels (outside the screen)
}
on_h
= hide_button; // press the "H" key to hide the button
F:
Können Sie uns vormachen, wie man mit dem Mausrad weich zoomen kann?
A: Hier ist ein Beispiel:
starter wheel_zoom()
{
while (1)
{
if (mickey.z > 1)
{
camera.arc += 10 * time; //
play with "10"
}
if (mickey.z < -1)
{
camera.arc -= 10 * time; //
play with "10"
}
camera.arc = min (max (camera.arc, 10), 120);
// limit camera.arc to 10..120
wait (1);
}
}