Q:
I have some hanging lights in my level that I want to look red and emit
red light as well. How can I achieve realistic lighting on mdls?
A:
Attach this piece of code for your light bulbs:
action
light_bulb
{
my.light = on;
while (1)
{
my.lightrange = 200 + random(20); // make it flicker a little
my.lightred = 250;
my.lightgreen = 50;
my.lightblue = 0;
wait (1);
}
}
Q:
How do I make it so when I fall inside a hole I go to the next level?
A:
Place a wmb entity inside the hole and attach it the following action:
string level2_wmb = <office2.wmb>;
action
change_level
{
while (player == null) {wait (1);}
while (vec_dist (my.x, player.x) > 100) {wait (1);}
level_load(level2_wmb);
}
Q:
Is it possible to press a button to skip a splash screen?
A:
Take a look at the code below (yellow = new code):
var counter = 0;
function
main()
{
.......................
// now load the level
level_load(office_wmb);
while (counter < 100)
{
counter += 1 * time; // visible for about 7 seconds
if (key_space == 1)
{
break; // get out of the loop
}
wait (1);
}
splashscreen.visible = off;
........................
}
Q:
The sword combat script in Aum12 uses vec_for_vertex to get the vertex
for player's sword. I want to use vec_for_vertex for the enemy sword as
well. How does vec_for_vertex know whose vertex is it referring to: player
or enemy?
A:
Vec_for_vertex has 3 parameters: vector, entity, number; "entity" can be
a pointer to any entity or you can use the predefined keyword "my". If
this is the case, vec_for_vertex will get the vertex coordinates from "my",
the entity that has this action attached to it.
Q:
I have created a level with some warlocks. When I change their health and
start the level, they turn around and walk back against the wall. I use
the action actor_walk_fight.
A:
The actors that use that action were instructed to run away if their health
is 30 or less points. Set their initial health to a bigger value or change
the value for MY._I_COWARDICE in war.wdl.
Q:
Is there any way to mix map entities and sprites in order to create a prefab?
A:
No, but you can add the sprites at runtime using ent_create in the action
attached to the map entity.
Q:
Is there a way to replace the skill numbers in WED with alpha - numerical
text?
A:
Place the code below at the end of your office.wdl file, place an entity
in Wed and attach it the action light_source.
define
red skill1;
define
green skill2;
define
blue skill3;
define
range skill4;
//
uses red, green, blue, range
action
light_source
{
while (1)
{
my.lightred = my.red;
my.lightgreen = my.green;
my.lightblue = my.blue;
my.lightrange = my.range;
wait(1);
}
}
You will see the following window in Wed:
Q:
How can I change the frames for an entity using the keys "+" and "-"?
A:
Try this piece of code:
action
change_frames
{
my.frame = 1;
while (1)
{
if (key_sz == 1 && my.frame >= 1)
{
my.frame -= 1;
while (key_sz == 1) {wait (1);}
}
if (key_equals == 1)
{
my.frame += 1;
while (key_equals == 1) {wait (1);}
}
wait (1);
}
}