Hello guys,
I have a problem with my code that looks pretty much like this:
ENT* weapon1_ent;
action pickup_gun(){
set (my, PASSABLE); // the weapon is made passable
set(my,SHADOW | CAST); // lite-C
while (!player) {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 (weapon_pick_wav, 80, 0);
set (my, INVISIBLE);
weapon1_ent = ent_create(weapon1_mdl, temp.x, my_weapon); // create the gun muzzle
set(weapon1_ent,INVISIBLE); // the weapon model is passable
wait (-1);
ent_remove (my);
}
//So far so good the player walks over the weapon a creates the new weapon is created and I have other weapons....
Now I have a function to display the weapon when the key_1 is pressed that it doesn't working like this:
function enable_weapon(){
while(1){
if(key_1){
set(weapon1_ent,VISIBLE); // No working. Why?
}
if(key_2){
set(weapon1_ent,INVISIBLE); // No working. Why?
}
wait(1);
}
}
Basically, once the the ent has been set to INVISIBLE there is no way to make it visible again?
Any. Help will be more than welcome. Thanks in advance
Last edited by 3dworld; 05/27/13 20:47.