Multi Destination Teleportation Device

From GMod Wiki

Jump to: navigation, search



Multi Destination Teleportation Device[New and improved]

Multi Destination Teleportation Device: Multi Destination Teleportation Device[New and improved]
Page white text.png Description:How to create a Multi Destination Teleportation Device that will teleport you to either predefined locations(using locators) or teleporting to players. Changing the type of target is done by pressing the space bar, and the target is changed by Right-clicking and Teleporting is done by Left-clicking
link=User:bmw99yam Original Author:bmw99yam
Calendar.png Created:18 June 2010
Page white text.png Notes:-


Well to start off, this is my first wiremod tutorial, and it is also the first time that I have created a page for any wiki, so be gentle please.

Right, start of by spawning a PHX 2x1 metal plate. Then spawn a Hover-drive controller from the Entities tab. Easy weld the Hover-drive controller to the front of the metal plate.

Next, spawn a chair and easy-weld it to the back of the metal plate. Then spawn an Advanced Pod Controller, and link it up to the chair.

Now, spawn an expression 2 chip on the metal plate, and enter the following code:

@name Teleporter_v3
@inputs Teleport Cycle Swap Seat:entity
@outputs ListTargets:array Passenger:entity TargetNumber Target:entity TargetPosX TargetPosY TargetPosZ TeleportGo Active Output:string
@persist TargetNumber Type:string ListTargets:array Target:entity GetTargets Active
@trigger all

Active =!(!Seat:driver())

Passenger = Seat:driver()

if (Active & ($Active != 0)) {
    hint("Instuctions:",7)
    hint("Spacebar to change between players and locators",7)
    hint("Right click to toggle targets",7)
    hint("Left click to teleport to target",7)
}

if (Cycle == 1) {
    TeleportGo = 0
    TargetNumber += 1
    if(TargetNumber > GetTargets) {
        TargetNumber = 1
    }
}

if (Swap) {
    if (Type == "player") {
        Type = "gmod_wire_locator"
        TargetNumber = 1
    } else {
        Type = "player"
        TargetNumber = 1
    }
}

if (Type == "player") {
    GetTargets = findByClass("player")
    ListTargets = findToArray()
    Target = ListTargets[TargetNumber, entity]
    Output = Target:name()
} else {
    GetTargets = findByClass("gmod_wire_locator")
    ListTargets = findToArray()
    Target = ListTargets[TargetNumber, entity]
    Output = "Location: " + TargetNumber
}

TargetPosX = Target:pos():x()
TargetPosY = Target:pos():y()
TargetPosZ = Target:pos():z()
TargetPosZ += 200

if (Teleport == 1) {
    if (Target == Passenger) {
        hint("Why would you want to teleport to yourself?",7)
        TeleportGo = 0
    } else { 
        TeleportGo = 1
    }
}

Now, almost done, spawn a wire Text screen on the Hover-drive controller (see picture) with the following settings:

Ok, now its time for the wiring.

Ok, that's all the building done, now all you have to do is either spawn some Wire Locators or teleport to some other people, freeze your "Multi Destination Teleportation Device" and try it out :)

Teleporter
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox