Basic Explode On Hit Lua Code

A Config Script for Garry's Mod

12 lines | 374 bytes | Raw Code
1
2
3
4
5
6
7
8
9
10
11
12
function KaboomOnHit( target, dmginfo )
    if ( target:IsNPC() ) then
       local explo = ents.Create( "env_explosion" )
       explo:SetPos( target:GetPos() )
       explo:Spawn()
       explo:Fire( "Explode" )
       explo:SetKeyValue( "IMagnitude", 20 )
       target:Ignite()
       end
    end
   
hook.Add("EntityTakeDamage", "ExplodeOnHit", KaboomOnHit)

Hello!

This Lua Code is for when you hit a NPC or the NPC get damaged, The NPC will Explode and Ignite.

You Can Create a .lua file and paste this Script Code to it.

To Disable the Code, You have to use this code:

hook.Remove( "EntityTakeDamage", "ExplodeOnHit" )

Posts

None found

Embed

Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:

Credits

Creators
Lukaswbrr avatar
Lukaswbrr username pic Joined 3y ago
Offline
103 points Ranked 30140th
Making this script.

Submitter

Lukaswbrr avatar
Lukaswbrr username pic Joined 3y ago
Offline
103 points Ranked 30140th

Lukaswbrr avatar
Lukaswbrr

Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

License

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 496 Views
  • 0 Posts
  • 4mo Submitted
  • 4mo Modified

Scores

  • Not yet rated
Sign up to access this!
bcp.crwdcntrl.net tracking pixel