Whoah, I think i just missed something.
Now, I'm back. Models are done, only TBARS plant and the nozzles - I think I'll leave them. Now, only texturing is to do and everything's ready.
Lynx if you want i can make a tiberium harvesting mod, just tell me what you want :)
I want to fix the bug in the code :/
Ask Para, he coded the original system with you.
Is this still broken?
Most likely yes. You'll just have to wait.
*bump* Any updates on the bug fixing?
Um... Is this a dead addon?
[QUOTE=killer2339]Um... Is this a dead addon?[/QUOTE]
No..
[b]Edit:[/b]
[QUOTE=MattyK]*bump* Any updates on the bug fixing?[/QUOTE]
I think he is working on it.
I think he is not working on it because he don't know how to fix the bug
What bug?
This bug : [url]http://forums.facepunchstudios.com/showpost.php?p=10035073&postcount=429[/url]
That could be a problem. Maybe throw Entity:SetAngles(Angle(0, 0, 0)) in some ware?
And this is the tiberium code : [url]http://forums.facepunchstudios.com/showpost.php?p=10013145&postcount=420[/url]
"Ang.pitch = Ang.pitch + 90" Maybe what is makeng it flip upside down but I don't know just throwing out ideas.
Hoo boy, hit a brick wall, eh Lynix? Have some of the code gurus look at it, I'm sure it's fixable. Let's hope it is anyway, don't wanna have tiberium coming our like a bad constipation :v:
killer2339 : remove this line and go in the game test the code
It's really annoying (I'm not using google traductor \o/), if someone can help me :/
After about 5 hours messing with the code (partly working out it's a new lynix_tiberium_green, getting it loaded, then fixing some weird bug with traces, then finally looking into the bug),
I got it!
I fixed it!
:D
And you won't believe what it was!
[code]function ENT:Think()
if (self.health == 0 and self.Entity:GetPos():Distance(self.topos) < 14.5) then
self.Entity:Remove();
return;
end
if (self.NextRegen <= CurTime()) then
self.NextRegen = CurTime()+math.random(20,60)
if (self.LifeTime <= CurTime()) then
self.health = math.Clamp(self.health-math.random(20,30),0,100);
self.topos = self.HP - self.HN * (self.Entity:OBBMaxs().z*(1-self.health/100))*-1
self.sta = math.Rand(10,20);
else
self.health = math.Clamp(self.health+math.random(20,30),0,100);
self.topos = self.HP - self.HN * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(10,20);
end
end
...[/code]
this is where the error is. My Code:
[code]function ENT:Think()
if (self.health == 0 and self.Entity:GetPos():Distance(self.topos) < 14.5) then
self.Entity:Remove();
return;
end
if (self.NextRegen <= CurTime()) then
self.NextRegen = CurTime()+math.random(20,60)
if (self.LifeTime <= CurTime()) then
self.health = math.Clamp(self.health-math.random(20,30),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(10,20);
else
self.health = math.Clamp(self.health+math.random(20,30),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(10,20);
end
end
...[/code]
The important bit is the LifeTime check. You have "If lifetime has expired, remove 20-30 hp and set a new topos" BUT you added "*-1" to the end, reversing the vector! As a crystal was expiring, it would raise, not sink! (as the topos sets Z position relative to the crystal's HP)
Also as you can see there, I use "self.tr.HitPos" and self.tr.HitNormal" instead of your "self.HP" and "self.HN". For some reason, when I loaded the code, those 2 variables would not save and I had to store the trace instead.
Awesome, the revamped Tiberium is coming!
Oh and I dropped the visceroid thing for two reasons:
Can't get particle editor to work.
Lack of interest.
I'll try this code, just wait two second, I'm coming back
Sorry, don't work
But I think that one of the bug is fixed
Unfortunately, I think that the angle bug isn't fixed
Hmm, they work fine for me now - only they don't grow on props and a field of them isn't lethal. They grow fine though and don't end up floating or oddly rotated for me.
I'll post the full init.lua just in case:
[lua]AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self.health = math.Clamp(math.random(20,30),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = 2;
self.NextRegen = CurTime()+math.random(20,60)
self.LifeTime = CurTime()+math.random(300,600)
self.NextReproduce = CurTime()+math.random(20,60)
self.Entity:SetColor(0,255,0,math.random(180,255))
self.Entity:SetMaterial("models/debug/debugwhite");
self.Entity:DrawShadow(false)
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
self.Entity:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
phys:SetMass(50000)
end
constraint.NoCollide(self.Entity,GetWorldEntity(),0,0)
self.Entity:StartMotionController()
end
function ENT:SpawnFunction( ply, trace )
if ( !trace.Hit ) then return end
local ent = ents.Create( "lynix_tiberium_green" )
ent:SetModel( "models/props_gammarays/tiberium.mdl" )
local pos = trace.HitPos - trace.HitNormal * (ent:OBBMaxs().z)
ent:SetPos( pos )
ent.tr = trace
local Ang = trace.HitNormal:Angle()
Ang.pitch = Ang.pitch + 90
Ang:RotateAroundAxis(Ang:Up(), math.random(0,360))
ent.Angle = Ang
ent:SetAngles(Ang)
ent:Spawn()
ent:Activate()
return ent
end
function ENT:OnTakeDamage(dmg)
if (dmg:IsExplosionDamage()) then
self.health = math.Clamp(self.health - (dmg:GetDamage()/2),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(1,2);
end
end
function ENT:PhysicsSimulate( phys, deltatime )
phys:Wake()
local move = {};
move.secondstoarrive = self.sta
move.pos = self.topos
move.angle = self.Angle
move.maxangular = 5000
move.maxangulardamp = 10000
move.maxspeed = 100000
move.maxspeeddamp = 10000
move.dampfactor = 1
move.teleportdistance = 1000
move.deltatime = deltatime
phys:ComputeShadowControl(move)
end
function ENT:CheckForReproduce(trace,model)
local ent = ents.Create( "prop_physics" )
ent:SetModel(model)
local Maxs = ent:OBBMaxs()
ent:Spawn()
ent:Remove()
local ang = trace.HitNormal:Angle()
ang.pitch = ang.pitch + 90;
local trace2 = {}
trace2.start = trace.HitPos
trace2.endpos = trace.HitPos+(ang:Up()*math.floor(Maxs.z))+(ang:Up()*-1)
trace2 = util.TraceLine( trace2 )
local test1 = trace2.Hit;
local pos = trace.HitPos+(ang:Up()*math.floor(Maxs.z))
local trace2 = {}
trace2.start = pos
trace2.endpos = trace.HitPos+(ang:Right()*math.floor(Maxs.y)/2)+(ang:Up()*-1)
trace2 = util.TraceLine( trace2 )
local test2 = trace2.Hit;
local pos2 = trace.HitPos+(ang:Right()*math.floor(Maxs.y)/2)
trace2.HitPos = Vector(math.floor(trace2.HitPos.x),math.floor(trace2.HitPos.y),math.floor(trace2.HitPos.z))
pos2 = Vector(math.floor(pos2.x),math.floor(pos2.y),math.floor(pos2.z))
local test3 = trace2.HitPos:Distance(pos2) <= 2;
local trace2 = {}
trace2.start = pos
trace2.endpos = trace.HitPos+(ang:Right()*-1*math.floor(Maxs.y)/2)+(ang:Up()*-1)
trace2 = util.TraceLine( trace2 )
local test4 = trace2.Hit;
local pos2 = trace.HitPos+(ang:Right()*-1*math.floor(Maxs.y)/2)
trace2.HitPos = Vector(math.floor(trace2.HitPos.x),math.floor(trace2.HitPos.y),math.floor(trace2.HitPos.z))
pos2 = Vector(math.floor(pos2.x),math.floor(pos2.y),math.floor(pos2.z))
local test5 = trace2.HitPos:Distance(pos2) <= 2;
local trace2 = {}
trace2.start = pos
trace2.endpos = trace.HitPos+(ang:Forward()*math.floor(Maxs.x)/2)+(ang:Up()*-1)
trace2 = util.TraceLine( trace2 )
local test6 = trace2.Hit;
local pos2 = trace.HitPos+(ang:Forward()*math.floor(Maxs.x)/2)
trace2.HitPos = Vector(math.floor(trace2.HitPos.x),math.floor(trace2.HitPos.y),math.floor(trace2.HitPos.z))
pos2 = Vector(math.floor(pos2.x),math.floor(pos2.y),math.floor(pos2.z))
local test7 = trace2.HitPos:Distance(pos2) <= 2;
local trace2 = {}
trace2.start = pos
trace2.endpos = trace.HitPos+(ang:Forward()*-1*math.floor(Maxs.x)/2)+(ang:Up()*-1)
trace2 = util.TraceLine( trace2 )
local test8 = trace2.Hit
local pos2 = trace.HitPos+(ang:Forward()*-1*math.floor(Maxs.x)/2)
trace2.HitPos = Vector(math.floor(trace2.HitPos.x),math.floor(trace2.HitPos.y),math.floor(trace2.HitPos.z))
pos2 = Vector(math.floor(pos2.x),math.floor(pos2.y),math.floor(pos2.z))
local test9 = trace2.HitPos:Distance(pos2) <= 2;
local test10;
if (util.IsInWorld(trace.HitPos+(ang:Up()*math.floor(Maxs.z)*-1))) then
local trace2 = {}
trace2.start = trace.HitPos+(ang:Up()*math.floor(Maxs.z)*-1)
trace2.endpos = trace.HitPos
trace2 = util.TraceLine( trace2 )
if (trace2.HitPos == trace.HitPos) then
test10 = true;
else
test10 = false;
end
else
test10 = true;
end
if (!test1 and test2 and test3 and test4 and test5 and test6 and test7 and test8 and test9 and test10) then
return true;
else
return false;
end
end
function ENT:Reproduce(trace,model)
if ( !trace.Hit or trace.HitNormal == Vector(0,0,0) ) then return end
local ent = ents.Create( "lynix_tiberium_green" )
ent:SetModel( model )
local pos = trace.HitPos - trace.HitNormal * (ent:OBBMaxs().z)
ent:SetPos( pos )
ent.tr = trace
local Ang = trace.HitNormal:Angle()
Ang.pitch = Ang.pitch + 90
Ang:RotateAroundAxis(Ang:Up(), math.random(0,360))
ent.Angle = Ang
ent:SetAngles(Ang)
ent:Spawn()
ent:Activate()
end
function ENT:Think()
if (self.health == 0 and self.Entity:GetPos():Distance(self.topos) < 14.5) then
self.Entity:Remove();
return;
end
if (self.NextRegen <= CurTime()) then
self.NextRegen = CurTime()+math.random(20,60)
if (self.LifeTime <= CurTime()) then
self.health = math.Clamp(self.health-math.random(20,30),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(10,20);
else
self.health = math.Clamp(self.health+math.random(20,30),0,100);
self.topos = self.tr.HitPos - self.tr.HitNormal * (self.Entity:OBBMaxs().z*(1-self.health/100))
self.sta = math.Rand(10,20);
end
end
if (self.NextReproduce <= CurTime()) then
local max = server_settings.Int("tiberium_distance_max", 275)
local min = server_settings.Int("tiberium_distance_min", 75)
local pos = self.Entity:GetPos() + (self.Entity:GetUp( )*25)
local trace={}
trace.start=pos
trace.endpos=pos + Vector((math.random(-max,max)),(math.random(-max,max)),(math.random(-max,max)))
trace.filter = self.Entity
local tr=util.TraceLine(trace)
local hittest = !tr.HitSky and !tr.HitNodraw and tr.MatType ~= 89
local distancetest = (self.Entity:GetPos():Distance(tr.HitPos) >= min) and (self.Entity:GetPos():Distance(tr.HitPos) <= max)
local objecttest = (tr.Hit and !tr.HitWorld and lynix_tiberium_infected_props[tr.Entity] ~= nil and lynix_tiberium_infected_props[tr.Entity] >= 50) or tr.HitWorld;
if (tr.Hit and hittest and distancetest and objecttest) then
local tiberium = ents.FindInSphere( tr.HitPos, min )
local notiberium = false;
for k,v i
*bump* Keeping the thread above the water.
I was hoping Lynix would have reported if that's sorted all the problems now. I realize I didn't find the cause of the bug, just prevented bugged crystals from spawning, but some progress report would be nice. :D
Well releasing his code to the public has been a sucsess so far as you can see above with everybody helping out.
I would love to help but I can't script for my life :(
*Bump*
Any updates(again)?
And if not, could we just have a QUICK repair patch for RD2 with the previous version of Tiberium?
[QUOTE=Lynix][URL=http://gammarays.pursuitnetwerk.com][IMG]http://i3.tinypic.com/6g0swv6.jpg[/IMG][/URL]
Hi,
Here is my second lua realisation, tiberium (C&C3 style) !
Caracteritics:
-It reproduce itself
-Toxic Vapor emitter
-Light emittor
-Vapors can't pass trought props
-If it's between walls, he spawn between them
-Explosions between blue and green tiberium
-3 Sizes
-Tiberium tower!
-Tiberium radar !
-Dynamic infestation !
-Props infestation
Commands who control it :
-tiberium_max : Tiberium host limit (>=0)
-tiberium_light : Enable/disable light emitter on tiberium (0/1)
-tiberium_prop_reproduction : Enable/disable tiberium spawn on props (0/1)
-tiberium_nuclear : Enable/disable nuclear reaction between green and blue tiberium (0/1)
-tiberium_can_die : Enable/disableLe tibérium health (0/1)
-tiberium_distance_max : Max. Distance between original and new one who'll spawn(>=0)
-tiberium_distance_min : Min. Distance between original and new one who'll spawn (>=0)
-tiberium_scale_max : Max. size (1-2-3)
Bugs :
Todo :
-Tiberium zombi
-Visceroids
-Refinery system
Changelog :
-V2.1b
-Fix : Texture bug
-Fix : Tiberium tower admin only
-V2.1a
-Fix (urgency) : Breaking Gmod (Conflict in the ZIP)
-V2
-Add : Tiberium tower
-Add : Tiberium radar
-Add : Dynamic infestation !
-Add : New models
-Fix : Some bugs
-Fix : Angle fix
-V1.1a
-Fix (urgency) : Air respawn with green one
-V1.1
-Add : +6 Commands
-Add : Explosion when green tiberium meet blue one
-Fix : Explosions make damage
-Fix : Some bugs
Credit :
-Me : Lua coding
-nickclick : Models compiling (and textures?)
-Someepguy : models
Finally here is the link :
[highlight]Be sure to DELETE any previous versions of Tiberium before installing this version, or there will be conflicts.[/highlight]
[url=http://www.garrysmod.org/downloads/?a=view&id=14702][img]http://www.garrysmod.org/img/?t=dll&id=14702[/img][/url]
Pics are in the link ;)
Enjoy ![/QUOTE]
where do you put the file in?
When will people learn not to quote the first post? Anyways, is this still being worked on?
[QUOTE=dezztroy]When will people learn not to quote the first post? Anyways, is this still being worked on?[/QUOTE]
Yeah, WE NEED AN UPDATE
I suppose It is. Lynix will post update when it's ready. Be patient as tiberium grows.
Sorry, you need to Log In to post a reply to this thread.