Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 3.46 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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 = 50 --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 ent = ents.Create("shell")
  70.         ent:SetModel("models/dav0r/hoverball.mdl")
  71.         ent:Spawn()
  72.         ent.Radius = self.BulletDamage*2
  73.         ent.Damage = self.BulletDamage
  74.        
  75.         local pitch = 60
  76.        
  77.         local gravity = GRAVITY or 600
  78.        
  79.         local entpos = self:GetPos()
  80.         local tgtpos = enemy:GetPos()
  81.         local differ0 = tgtpos-entpos
  82.         local differ = differ0+self:Variation(differ0)
  83.         local verticaldiffer = Vector(0,0,differ.z)
  84.         local horisontaldiffer = Vector(differ.x,differ.y,0)
  85.         local RANGE = horisontaldiffer:Length()
  86.         local HEIGHT = verticaldiffer:Length()+ent:BoundingRadius()
  87.         local VECTOR0 = horisontaldiffer:Normalize()
  88.         local VECTOR = (VECTOR0*math.cos(pitch)+Vector(0,0,1)*math.sin(pitch)):Normalize()
  89.         --VECTOR:Rotate(Angle(0,pitch,0))
  90.         --local ANGLE = VECTOR:Angle()
  91.  
  92.         --print(VECTOR)
  93.         local fix = Vector(0,0,1)*(self:BoundingRadius()+ent:BoundingRadius())
  94.         ent:SetPos(entpos+fix)
  95.        
  96.         local velocity = math.sqrt(-gravity*RANGE*RANGE/(2*(HEIGHT-math.tan(pitch)*RANGE)*math.cos(pitch)*math.cos(pitch)))
  97.  
  98.         local entphys = ent:GetPhysicsObject();
  99.         if entphys:IsValid() then
  100.                  entphys:Wake();
  101.                  entphys:SetVelocity(VECTOR*velocity*-1)
  102.         end
  103.        
  104.         return true --return true to override
  105. end
  106.  
  107. function ENT:PatrollingFriendlyUnit(friend)
  108.         return true -- returning false will stop unit from chasing enemies closeby
  109. end
  110.  
  111. ENT.HitEffect = "explosion"
  112. ENT.HitEffectScale = ENT.BulletDamage
  113.  
  114. --[[FUNCTIONS:
  115. CleanUnit(ENT) --basically removes owner by making unit neutral and resets other control things from unit
  116. SetEntOwner(ENT,UserID) --change units owner
  117.  
  118. ENT:GetPhysicsObject():EnableGravity(true) --this is fun, looks like unit is paralyzed :3
  119.  
  120. VARIABLES:
  121. ENT.OwnerID == UserID of owner, think of this as a team
  122.  
  123. HITEFFECTS:
  124. explosion
  125. implosion
  126. select
  127.  
  128. TRACERS: --not sure if these even work :p
  129. AirboatGunHeavyTracer
  130. AirboatGunTracer
  131. AR2Tracer
  132. GaussTracer
  133. GunshipTracer
  134. StriderTracer
  135. HelicopterTracer
  136. ToolTracer
  137. LaserTracer
  138. ]]