Page 1 of 1

[Script] - Party teleport script

Posted: Tue Oct 16, 2012 7:01 pm
by Xanathar
Hi all,
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


Usage:
  • 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)
Let me know of any bug or if it is a duplicate.

Added to wiki: http://grimwiki.net/wiki/Teleport_Party

Re: [Script] - Party teleport script

Posted: Tue Oct 16, 2012 10:43 pm
by msyblade
So, this is like a recall, or portal home? I mean : you're down in level 5, beat up, with 2 ppl dead, you cast this and it takes you back up to the temple and shop everytime? and if so, can we work it into a spell? AND IF SO, can we give it a return function, to the spot you recalled from? anyone else following me here or do i sound like a raving loon? Cant it be both ;)

Re: [Script] - Party teleport script

Posted: Tue Oct 16, 2012 11:23 pm
by Xanathar
Currently it's just a function you can call to teleport the party, not a spell. It can be used to implement EOB-style gates, Mark/Recall UO-style teleport spells (or other teleport spells), puzzles of various kind, etc.

In my case I've developed it to implement some variant of the EOB-style gates.

Personally, I would recommend against doing teleport spells as they complicate all the puzzles and makes making dungeons much harder to design in order to make them "stuck-proof".
For example imagine a classic room with a portcullis which closes behind and you have to fight the boss to gain a key item (as a side note, this is like half of the zelda games :D ). If you teleport out after the portcullis is closed you have no chance to reenter and gain the item and thus you are stuck and have to reload. Not funny.

Note that this can't happen with gates, as the gates are in specific parts of the dungeon and thus are little more than an additional - cool - pair of stairs.

Re: [Script] - Party teleport script

Posted: Tue Oct 16, 2012 11:28 pm
by Xanathar
Ok, I have read too late about your part regarding "teleporting back to the previous location". That should solve the "stuck" problem, but regardless of that I think the teleport could be easily unbalancing.

Tomorrow I'll try to work out a spell script of some kind.

Re: [Script] - Party teleport script

Posted: Tue Oct 16, 2012 11:42 pm
by msyblade
Oh man, the balance thing, you are absolutely right. The dungeon would have to be GRUELING to warrant it.But an impossibly difficult entire dungeon, with ability to place a marker at say, the store and healing stone on level 1 (store uses some currency that can only be found deep down, like, the deeper ya get, the more powerful items you can buy....sorry just brainstorming here...would need the ability to place a marker freely, and auto-place upon recall. Not sure how difficult auto placing upon casting could be, will check it out.
I think its an awesome idea, overall.