Page 2 of 2

Re: portal like teleport

Posted: Fri Jun 26, 2015 8:45 pm
by Azel
Eleven Warrior wrote: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
I played someone else's Mod not too long ago and sent them a PM about how I was able to walk around in the dark after going through their Portal. It was kinda fun actually; thought it was another puzzle :o

Re: portal like teleport

Posted: Sat Jun 27, 2015 12:17 am
by Eleven Warrior
Mr Issac. Ok mate i'll try that solution, sounds good to me :) It's a shame that AH did not make the portal do a simular thing as the teleporter, but all good :)

Re: portal like teleport

Posted: Sat Jun 27, 2015 2:28 pm
by Isaac
Eleven Warrior wrote:Mr Issac. Ok mate i'll try that solution, sounds good to me :) It's a shame that AH did not make the portal do a simular thing as the teleporter, but all good :)
We'll see if we get a developer comment; it might be a bug, or already have a solution that none of us know about. The only snag with my solution is that the portal occupies a cell, and no longer behaves like a doorway.

Re: portal like teleport

Posted: Sat Jul 04, 2015 1:39 pm
by Eleven Warrior
Bump: Err Shit Ah helppppppppppppppppppppppppppppppppppp

Re: portal like teleport

Posted: Mon Jul 13, 2015 1:27 pm
by Granamir
Sorry guys i'm out of business for some days more.
In meanwile, since seems portal has his own camera, is there a way to move/control it?
TY

Re: portal like teleport

Posted: Sat Mar 19, 2016 8:58 pm
by AndakRainor
Hey! With Minmay's findings here, the portal problems are over.

Here is my teleportal object:

Code: Select all

defineObject{
  name = "teleportal",
  components = {
    {
      class = "Model",
      name = "frame",
      model = "assets/models/env/portal_frame.fbx",
      staticShadow = true,
    },
    {
      class = "Portal",
      onArrival = function(self)
        local dest = self.go.script:get(self.go.script:get("destination") or 1) or {x=0,y=0,e=0,l=0}
        party:setPosition(dest.x, dest.y, party.facing, dest.e, dest.l)
        GameMode.fadeIn(0xffffff,1)
        GameMode.setEnableControls(true)
        --print("time multiplier value was "..GameMode.getTimeMultiplier())
        GameMode.setTimeMultiplier(1)
      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 = "Model",
      name = "portalBeam",
      model = "assets/models/env/portal_beam.fbx",
    },
    {
      class = "Model",
      name = "planeModel",
      model = "assets/models/env/portal_plane.fbx",
    },
    {
      class = "Script",
      source = [[
        data = {{x=0,y=0,e=0,l=0},{x=0,y=0,e=0,l=0}}
        function dest1() self.data["destination"] = 1 end
        function dest2() self.data["destination"] = 2 end
        function get(self,name) return self.data[name] end
        function set(self,name,value) self.data[name] = value end
      ]],      
    },
    {
      class = "ScriptController",
      name = "controller",
    },
  },
  placement = "wall",
  tags = { "door" },
  editorIcon = 124,
  automapIcon = 84,
}

Re: portal like teleport

Posted: Wed Mar 23, 2016 7:50 am
by Eleven Warrior
Well I say...... Bloody good job mate and thxs for this :)

Re: portal like teleport

Posted: Tue Mar 02, 2021 8:08 pm
by kelly1111
AndakRainor wrote: Sat Mar 19, 2016 8:58 pm Hey! With Minmay's findings here, the portal problems are over.

Here is my teleportal object:

Code: Select all

defineObject{
  name = "teleportal",
  components = {
    {
      class = "Model",
      name = "frame",
      model = "assets/models/env/portal_frame.fbx",
      staticShadow = true,
    },
    {
      class = "Portal",
      onArrival = function(self)
        local dest = self.go.script:get(self.go.script:get("destination") or 1) or {x=0,y=0,e=0,l=0}
        party:setPosition(dest.x, dest.y, party.facing, dest.e, dest.l)
        GameMode.fadeIn(0xffffff,1)
        GameMode.setEnableControls(true)
        --print("time multiplier value was "..GameMode.getTimeMultiplier())
        GameMode.setTimeMultiplier(1)
      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 = "Model",
      name = "portalBeam",
      model = "assets/models/env/portal_beam.fbx",
    },
    {
      class = "Model",
      name = "planeModel",
      model = "assets/models/env/portal_plane.fbx",
    },
    {
      class = "Script",
      source = [[
        data = {{x=0,y=0,e=0,l=0},{x=0,y=0,e=0,l=0}}
        function dest1() self.data["destination"] = 1 end
        function dest2() self.data["destination"] = 2 end
        function get(self,name) return self.data[name] end
        function set(self,name,value) self.data[name] = value end
      ]],      
    },
    {
      class = "ScriptController",
      name = "controller",
    },
  },
  placement = "wall",
  tags = { "door" },
  editorIcon = 124,
  automapIcon = 84,
}
can someone explain to me, what i have to fill into the script to get it working. I cant seem to get it to work for me?

data = {{x=0,y=0,e=0,l=0},{x=0,y=0,e=0,l=0}}
function dest1() self.data["destination"] = 1 end
function dest2() self.data["destination"] = 2 end
function get(self,name) return self.data[name] end
function set(self,name,value) self.data[name] = value end