portal like teleport

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!
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

portal like teleport

Post by Granamir »

Hi everyone,
anyone has any idea how to make a portal act like a teleporter? (problem is how to set destination in "onArrival = function()")
TY
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: portal like teleport

Post by minmay »

You can't really make it work for objects other than the party. For the party just use party:setPosition() in the onArrival hook.
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.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: portal like teleport

Post by Granamir »

Thak you minmay, just saw another post like mine.
Btw, is there a way to set dynamically destination coords? (as far as i know in teleport object destination setting is hardcoded and in portal there is not that function).
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: portal like teleport

Post by minmay »

use a connector
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
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: portal like teleport

Post by Isaac »

Granamir wrote:Thak you minmay, just saw another post like mine.
Btw, is there a way to set dynamically destination coords? (as far as i know in teleport object destination setting is hardcoded and in portal there is not that function).
Do you mean to dynamically change the portal's destination, on the fly?

Make a onArrival connector to a script_entity function, and make that function set the party's position using the script_entity's own location and facing. The portal will send the party to wherever the script entity is; and you can control that with :setPosition().
User avatar
Eleven Warrior
Posts: 736
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: portal like teleport

Post by Eleven Warrior »

Hi all I don't know if anyone else has found this but it's very funny. When you walk through the Portal it will take you to the Script Entity Location.

Thxs to Issac for helping me with this script, although the move bit is strange and was hoping AH would be able to help out here.

1 - Put this code into script entity name does not matter. place in it one square of your choice (NOT WALL) floor.
2 - Put a portal on the map named: portal_1.
3 - Walk through the portal, when the fade finishes, press the ( h ) key and move in any direction. Now we are on the Moon walking Slow Mo lol.

Code: Select all

portal_1:removeComponent("portal")
         portal_1:createComponent("Portal")
            :addConnector("onArrival", self.go.id, "arrivalHook");

 function arrivalHook()      
         party:setPosition(self.go.x, self.go.y, self.go.facing, self.go.elevation, self.go.level)
         GameMode.fadeIn(0xffffff,1)  --Fade in from white, over a 1 second duration.
               GameMode.setGameFlag("DisableMovement",false) --added this Issac lol--
 end
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: portal like teleport

Post by Isaac »

It certainly has something to do with the game speed in the dungeon. Pressing H allows for the slow motion creep... Which could be cool to implement into Stealth. Resting after pressing H, does reset the speed to normal (just like it always does).
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: portal like teleport

Post by bongobeat »

funny thing! :lol:
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
Eleven Warrior
Posts: 736
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: portal like teleport

Post by Eleven Warrior »

Issac imam going to add a delayed call to force party to rest for 0.01 seconds and see what happens :)
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: portal like teleport

Post by Isaac »

Eleven Warrior wrote:Issac imam going to add a delayed call to force party to rest for 0.01 seconds and see what happens :)
Didn't work by the console...

What works, is to define a copy of the portal object, but without the portal component, and with placement = "floor".
Then simply place a teleporter on the same tile and set its destination. Uncheck the particle effect for the teleporter.

Either have the teleporter active, for instant transport; or use a floor_trigger and script for a delayed transport, with optional fade out & fade in.

*The portal will need one or more secret doors placed on its left and right, if not between walls; uncheck their model components to make them invisible.
Post Reply