Daimonin
Members login
Sign Up!      problems?
N F
* Daimonin Forum
Home Help Search Calendar

Welcome Guest, you have to register to post here.
Search

News

Stats
75655 Posts in 6829 Topics by 8142 Members
Latest Member: mattj
Daimonin Forum  |  Development  |  Maps  |  Topic: Question about connections « previous next »
Pages: [1] Go Down Print
Topic: Question about connections  (Read 662 times)
Ratix
Contributor
*


Karma: +5/-2
Posts: 1251



View Profile
« on: August 04, 2007, 11:14:02 pm »

If i have a switch in map A and a gate in map B both with the same connection number, and the maps are tiled next to each other, will the switch open the gate? Or do connections only work within the map its in?
Logged
longir
Administrator
*
*
*
*


Karma: +26/-4
Posts: 2985



View Profile
« Reply #1 on: August 05, 2007, 01:01:54 am »

afaik they have to be on the same map  I haven't messed with it much to try on different maps though
Logged

DM
Dev Team Member
Site Admin

Mostly retired from playing
grommit
Administrator
*
*
*
*


Karma: +28/-3
Posts: 2529



View Profile
« Reply #2 on: August 05, 2007, 09:33:28 pm »

Connections are same-map only. Imagine the potential nightmare problems if it were any different.
Logged
Falciron
Ancient bone dragon
*


Karma: +5/-3
Posts: 272



View Profile
« Reply #3 on: August 05, 2007, 10:24:58 pm »

Hehe. It'd be like if all RC car remotes had an infinite broadcast range. That's the kind of potential nightmare that could ensue.
Logged

"Chain-mail isn't much defense against an arrow. It certainly isn't when the arrow is being aimed between your eyes." -Terry Pratchett
Ratix
Contributor
*


Karma: +5/-2
Posts: 1251



View Profile
« Reply #4 on: August 07, 2007, 05:11:31 am »

That makes sense.. is there any way then that I can have a switch open a gate in a different map?
Logged
Lippy
Fire wyvern lord
*
*
*
*


Karma: +10/-1
Posts: 337



View Profile
« Reply #5 on: August 07, 2007, 10:55:17 am »

I have exactly the same problem now. I'm going to try and do a script to open a door from a map right near it. Tongue
Logged

Current Project: Dynamic Widget Client (M1)
smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #6 on: August 07, 2007, 11:15:37 am »

I think this will work:

On the first map is a switch with this apply script:
Code:

game:ReadyMap("/absolute/path/to/other/map")
local beacon = game:LocateBeacon("unique switch beacon name"); assert(beacon, "Could not find gate switch beacon!")
local switch = beacon.environment; assert(switch, "Could not find gate switch!")
if switch:Apply(switch, game.APPLY_TOGGLE) == 0 then error("Could not apply gate switch!") end

On the second map is a second switch (sys_object 1, layer 0 so it is not detectable by players) with a beacon in it. This switch is connected to a gate on the same map.

What happens is you apply the first switch and it triggers the script. The script loads the second map into memory if it is not already and finds the beacon (and therefore the second switch). Then it causes the second switch to apply itself, which activates the gate.
Logged

smacky
Administrator
*
*
*
*


Karma: +120/-101
Posts: 5381



View Profile
« Reply #7 on: August 07, 2007, 02:49:50 pm »

Double-post! (Please don't kill me Subaru)

This looks to be generally useful, so here is a script for general use. It works as expected on basic tests locally, so please test on your locals and I'll put it in trunk/ (so it'll be on test):
Code:

-------------------------------------------------------------------------------
-- remote_connection.lua
--
-- A script to handle triggering a connection on another map. Eg, to open a gate on map B by flicking a switch on map A.
--
-- On the first map is a switch with this script attached as an apply event. On the second map is a second switch (the trigger) with a beacon in it.
-- This second switch is connected to, eg, a gate on the same map.
--
-- When player applies the first switch, it triggers the script. The script loads the second map into memory if it is not already and finds the beacon (and
-- therefore the second switch). Then it causes the second switch to apply itself, which activates the gate.
--
-- Usually the second switch should be:
--     layer 0
--     sys_object 1
-- so that it is undetectable to players, but if you want the second switch to also be directly useable, this is unnecessary.
--
-- The first switch should have its script data set to:
--     <absolute path to second map> | <unique beacon name>
-- Eg, "/planes/human_plane/somedungeon/somemap_0000|somedungeon secret door control"
--
-- It is possible to have many remote controls all triggering the same connection.
-------------------------------------------------------------------------------
---------------------------------------
-- Parse the options into mapname and beaconname.
---------------------------------------
local options = { string.find(event.options, "(.+)%s*|%s*(.+)") }; assert(options[1], "Insufficient options passed to script!")
local mapname    = options[3]
local beaconname = options[4]

---------------------------------------
-- Ready the second map. This makes sure it is in memory, loading it if necessary.
---------------------------------------
game:ReadyMap(mapname)

---------------------------------------
-- Locate the beacon and by extension the second switch.
---------------------------------------
local beacon  = game:LocateBeacon(beaconname); assert(beacon,  "Could not find beacon!")
local trigger = beacon.environment;            assert(trigger, "Could not find trigger!")

---------------------------------------
-- Activate the trigger.
---------------------------------------
if trigger:Apply(trigger, game.APPLY_TOGGLE) == 0 then error("Could not activate trigger!") end
Logged

subaru
Contributor
*
*
*


Karma: +32/-4
Posts: 538



View Profile
« Reply #8 on: August 07, 2007, 03:41:32 pm »

Grrr!! thats it im bringing my old siggy back >:{

hahahahahaha

~missy
Logged

~*~Whats important is not how you start, but how strong you finish~*~

funny quote from ellwoodblues: "and to keep Subaru from wanting to hunt you down with her specially made "Beating Stick +1 of Kneecaping Double Posters.""

Lippy
Fire wyvern lord
*
*
*
*


Karma: +10/-1
Posts: 337



View Profile
« Reply #9 on: August 08, 2007, 12:52:33 am »

Thanks, Smacky. That works nicely! It's a lot cleaner than what my implementation would be. Smiley
Logged

Current Project: Dynamic Widget Client (M1)
Pages: [1] Go Up Print 
Daimonin Forum  |  Development  |  Maps  |  Topic: Question about connections « previous next »
Jump to:  

Page created in 0.102 seconds with 21 queries.
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Copyright 2008 Daimonin MMORPG  •  Terms of Service  •  XHTML  •  Daimonin sourceforge open source project