Advertisement
WeltEnSTurm

Untitled

Sep 13th, 2010
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.45 KB | None | 0 0
  1. ENT.Type = "anim"
  2. ENT.Base = "brts_base_unit"
  3.  
  4. ENT.PrintName           = "Artillery"
  5. ENT.Purpose             = ""
  6. ENT.Instructions        = ""
  7.  
  8. --important
  9. ENT.UnitType            = "TURRET"
  10.  
  11. ENT.RepairTypes = {"ALL"}
  12. ENT.BuildTypes = {"ALL"}
  13. ENT.AttackTypes = {"ALL"}
  14.  
  15. ENT.Model = "models/Roller_Spikes.mdl"
  16. ENT.LockAngles = true --doesnt propably work yet
  17.  
  18. ENT.HealthAmount = 400
  19. ENT.RegenRate = 2
  20. ENT.MoveSpeed = 0
  21. ENT.SelfBuildRate = 0
  22. ENT.BuildRate = 0
  23.  
  24. ENT.BuildDrain = ENT.BuildRate
  25. ENT.RegenDrain = ENT.RegenRate
  26. ENT.SelfBuildDrain = ENT.SelfBuildRate
  27.  
  28. ENT.ResourceStorage = 0
  29. ENT.ResourceBalance = 0
  30.  
  31. ENT.LoopSound = "npc/scanner/combat_scan_loop2.wav"
  32. ENT.LoopSoundVolume = 155
  33. ENT.LoopSoundPitch = 50
  34.  
  35. ENT.SpotRange = 256
  36. ENT.ShootRadius = 1024 --this is distance from boundarybox
  37. ENT.ShootDelay = 9
  38. ENT.ShootAccuracy = 100 --how precise shots are 1-100
  39. ENT.ChaseDistance = ENT.ShootRadius*1.3 --this is distance from boundarybox
  40. ENT.AllowChase = true
  41.  
  42. ENT.BulletNumber = 3 --for multiple shots like shotgun does
  43. ENT.BulletSpread = 0.01 --basic spread of shots
  44. ENT.BulletForce = 100
  45. ENT.BulletDamage = 180
  46. ENT.BulletEffect = "ToolTracer"
  47. ENT.BulletSound = "weapons/smg1/smg1_fire1.wav"
  48. ENT.BulletSoundVolume = 100
  49. ENT.BulletSoundPitch = 100
  50.  
  51. ENT.MovingUnit = false
  52. ENT.AttackingUnit = true
  53. ENT.EngineeringUnit = false
  54. ENT.HoveringUnit = true
  55.  
  56. function ENT:BulletShootAction(tr,dmginfo,hitpos)
  57.    
  58. end
  59.  
  60. function ENT:BulletHitUnit(tr,dmginfo,hitpos)
  61.  
  62. end
  63.  
  64. function ENT:OrderThink(currentorder)
  65.  
  66. end
  67.    
  68. function ENT:ShootOverride(enemy)
  69.     local pitch = 60
  70.    
  71.     local gravity = GRAVITY or 700
  72.    
  73.     local entpos = self:GetPos()
  74.     local tgtpos = enemy:GetPos()
  75.     local differ0 = tgtpos-entpos
  76.     local differ = differ0+self:Variation(differ0:Length())
  77.     local verticaldiffer = Vector(0,0,differ.z)
  78.     local horisontaldiffer = Vector(differ.x,differ.y,0)
  79.     local RANGE = horisontaldiffer:Length()
  80.     local HEIGHT = verticaldiffer:Length()
  81.     local VECTOR0 = horisontaldiffer:Normalize()
  82.     local VECTOR = (VECTOR0*math.cos(pitch)+Vector(0,0,1)*math.sin(pitch)):Normalize()
  83.     --VECTOR:Rotate(Angle(0,pitch,0))
  84.     --local ANGLE = VECTOR:Angle()
  85.    
  86.  
  87.     local ent = ents.Create("shell")
  88.     ent:SetModel("models/dav0r/hoverball.mdl")
  89.     ent:Spawn()
  90.     ent.Radius = self.BulletDamage*2
  91.     ent.Damage = self.BulletDamage
  92.    
  93.     --print(VECTOR)
  94.     local fix = Vector(0,0,1)*(self:BoundingRadius()+ent:BoundingRadius())
  95.     ent:SetPos(entpos+fix)
  96.    
  97.     local velocity = math.sqrt(-gravity*RANGE*RANGE/(2*(HEIGHT-math.tan(pitch)*RANGE)*math.cos(pitch)*math.cos(pitch)))
  98.  
  99.     local entphys = ent:GetPhysicsObject();
  100.     if entphys:IsValid() then
  101.          entphys:Wake();
  102.          entphys:SetVelocity(VECTOR*velocity*-1)
  103.     end
  104.    
  105.     return true --return true to override
  106. end
  107.  
  108. function ENT:PatrollingFriendlyUnit(friend)
  109.     return true -- returning false will stop unit from chasing enemies closeby
  110. end
  111.  
  112. ENT.HitEffect = "explosion"
  113. ENT.HitEffectScale = ENT.BulletDamage
  114.  
  115. --[[FUNCTIONS:
  116. CleanUnit(ENT) --basically removes owner by making unit neutral and resets other control things from unit
  117. SetEntOwner(ENT,UserID) --change units owner
  118.  
  119. ENT:GetPhysicsObject():EnableGravity(true) --this is fun, looks like unit is paralyzed :3
  120.  
  121. VARIABLES:
  122. ENT.OwnerID == UserID of owner, think of this as a team
  123.  
  124. HITEFFECTS:
  125. explosion
  126. implosion
  127. select
  128.  
  129. TRACERS: --not sure if these even work :p
  130. AirboatGunHeavyTracer
  131. AirboatGunTracer
  132. AR2Tracer
  133. GaussTracer
  134. GunshipTracer
  135. StriderTracer
  136. HelicopterTracer
  137. ToolTracer
  138. LaserTracer
  139. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement