Page 1 of 1

[Solved] A scripting question (from a less than noob)

Posted: Sat Nov 01, 2014 12:45 am
by TSotP
Ok, i have built a forest level the connects to a dungeon and then back to the forest. This is what i am trying to do.

Halfway through the dungeon, i want to trigger an event that deletes the current sky in the forest (cemetery_sky; no fog) and replaces it with a different one (forest_sky). Hopefully it will create the illusion of time passing (outside of the regular day/night cycle)

I have set up a pressure plate in the dungeon that is hidden and can only be activated by the party, and it is in a location that the party MUST pass through in order to progress.

The problem i am having is writing a script that deletes the current sky. A spawner should be able to create the new sky (also activated by the pad), but i can't really test that theory until i figure out how to delete the old sky.

Any help would be greatly appreciated


N.B. I did try and have a read through the Scripting Reference (work in progress) posted by petri, but it literally means nothing to me.

Re: A scripting question (from a less than noob)

Posted: Sat Nov 01, 2014 12:59 am
by Ixnatifual
Have you tried calling destroy() on the sky entity?

Re: A scripting question (from a less than noob)

Posted: Sat Nov 01, 2014 1:09 am
by Prozail
Put a script entity on the map with the sky with the following, and make sure the id of the original sky is "cemetery_sky_1" (or you can change it in the script):

Code: Select all

function switchSky()
	if cemetery_sky_1 then
		cemetery_sky_1:destroy()
		spawn("forest_day_sky",self.go.level,0,0,0,0,"forest_sky_1")
	end
end
Connect the plate to that script (it can be from an other map)

Re: A scripting question (from a less than noob)

Posted: Sat Nov 01, 2014 2:21 am
by TSotP
Prozail wrote:Put a script entity on the map with the sky with the following, and make sure the id of the original sky is "cemetery_sky_1" (or you can change it in the script):

Code: Select all

function switchSky()
	if cemetery_sky_1 then
		cemetery_sky_1:destroy()
		spawn("forest_day_sky",self.go.level,0,0,0,0,"forest_sky_1")
	end
end
Connect the plate to that script (it can be from an other map)
That worked perfectly dude, thank you very much :)