Team Spartan Cookies & Milk Forums
Starfall Help - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Starfall Help (/thread-937.html)

Pages: 1 2 3 4 5


RE: Starfall Help - Alanzote - 24-05-2015

(24-05-2015, 08:33 PM)Person8880 Wrote: Read my last sentence again.

You have:
for I = 0, #Corridors do
you should have:
for I = 1, #Corridors do
I read, that's why I deleted the post. :/

EDIT: IT WORKED! THX PERSON!


RE: Starfall Help - Person8880 - 24-05-2015

(24-05-2015, 08:34 PM)Alanzote Wrote: I read, that's why I deleted the post. :/
I replied before you deleted it.

Is it resolved now?


RE: Starfall Help - Alanzote - 24-05-2015

(24-05-2015, 08:36 PM)Person8880 Wrote:
(24-05-2015, 08:34 PM)Alanzote Wrote: I read, that's why I deleted the post. :/
I replied before you deleted it.

Is it resolved now?
YEP! Thx!

Another Thing, in E2 you could use the '*' to define all the models from that section, in Starfall how do I do that?
EDIT: I mean that I want to have all the corridors entitys in 1 array"

This is for Starfall optimization, because a lot of 'for' is really bad.


RE: Starfall Help - Person8880 - 24-05-2015

You can't use wildcards in find.byModel, but you can just use:
find.byClass( "prop_physics", function( Ent )
--The path should be everything up to the point you would have added * in E2
if Ent:model():find( "models/whatever/path/you/want" ) then
return Ent:owner() == Owner
end
end )



RE: Starfall Help - Alanzote - 24-05-2015

(24-05-2015, 09:34 PM)Person8880 Wrote: You can't use wildcards in find.byModel, but you can just use:
find.byClass( "prop_physics", function( Ent )
--The path should be everything up to the point you would have added * in E2
if Ent:model():find( "models/whatever/path/you/want" ) then
return Ent:owner() == Owner
end
end )
"Operations Quota Exeeced"


RE: Starfall Help - Person8880 - 24-05-2015

Probably because people have spawned tonnes of props. Might be better to get your constrained entities instead then.

local Constrained = ents.self():getConstraints()
local Corridors = {}
for i = 1, #Constrained do
local Ent = Constrained[ i ]
if Ent:class() == "prop_physics" and Ent:model():find( "models/whatever/path/you/want" ) then
Corridors[ #Corridors + 1 ] = Ent
end
end
Though that might also hit the ops quota if your ship has a lot of parts. Try it and see.


RE: Starfall Help - Alanzote - 25-05-2015

(24-05-2015, 09:51 PM)Person8880 Wrote: Probably because people have spawned tonnes of props. Might be better to get your constrained entities instead then.

local Constrained = ents.self():getConstraints()
local Corridors = {}
for i = 1, #Constrained do
local Ent = Constrained[ i ]
if Ent:class() == "prop_physics" and Ent:model():find( "models/whatever/path/you/want" ) then
Corridors[ #Corridors + 1 ] = Ent
end
end
Though that might also hit the ops quota if your ship has a lot of parts. Try it and see.
Is there a way to slow it down? Still getting ops quota!


RE: Starfall Help - SuperPlayer - 25-05-2015

Well i can try to help. My ship has about 450 props and this just works fine. I am using the subMaterial lib from Rouing.

--@name Set Sub Material B
--@author Rouing

-- Function is designed to take material 1 and set it to material 2 instead of using an index

function setSubMaterialB(ent, mat1, mat2)
local mats = ent:getMaterials()
for i = 1, #mats do
if mats[i] == mat1 then
entConfusedetSubMaterial(i-1,mat2)
end
end
end
To go into red allert I am using this

function redAllert()
for I = 1,#Props do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/flash_red")
end

end

And to go back into green allert i use

function greenStatus()
for I = 1,#Props do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/base_metal_light")
end
end

I am getting all the props at the beginning with. I am getting this just ones so it saves ops.

Props = ents.self():getConstrained()

Maybe this helps you.Big Grin

SuperPlayer


RE: Starfall Help - Alanzote - 25-05-2015

(25-05-2015, 10:39 PM)SuperPlayer Wrote: Well i can try to help. My ship has about 450 props and this just works fine. I am using the subMaterial lib from Rouing.

--@name Set Sub Material B
--@author Rouing

-- Function is designed to take material 1 and set it to material 2 instead of using an index

function setSubMaterialB(ent, mat1, mat2)
local mats = ent:getMaterials()
for i = 1, #mats do
if mats[i] == mat1 then
entConfusedetSubMaterial(i-1,mat2)
end
end
end
To go into red allert I am using this

function redAllert()
for I = 1,#Props do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/flash_red")
end

end

And to go back into green allert i use

function greenStatus()
for I = 1,#Props do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/base_metal_light")
end
end

I am getting all the props at the beginning with. I am getting this just ones so it saves ops.

Props = ents.self():getConstrained()

Maybe this helps you.Big Grin

SuperPlayer
Helped! But Quota execeeded! Just 2 more to go! How sad! =(
I have 407 props
THE MAX: 185


RE: Starfall Help - SuperPlayer - 25-05-2015

Well this what i am showing you now i have never tested so i dont know if it works


function redAllert()
for I = 1,#Props/2 do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/flash_red")
end
timer.simple(1,function()
for I = #Props/2 ,#Props do
setSubMaterialB(Props[I], "cmats/base_metal_light", "cmats/flash_red")
end
end)
end

Maybe it works. I dont know. But when i am in game again i will try to find a solution for you.

SuperPlayer