[Script] - Party teleport script
Posted: Tue Oct 16, 2012 7:01 pm
Hi all,
I wrote this script to allow the teleportation of the party at a given location.
Usage:
Added to wiki: http://grimwiki.net/wiki/Teleport_Party
I wrote this script to allow the teleportation of the party at a given location.
SpoilerShow
Code: Select all
-- Create a scripting entity in level 1 with the name "partygate".
function teleport(x, y, dir, lvl)
-- spawn the teleporter
temporary_teleporter = spawn("teleporter", party.level, party.x, party.y, party.facing, "temporary_teleporter")
:setInvisible(true)
:setSilent(true)
:setTriggeredByParty(true)
:setTriggeredByItem(false)
:setTriggeredByMonster(false)
:setTeleportTarget(x, y, dir, lvl)
:activate()
if (temporary_pressureplate ~= nil) then
temporary_pressureplate:destroy()
temporary_pressureplate = nil
end
temporary_pressureplate = spawn("pressure_plate_hidden", lvl, x, y, dir, "temporary_pressureplate")
:setTriggeredByParty(true)
:setTriggeredByMonster(false)
:setTriggeredByItem(false)
:setActivateOnce(true)
:setSilent(true)
:addConnector("activate", "partygate", "cleanup")
end
function cleanup()
if (temporary_teleporter ~= nil) then
temporary_teleporter:destroy()
temporary_teleporter = nil
end
end
- Create a script entity in level 1 (or wherever) and call it "partygate"
- From any other script entity call partygate.teleport(<x>, <y>, <facing>, <level>)
- Example: partygate.teleport(30, 10, 1, 1)
Added to wiki: http://grimwiki.net/wiki/Teleport_Party