We tried to figure out how to teleport your party when an item is used.
1.) Open items.lua in mod_assets/scripts and paste the following:
Code: Select all
cloneObject{
name = "rock_teleporter",
baseObject = "rock",
uiName= "Weird looking rock",
throwingWeapon = false,
rangedWeapon = false,
reachWeapon = false,
stackable = true,
consumable = true,
onUseItem = function(item, champion)
-- spawn the teleporter
rockTeleporter = spawn("teleporter", 1, party.x, party.y, party.facing, "rockTeleporter")
-- Set it invisible
rockTeleporter:setInvisible(true)
-- Let it only be triggered by the party
rockTeleporter:setTriggeredByParty(true)
-- Set the target
rockTeleporter:setTeleportTarget(15, 11, party.facing, 1)
-- activate it
rockTeleporter:activate()
-- Print a message
hudPrint("Weeeeee")
-- Consume item
return true
end,
}
3.) Place a hidden pressure plate where the party gets teleported at and a script_entity next to it.
4.) Select the script and enter the following:
Code: Select all
function stopTeleporter()
findEntity("rockTeleporter"):deactivate()
end
Here is a showcase to download:
http://www27.zippyshare.com/v/85374530/file.html
Open it in the editor, pick up the rock and rightclick it in the inventory.
This is pretty straight forward and easy to do.
I personally would still like a party:teleport function because it always leaves a hidden teleporter behind, since there is afaik no destroy() function.
And it only works one time with this specific setup, since the id of the spawned teleporter must be unique.