Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 7th_zorro), 1,285 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Member
3dworld  Offline 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

M
Malice
Unregistered
Malice
Unregistered
M



Code:
reset(weapon1_ent,INVISIBLE); NOW?




Is no VISIBLE flag set or reset flag INVISIBLE

I would use
Code:
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 Offline
Expert
Uhrwerk  Offline
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.
Code:
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

M
Malice
Unregistered
Malice
Unregistered
M



@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 Offline OP
Member
3dworld  Offline 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

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
The solution provided by Uhrwerk actually works amazing.

LOL..!

Quote:
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 Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: Malice
@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

M
Malice
Unregistered
Malice
Unregistered
M



Ok... That's why it says expert under your name and not mine lol.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1