Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------------------------------------------
- -- File : /units/ueb2102/ueb2102_script.lua
- --
- -- Author(s): EbolaSoup, Resin Smoker, Optimus Prime, Vissroid
- --
- -- Summary : UEF Basic Land Mine Script
- --
- -- Copyright © 2011 4DC_V0.8 All rights reserved.
- -----------------------------------------------------------------------------
- local TStructureUnit = import('/lua/terranunits.lua').TStructureUnit
- local util = import('/lua/utilities.lua')
- local EffectTemplate = import('/lua/EffectTemplates.lua')
- local Custom_4D_EffectTemplate = import('/mods/4DC_V0.8/lua/4D_EffectTemplates.lua')
- local KamikazeWeapon = import('/lua/sim/DefaultWeapons.lua').KamikazeWeapon
- ueb2102 = Class(TStructureUnit) {
- OnCreate = function(self,builder,layer)
- TStructureUnit.OnCreate(self)
- -- Global Booleans
- self:SetCollisionShape('Sphere', 0, 0, 0, 0.3)
- -- Enable cloaking and stealth
- self:EnableIntel('Cloak')
- self:EnableIntel('RadarStealth')
- end,
- OnStopBeingBuilt = function(self,builder,layer)
- TStructureUnit.OnStopBeingBuilt(self,builder,layer)
- --[[
- i created a temp spec Blueprint here for the unit sensor..
- sensors can be created like this for instance as an enhancement OR
- we can create a UnitSensor table in the units actual blueprint.
- the unit also has to have 'UNITSENSOR', in its categories table
- only if the unit wants a unit sensor when it is created.
- --]]
- local spec = {
- Owner = self,
- Radius = 4,
- OffSet = -.5,
- AlertFriendly = false,
- MaintenanceConsumptionPerSecondEnergy = 0,
- ParentAttachBone = -1,
- ShowMesh = false,
- Mesh = false,
- DefaultToggle = false,
- }
- self:CreateUnitSensor(spec)
- end,
- UnitDetected = function(self, other, distance)
- TStructureUnit.UnitDetected(self, other, distance)
- --when a unit is detected.. BOOM!!!!
- self:MineDetonation()
- end,
- MineDetonation = function(self)
- -- Detonation FX
- self:PlayUnitSound('Detonate')
- local pos = self:GetPosition()
- local army = self:GetArmy()
- local ran = util.GetRandomFloat(0.75, 1.0)
- for k, v in EffectTemplate.TAPDSHit01 do
- CreateEmitterAtEntity( self, army, v ):ScaleEmitter(ran * 0.5):OffsetEmitter(0,0.1,0)
- end
- for k, v in Custom_4D_EffectTemplate.Mine01 do
- CreateEmitterAtEntity( self, army, v ):ScaleEmitter(ran):OffsetEmitter(0,0.1,0)
- end
- CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_001_normals', '', 'Alpha Normals', 1 + ran, 1 + ran, 150, 60, army )
- CreateDecal( pos, util.GetRandomFloat(0,2*math.pi), 'nuke_scorch_002_albedo', '', 'Albedo', 2 + ran, 2 + ran, 150, 60, army )
- self:ShakeCamera(3, 1.0, 0.5, 1)
- DamageArea(self, pos, 2, 1, 'Force', false)
- --[[
- after looking at the mines.. there is no need to add a weapon..
- we can just smack this minespec table in the mines blueprint
- and call the values for the damage area..
- clean and clear with no weapons..
- it makes it alot easier now to manually detonate the mines.. with say a toggle..
- we just call detonate mine when the toggle is clicked.. :)
- --]]
- local MineSpec = {
- Damage = 500,
- DamageFriendly = false,
- DamageRadius = 2.0,
- DamageType = 'Normal',
- }
- DamageArea(self, self:GetPosition(), MineSpec.DamageRadius, MineSpec.Damage, MineSpec.DamageType or 'Normal', MineSpec.DamageFriendly or false)
- self:Destroy()
- end,
- }
- TypeClass = ueb2102
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement