im trying to make a shotgun were when you shoot from a certain range it makes an image does anyone know how to do this?
[highlight](User was banned for this post ("Wrong section" - mahalis))[/highlight]
you mean the bullets make an image?
ya like the bullet marks on the wall will be in the shape of a face
you would need a module like gmcl_deco for this
i take it thers no other way
manipulating bullet spread requires a module, so yeah
You could send a bullet at the correct angle for each point on the face, it would create a little lag though.
Or you could shoot bullets at same direction, but at other starting offsets from the barrel position.
There's two ways to accomplish this. I'm assuming you have little gmod lua experience so you could simply replace the default bullet impact image with your own by renaming the new file.
I think you just want one weapon to do this so you will have to modify the SWEP code of that weapon. Create a function in shared.lua like below or modify the function if it already exists.
[lua]
function SWEP:DoImpactEffect(tr, dmgtype)
local e = EffectData();
e:SetStart(tr.StartPos);
e:SetOrigin(tr.HitPos);
e:SetNormal(tr.HitNormal);
e:SetScale(1); --your effect probably won't use this
util.Effect("name_of_your_impact_effect", e, true);
--disable default impact
return true;
end
[/lua]
Now if you want to create your own impact effect I recommend looking at existing custom impact effects (download the [url=http://www.garrysmod.org/downloads/?a=view&id=112722]fallout 3 SWEP pack[/url]). Just copy their impact effect and modify or add a call to [b][url=http://wiki.garrysmod.com/?title=Util.Decal]Util.Decal [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] which is the function that will make your custom impact image on the wall. Of course I could just write it for you but I'm a really busy guy, hence why I'm posting here :rolleye:
By the way you could use this if you want to create a face from the default bullet impact image or if you simply want to make an actual image be applied to the wall (what I assumed you wanted).
ok i think that could work for a little cool affect but what i was looking for was like the shotguns on borderlands that spread made a hammer i was wondering what id need to do to make a face out of the bullet holes in the spread
But that's not relevant, I'm pretty much sure he wanted the bullet impacts to form the shape of a face when you fire at a wall, which in my opinion makes a little more sense than painting faces on the wall instead of bullet holes.
You shouldn't have bothered writing this anyway, I strongly doubt he even knows what's an effect, what to put instead of "name_of_your_impact_effect", and I'm sure he can't guess how to register custom decals.
[editline]5th April 2011[/editline]
Ok now that everything's clear, you should fire each bullet separately using several calls to FireBullets which fire only one bullet each, as opposed to a single call to FireBullets which shoots bullets with spread.
Do you even know how to use FireBullets or are you trying to modify the CS weapon base?
No I'm not trying to change the base I'm working on a SWEP i was trying to think of a cool effect that i could do with a shotgun and that came to mind when i was playing borderlands I'm relatively new at lua coding
[QUOTE=_Kilburn;29000497]But that's not relevant, I'm pretty much sure he wanted the bullet impacts to form the shape of a face when you fire at a wall, which in my opinion makes a little more sense than painting faces on the wall instead of bullet holes.
You shouldn't have bothered writing this anyway, I strongly doubt he even knows what's an effect, what to put instead of "name_of_your_impact_effect", and I'm sure he can't guess how to register custom decals.[/quote]
Well either way he can paint bullet holes with a custom effect. Though if he really wants to fire bullets that's going to be quite a lot of a bullets in one instant (like 25+). In which case, yes you'd have to call Firebullets for each bullet hole.
[QUOTE=CrazyGamer666;29000704]No I'm not trying to change the base I'm working on a SWEP i was trying to think of a cool effect that i could do with a shotgun and that came to mind when i was playing borderlands I'm relatively new at lua coding[/QUOTE]
You'll have to modify the SWEP if you want this to happen. Do you want the face to scale with distance? If so it will make the image look more spread out.
Also if you're completely new to gmod lua I would recommend putting this idea on the back burner until you can write a basic SWEP otherwise this is more of a request.
You can make a simple file parser that reads a file and interprets a character (say x's) that represent the bullethole then translate that to the endpost for the trace going to a given surface.
Example:
[code]
----xxxxxx---
--x--------x--
-x--x----x--x-
-x----------x-
--x--xxxx--x--
----xxxxxx----
[/code]
Something like that.
You could do that?
That's so cool.
Where might I learn to do that?
Sorry, you need to Log In to post a reply to this thread.