3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Once set to INVISIBLE cannot set back to VISIBLE
#423320
05/27/13 20:46
05/27/13 20:46
|
Joined: Sep 2007
Posts: 173 USA, Florida
3dworld
OP
Member
|
OP
Member
Joined: Sep 2007
Posts: 173
USA, Florida
|
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.
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: ]
#423324
05/27/13 21:03
05/27/13 21:03
|
Malice
Unregistered
|
Malice
Unregistered
|
reset(weapon1_ent,INVISIBLE); NOW?
Is no VISIBLE flag set or reset flag INVISIBLE I would use
var klck =0;
if(key_1 && !klck)
{
toggle(weapon1_ent,INVISIBLE);
}
klck = key_1;
Last edited by Malice; 05/27/13 21:07.
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: ]
#423325
05/27/13 21:39
05/27/13 21:39
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
INVISIBLE and VISIBLE are two different flags. Don't mix these two. For level entities only use INVISIBLE.
set(me,INVISIBLE); // Hide me...
wait(-1);
reset(me,INVISIBLE); // Reveal me after a second.
http://www.conitec.net/beta/aentity-invisible.htm
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: Uhrwerk]
#423327
05/27/13 21:48
05/27/13 21:48
|
Malice
Unregistered
|
Malice
Unregistered
|
@Uhrwerk Wasn't VISIBLE replaced with SHOW ?
Last edited by Malice; 05/27/13 21:48.
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: ]
#423328
05/27/13 22:06
05/27/13 22:06
|
Joined: Sep 2007
Posts: 173 USA, Florida
3dworld
OP
Member
|
OP
Member
Joined: Sep 2007
Posts: 173
USA, Florida
|
The solution provided by Uhrwerk actually works amazing. Thank you guys.
SHOW still used for panels...
Thank you so much.
Last edited by 3dworld; 05/27/13 22:06.
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: 3dworld]
#423330
05/27/13 22:22
05/27/13 22:22
|
Malice
Unregistered
|
Malice
Unregistered
|
The solution provided by Uhrwerk actually works amazing. LOL..! SHOW still used for panels...
PANELS - VEIW ENTITIES. open the manual, click index, type visible, click it and you are redirected to SHOW..
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: ]
#423332
05/27/13 23:24
05/27/13 23:24
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
@Uhrwerk Wasn't VISIBLE replaced with SHOW ? SHOW is the newly recommended flag to be used. I guess it was renamed exactly in order to prevent confusion with VISIBLE and INVISIBLE. However, VISIBLE is still a valid keyword and can be used exactly for its original purpose. More precisely, it is exactly the same as SHOW. It's just a macro defined in compat.h.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Once set to INVISIBLE cannot set back to VISIBLE
[Re: Uhrwerk]
#423333
05/27/13 23:28
05/27/13 23:28
|
Malice
Unregistered
|
Malice
Unregistered
|
Ok... That's why it says expert under your name and not mine lol.
|
|
|
|