action
your_player
{
...........
while (1)
{
......................
if (key_w == 1)
{
while (key_w == 1) {wait (1);}
my.skill40 = 0;
while (my.skill40 < 100)
{
ent_cycle("wave", my.skill40);
my.skill40 += 3 * time; // 3 = animation speed
wait (1);
}
}
wait (1);
}
}
Q:
I have an animated texture on a block and it is really slow.... does anybody
have any idea how to speed it up some?
A:
Decrease the number of frames for your texture or place an animated sprite
over the block; you can control its animation speed this way:
function
animated_sprite()
{
my.passable = on;
while (my.frame < 10)
{
my.frame += 1 * time;
wait (1);
}
}
Q:
Can you tell me what is the function and in what file is the function that
is activated by right click?
A:
Sure. Check function mouse_toggle() in menu.wdl.
Q:
I have added an entity to my level and it is named lampe_mdl_020. How can
I get the values of its skills using C-script?
A:
I am attaching an example; please note that you can only read the skills,
you can't change their values:
entity* my_model;
function
test_lamp()
{
my_model = ptr_for_name("lampe_mdl_020");
if (my_model.skill1 == 1) {beep; beep;} // beep twice if skill1 is set
to 1 in Wed
}
Q: Once you set an entity as something, can you clear it, so that character no longer equals you?
entity*
character;
character
= you;
A: Sure. Use
character = null;
and
character will be reset.
Q:
Is there a way to have a sound follow an entity around as it moves?
A:
Use short sounds with ent_playsound and ent_playloop.
Q:
How can I create vars for entitys, like my._stupidhat?
A:
These aren't vars, they are other names for skills. Use something like
this:
define _stupidhat skill1;
and
you have got yourself a funny name for skill1.
Q:
When I use the inkey command to accept user input, how can I position it?
A:
First of all you have to create a string:
string getvalue_str;
Now define a text that uses the string:
text
my_txt
{
layer = 20;
pos_x = 27;
pos_y = 28;
font = arial_font;
string = getvalue_str;
}
When you use these lines in your code:
my_txt.visible
= on;
inkey
getvalue_str;
the
cursor will appear at the position given by pos_x and pos_y.
Q:
I am using ent_move for my player but anything that is set to passable
will act just like a solid. What can I do?
A:
Place this line before your ent_move line and everything will work ok:
move_mode
= ignore_passable;
Q:
I want to make a little triangle above the enemy so you can see if he is
mad or not.
A:
This piece of code will display the triangle if the enemy is mad (skill8
= 1).
string triangle_pcx = <triangle.pcx>;
function am_i_mad();
action
my_model
{
ent_create (triangle_pcx, my.pos, am_i_mad);
while (1)
{
// your code here
wait (1);
}
}
function
am_i_mad()
{
my.passable = on;
my.flare = on;
while (1)
{
if (you != null)
{
vec_set (temp, you.pos);
temp.z += 65; // above the head
vec_set (my.pos, temp);
if (you.flag8 == 1)
{
my.invisible = off;
}
else
{
my.invisible = on;
}
}
wait (1);
}
}