Author Topic: Is there a way to change the sky with a command?  (Read 1259 times)

More particularly, the set sky solid color. If this could be done as an addon then it would be able to work well with Silhouette to make Ipod things.

Sky.something = bla bla bla, tl;dwe (too lazy; didn't wanna explain)

I assume it'd be in a variable, but I don't know what. Is there a field you set in the mission editor to change it?

EDIT: I can change the variable in script but it doesn't apply until you hit apply in the mission editor. Someone wanna fix up my script so it does?

Code: [Select]
function skyColor(%this){ //might wanna make it work with a %color
 for(%i=0;%i<MissionGroup.getCount();%i++){
  if(MissionGroup.getObject(%i).getClassName() $= "Sky"){
   MissionGroup.getObject(%i).SkySolidColor = 0.500000 SPC 0.500000 SPC 0.500000 SPC 1.000000; //change this line obviously, just a placeholder for debugging it
  }
 }
}
« Last Edit: July 14, 2008, 08:27:49 PM by Falcondude »

Ew, Another person who thinks using the least whitespace for their code is going to make it work better.

The ideas suggested here probably won't work because the changes wouldn't get transmitted to all the clients connected.

Ew, Another person who thinks using the least whitespace for their code is going to make it work better.
I'm just used to writing it that way.

Also, it should work if you can simulate an apply button press... it doesn't even work for the host before that.

inspector.apply(Sky);

And Falcondude, skies usually have the name Sky, no need to search for it.

For some reason I'm really doubting you can just say sky.solidColor... unless Sky is somehow defined, it won't work.

You can, unless for some reason you changed the sky's name.
Take a look in f11, and look at the Sky object.
Notice how it says:  (L)(Locked)####(Object ID): Sky(the name) - Sky(the classname)

inspector.apply(Sky);

And Falcondude, skies usually have the name Sky, no need to search for it.

You'll find the inspector apply method will only work in certain circumstances where the server is non-dedicated and the host has F11 enabled. Its not something to be relied upon.

Meh, didn't realize that worked that way. Thanks for that.

Oh, yeah you're right.
Even then. It applies the settings last seen by the inspector...
I'm looking for a way around this, still.

Tom

1st, I think its sky.media
Does missioncleanup.add() apply all settings?

MissionCleanup.add(object ID) will add the object to the MissionCleanup group, which is for things that need to be separately deleted when the server ends. Player objects, static shapes, particle effects created by code and projectiles typically go in here. It can prevent some errors when changing maps or closing and restarting the server.

Besides, the sky needs to stay in the missiongroup.