Portal

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
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Portal

Post by Mysterious »

Hi does anyone know how the Portal Object works? I though it was like a Teleport with set coordinates. I walk through it but just a white screen lol, Thank you for any help on this :)
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Portal

Post by minmay »

PortalComponent has an onArrival hook that is executed after the fade. If you don't put something in the onArrival hook then nothing will happen after the fade to white. (The portal objects in the standard assets play the ending videos on arrival, and videos won't play in the editor.)
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Portal

Post by Drakkan »

as minmay said, you can modify what will happen with onarrival part. here is copy from definition in case you have overlooked

Code: Select all

defineObject{
	name = "portal",
	components = {
		{
			class = "Model",
			name = "frame",
			model = "assets/models/env/portal_frame.fbx",
			staticShadow = true,
		},
		{
			class = "Portal",
			onArrival = function()
				GameMode.completeGame("assets/videos/outro1.ivf")
			end,
		},
		{
			class = "Light",
			offset = vec(0, 1, 0),
			type = "point",
			color = vec(0.9, 1.0, 1.3),
			brightness = 12,
			range = 6,
			castShadow = true,
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*1 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 15)
			end,
		},
		{
			class = "Particle",
			particleSystem = "portal_particles",
			emitterMesh = "assets/models/env/portal_rim_emitter.fbx",
		},
		{
			class = "Particle",
			name = "particle2",
			particleSystem = "portal_particles_radial",
			emitterMesh = "assets/models/env/portal_radial_emitter.fbx",
		},
		{
			class = "Particle",
			name = "shipSymbol",
			particleSystem = "portal_particles_island",
			emitterMesh = "assets/models/env/portal_ship_emitter.fbx",
		},
		{
			class = "Model",
			name = "portalBeam",
			model = "assets/models/env/portal_beam.fbx",
		},
		{
			class = "Model",
			name = "planeModel",
			model = "assets/models/env/portal_plane.fbx",
		},
		{
			class = "Controller",
			onDeactivate = function(self)
				self.go.portal:disable()
				self.go.light:disable()
				self.go.particle:disable()
				self.go.particle2:disable()
				self.go.shipSymbol:disable()
				self.go.portalBeam:disable()
				self.go.planeModel:disable()
			end,
		},
	},
	placement = "wall",
	tags = { "door" },
	editorIcon = 124,
	automapIcon = 84,
}
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply