Blockland Forums > Modification Help
How to locate a sun?
Pages: (1/1)
Electrk:
How do you locate and delete a sun object in a mission via code?
Amade:
Just loop through the missionGroup and check the classname of each object.
mp7964:
--- Code: ---function delSun()
{
for(%i = 0; %i < missionGroup.getCount(); %i++)
%i.getObject();
if(%i.uiName $= "Sun")
{
%i.delete();
}
}
--- End code ---
That would probably work, I think I may have left some errors in there, but TorqueDev didn't say anything.
MegaScientifical:
mp, you have to stop trying. As people used to tell me, don't give people half done code. That would only give the last object. I aalso believe the Sun doesn't use uiName, as it is not used in any ui other than Mission Editor. And that's object name I believe.
otto-san:
--- Quote from: mp7964 on November 25, 2011, 12:53:19 PM ----snip-
That would probably work, I think I may have left some errors in there, but TorqueDev didn't say anything.
--- End quote ---
torquedev doesn't really work that well as far as saying if it's logically correct
--- Code: ---function delSun()
{
for(%i = 0; %i < missionGroup.getCount(); %i++)
{
%obj = missionGroup.getObject(%i);
if(%i.getClassName() $= "Sun")
%i.delete();
}
}
--- End code ---
I did already give him the code last night, though.
Pages: (1/1)