• SWEP coding problem!
    6 replies, posted
So I modified the Strider Cannon swep to make it perfect and totally overpowered tool of death. It has many functions like: bullets create debris that damage entities in range of 150, bullets can ignite npc's and props, bullets have good hit effects, and many other. [B]problem 1[/B]: I want to make bullets ignite entities in range of 150 witch random chance, but i dont know how to do this, and any tutorial i have found wasn't about this. Also ignited props extigunish after 3 secs. and they can't be ignited again, because they are like still on fire. [B]problem 2[/B]: Some bullet hit effects don't work, but! They were working one time. If you can, help me please! I want to be a good coder, but I need some examples. :eng101::words: CODE: [URL="http://pastebin.com/CZf5DLKS"]http://pastebin.com/CZf5DLKS[/URL] [B]Sorry For Bad English[/B]
In your Callback you'd do something like: [lua]if ( SERVER ) then for k, v in pairs( ents.FindInRadius( BulletCallback.tr.HitPos, 150 ) ) do if ( IsValid( v ) ) then v:Ignite( 3 ); end end end[/lua]
[QUOTE=Acecool;44520526]In your Callback you'd do something like: [lua]if ( SERVER ) then for k, v in pairs( ents.FindInRadius( BulletCallback.tr.HitPos, 150 ) ) do if ( IsValid( v ) ) then v:Ignite( 3 ); end end end[/lua][/QUOTE] ents.FindInRadius?
[QUOTE=HumbleTH;44521114]ents.FindInRadius?[/QUOTE] My bad: [url]http://wiki.garrysmod.com/page/ents/FindInSphere[/url] FindInSphere..
Thank you! But i had to put it in SWEP:PrimaryAttack. In BulletCallback it didn't worked, and created lots of errors. :dance:
What? It has to be in callback because otherwise you're only igniting things around yourself [editline]12th April 2014[/editline] Just replace BulletCallback.tr.hitpos with tr.HitPos make sure tr is passed as an arg as well
I dont need to change this, it works perfectly. It ignites things around bullet hit position. And will ignite you if you shoot too close. It looks like this: for k, v in pairs( ents.FindInSphere( tr.HitPos, 75 ) ) do if ( IsValid( v ) ) then v:Ignite( 1 ); end end And is working!
Sorry, you need to Log In to post a reply to this thread.