yea its broken. Tried in my server and single player but didn't work.
You should make it be able to spread - since you already can have it make a fire around a radius, could you just have it launch random small objects from areas contaminated by fire and have it start more fire wherever those objects land?
Are you able to make the fire last permanently or does it have to burn out eventually? If it can not be set to be permanent then you should add it so a burn time of -1 is infinite.
I did a quick, rough attempt to make the fire spread, but whenever I click, the toolgun just dissappears and re-equips. No lua errors in the console. Here's the code, if anyone wants to inspect it:
[lua]
if (CLIENT) then
language.Add("Tool_ignitePRO_name", "IgnitePRO tool")
language.Add("Tool_ignitePRO_desc", "Create customizable fire")
language.Add("Tool_ignitePRO_0", "Left click to make fire. ")
language.Add("Undone_Camera Point", "IgnitePRO undone!")
end
TOOL.Category = "Construction"
TOOL.Name = "IgnitePRO"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar["Size"] = 30
TOOL.ClientConVar["Length"] = 15
TOOL.ClientConVar["Damage"] = 5
TOOL.ClientConVar["Spreadrate"] = 1
function TOOL:LeftClick( trace )
if ( CLIENT ) then return true end
local _size = math.Max( self:GetClientNumber( "Size" ), 2 )
local _health = math.Max( self:GetClientNumber( "Length" ), 2 )
local _damage = math.Max( self:GetClientNumber( "Damage" ), 2 )
createfire(trace.HitPos, tostring(_size), tostring(_health), tostring(_damage))
timer.Destroy("Spread the fire")
timer.Create("Spread the fire", self:GetClientNumber("Spreadrate"), 0, spreadfire)
return true
end
function TOOL.BuildCPanel(panel)
panel:AddControl("Header", {
Text = "IgnitePRO Tool",
Description = "Create fully customizable fire."
})
panel:AddControl("Slider", {
Label = "Size",
Type = "Float",
Min = "1",
Max = "128",
Command = "ignitePRO_size"
})
panel:AddControl("Slider", {
Label = "Burn Length",
Type = "Float",
Min = "1",
Max = "60",
Command = "ignitePRO_length"
})
panel:AddControl("Slider", {
Label = "Damage Scale",
Type = "Float",
Min = "1",
Max = "100",
Command = "ignitePRO_damage"
})
panel:AddControl("Slider", {
Label = "Delay to spread",
Type = "Float",
Min = "0.1",
Max = "60",
Command = "ignitePRO_damage"
})
end
local function spreadfire()
local numfires = #ents.FindByClass( "env_fire" )
if numfires > 500 then
return false
end
local randfire = math.random(1, numfires)
for k, v in pairs( ents.FindByClass( "env_fire" ) ) do
if k == randfire then
fireseed = ents.Create("prop_physics")
fireseed:SetModel("models/props_junk/watermelon01.mdl")
fireseed:SetPos(v:GetPos() + Vector(0, 0, 10))
fireseed:Spawn()
physobj:SetVelocity(Vector(math.Rand(-1, 1), math.Rand(-1, 1), math.Rand(0, 1)) * 100 * fireseed:GetPhysicsObject():GetMass())
fireseed:Ignite(5, self:GetClientNumber( "Size" ))
timer.Simple(5, seedstartfire, fireseed)
timer.Simple(6, fireseed.Remove(), fireseed)
end
end
end
local function seedstartfire(fireseed)
local tracedata = {}
tracedata.start = fireseed:GetPos()
tracedata.endpos = fireseed:GetPos() - Vector(0, 0, 25)
tracedata.filter = fireseed
local trace = util.TraceLine(tracedata)
if trace.Hit then
local _size = math.Max( self:GetClientNumber( "Size" ), 2 )
local _health = math.Max( self:GetClientNumber( "Length" ), 2 )
local _damage = math.Max( self:GetClientNumber( "Damage" ), 2 )
createfire(trace.HitPos, tostring(_size), tostring(_health), tostring(_damage))
end
end
local function createfire(pos, size, health, damage)
local ent = ents.Create( "env_fire" )
if ( !ent:IsValid() ) then return end
ent:SetPos(pos)
ent:SetKeyValue("firesize",size)
ent:SetKeyValue("health",health)
ent:SetKeyValue("fireattack","1")
ent:SetKeyValue("damagescale",damage)
ent:SetKeyValue("spawnflags","128")
ent:Spawn()
ent:Activate()
ent:Fire("StartFire","",0)
undo.Create("IgnitePRO")
undo.AddEntity(ent)
undo.SetPlayer(self:GetOwner())
undo.Finish()
end
[/lua]
lua looks strangely familiar to ROBLOX's scripting program...(roblox = best brick building game EVAR)
[QUOTE=NuclearDB;19474996]lua looks strangely familiar to ROBLOX's scripting program...(roblox = best brick building game EVAR)[/QUOTE]
That would be because it is Lua...
Sorry, you need to Log In to post a reply to this thread.