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

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
TSotP
Posts: 74
Joined: Tue Oct 15, 2013 8:42 am

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

Post 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.
Last edited by TSotP on Sat Nov 01, 2014 11:14 pm, edited 1 time in total.
Ixnatifual

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

Post by Ixnatifual »

Have you tried calling destroy() on the sky entity?
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

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

Post 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)
User avatar
TSotP
Posts: 74
Joined: Tue Oct 15, 2013 8:42 am

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

Post 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 :)
Post Reply