Code:owner():weapon():setMaterial("Models/effects/vol_light001")
Well I am currently almost finished with this E2 that makes it so when you crouch, a holographic box covers your body, like in metal gear. Well anyways, when I crouch, the hologram shows, my body goes invisible, but my weapon shows. Is there anyway to cloak my weapon when i crouch, and it uncloaks when i uncrouch.
Here is the code if you need it...
Code:@name Stealth Box @persist A runOnTick(1) if ( first() ) { holoCreate(1) } if ( owner():isCrouch() ) { A=255 } else { A=0 } holoModel(1,"cube") holoScale(1,vec(3,3,3)) holoParent(1,entity()) holoMaterial(1,"phoenix_storms/fender_wood") holoPos(1,owner():pos()+vec(0,0,19)) holoAlpha(1,A) if (A==255) { owner():setColor(0,0,0) owner():setMaterial("Models/effects/vol_light001") } elseif (A==0) { owner():setColor(255,255,255) owner():setMaterial("") }
Last edited by Drunkie; 08-21-2010 at 04:24 PM. Reason: code tags mah boy
Code:owner():weapon():setMaterial("Models/effects/vol_light001")
“Saying Java is good because it works on all operating systems is like saying anal sex is good because it works on all genders.”
I tried that before you suggested it. When I add that, whenever I crouch it shows and when I stand up it disapears.
Maybe because you are switching weapons. If you "cloak" the physgun, all other weapons are visible.
You could use a foreach loop and an array of all weapon names to turn all weapons visible/invisible.
Something like that.Code:@persist Weps:array #Set up teh array Weps:pushString("weapon_physcannon") Weps:pushString("weapon_physgun") Weps:pushString("weapon_pistol") Weps:pushString("weapon_357") Weps:pushString("weapon_smg1") Weps:pushString("weapon_crossbow") Weps:pushString("weapon_shotgun") Weps:pushString("weapon_ar2") Weps:pushString("weapon_frag") Weps:pushString("weapon_rpg") Weps:pushString("weapon_crowbar") Weps:pushString("gmod_tool") Weps:pushString("gmod_camera") #Turn every weapon visible/invisible foreach(K,V:string=Weps){ owner():weapon(V):setMaterial("models/effects/vol_light001") #owner():weapon(V):setMaterial("") }
Last edited by Wodden; 08-22-2010 at 02:36 AM. Reason: It's weapon_frag :/
“Saying Java is good because it works on all operating systems is like saying anal sex is good because it works on all genders.”
is there anyone who would know how to do it? both ways dont work
p.s. this is devilboy643
Setting the material to models/effects/vol_light001 works, I don't know what you're doing wrong.
I think you cant hide your body and weapon.
YOUR DOING IT WRONG!
You cant setAlpha on players I believe.
Don't think vol_light can be applied to >1 entity, so you can use vol_light on yourself and setAlpha on your weapon.Code:Revision 2205 [E2] setAlpha now works on the owner's weapons, setColor(N,N,N,N) and it's variants now affect the alpha of the owner's weapons.
Bookmarks