kann mir denn hier wirklich keiner helfen?

Hallo zusammen,
ich möchte in diesem waffenscript der waffe folgende animationen hinzufügen:

stand
shot
empty shot
reload
waffe wechseln

Funktioniert leider nicht
habe etwas in der richtung versucht:

ent_cycle("stand",my.skill46);
my.skill46 +=2*time;
my.skill46 %=100;

Bekomme immer Fehlermeldung :empty pointer!

Kann mir jemand helfen? Vielen Dank im voraus.


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var trace_coords;
var weapon_height;
var current_ammo = 5;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

string hithole_tga = <hithole.tga>;
string target_mdl = <target.mdl>;
//string target_mdl = <crosshair_64x64.tga>;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

sound bullet_wav = <bullet.wav>;
sound gotweapon2_wav = <gotweapon2.wav>;
sound nobullets_wav = <nobullets.wav>;
sound gotammo_wav = <gotammo.wav>;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function fire_bullets(); // creates the bullets
function show_target(); // displays the (red) target model
function display_hithole(); // shows the hit hole bitmap

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

entity weapon2_ent
{
type = <pistole.mdl>; // weapon model
pan = 0; // weapon angle
x = 40; // 55 quants ahead of the view, play with this value
y = -15; // 22 quants towards the right side of the screen, play with this value
z = -22; // 22 quants below, play with this value
pan = 2; // weapon's pan angle (you can also use tilt and roll)

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

action players_weapon2
{

my.passable = on; // the weapon is made passable
while (player == null) {wait (1);} // we wait until the player is created
while (vec_dist (player.x, my.x) > 50) // we wait until the player comes closer than 50 quants
{
my.pan += 3 * time_step;
wait (1);
}
snd_play (gotweapon2_wav, 80, 0);
my.invisible = on;
weapon2_ent.visible = on;
sleep (1);
ent_remove (my);

}

starter use_weapon2()
{
proc_late(); // run this function at the end of the function scheduler list (elliminates jerkiness)

var player1_pos; // stores the initial position of the player
var player2_pos; // stores the position of the player after a frame
while (player == null) {wait (1);}
while (1)
{
vec_set (player1_pos.x, player.x); // store the initial player position
if (weapon2_ent.visible == on) // the weapon is visible?
{
weapon2_ent.scale_x =4;
weapon2_ent.scale_y =4;
weapon2_ent.scale_z =4;



vec_set(trace_coords.x, vector(10000, 0, 0)); // the weapon has a firing range of up to 10,000 quants
vec_rotate(trace_coords.x, camera.pan);
vec_add(trace_coords.x, camera.x);
if (c_trace(camera.x, trace_coords.x, ignore_me | ignore_passable) > 0) // hit something?
{
ent_create (target_mdl, target.x, show_target); // then show the target model

}
}
wait (1);
vec_set (player2_pos.x, player.x); // store player's position after 1 frame
if (vec_dist (player1_pos.x, player2_pos.x) != 0) // the player has moved during the last frame?
{
weapon_height += 30 * time_step; // then offset weapon_height (30 = weapon waving speed)
weapon2_ent.z += 0.03 * sin(weapon_height); // (0.03 = weapon waving amplitude)
}
}
}

function show_target()
{

my.passable = on; // the target model is passable
my.ambient = 100; // and should look bright enough
my.scale_x = min (6, vec_dist (my.x, camera.x) / 500); // play with 6 and with 500
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
wait (1);
ent_remove (my);
}

on_mouse_left = fire_bullets; // call this function when the left mouse button is pressed

function fire_bullets()
{
if (weapon2_ent.visible == off) {return;} // don't do anything if the player hasn't picked up the weapon yet
if (current_ammo > 0) // got ammo?
{
c_trace(camera.x, trace_coords.x, ignore_me | ignore_passable | activate_shoot);
if (you == null) // hit a wall?
{
ent_create (hithole_tga, target.x, display_hithole); // then create a bullet hit hole
}
snd_play (bullet_wav, 100, 0); // play the bullet sound at a volume of 100

current_ammo -= 1; // decrease the number of bullets
}
else // no ammo left?
{
snd_play (nobullets_wav, 100, 0); // then play the noammo.wav sound
}
}

function display_hithole()
{
vec_to_angle (my.pan, normal); // orient the hit hole sprite correctly
vec_add(my.x, normal.x); // move the sprite a bit away from the wall
my.passable = on; // the hit hole bitmap is passable
my.transparent = on; // and transparent
my.ambient = 50;
my.flare = on;
my.oriented = on; // the sprite is oriented
my.roll = random(360); // and has a random roll angle (looks nicer this way)
my.scale_x = 0.5; // we scale it down
my.scale_y = my.scale_x; // on the x and y axis
sleep (20); // show the hit hole for 20 seconds
ent_remove (my); // and then remove it
}

action ammo_pack
{
my.passable = on;
while (player == null) {wait (1);}
while (vec_dist (player.x, my.x) > 50)
{
my.pan += 3 * time_step;
wait (1);
}
snd_play (gotammo_wav, 80, 0);
my.invisible = on;
current_ammo += 20; // use your own value here
sleep (1);
ent_remove (my);
}

Last edited by fp; 09/08/07 17:17.