Multi Destination Teleportation Device
From GMod Wiki
Multi Destination Teleportation Device[New and improved]
Multi Destination Teleportation Device: Multi Destination Teleportation Device[New and improved] |
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 |
Original Author: | bmw99yam |
Created: | 18 June 2010 |
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:
- Text size: 11
- Text justification: 1
- Colours: Anything you want
- Create flat to surface: Ticked
- Default text: No Target
- Weld: Ticked
Ok, now its time for the wiring.
- Wire the screens "A" to the expression 2 chip's "TargetNumber"
- Wire the expression 2 chip's "Teleport" to the advanced pod controller's "Mouse1"
- Wire the expression 2 chip's "Cycle" to the advanced pod controller's "Mouse2"
- Wire the expression 2 chip's "Swap" to the advanced pod controller's "Space"
- Wire the expression 2 chip's "Seat" to the advanced pot controller's "Entity"
- Wire the hover-drive's "X_JumpTarget" to the expression 2 chip's "TargetPosX"
- Wire the hover-drive's "Y_JumpTarget" to the expression 2 chip's "TargetPosY"
- Wire the hover-drive's "Z_JumpTarget" to the expression 2 chip's "TargetPosZ"
- Wire the hover-drive's "Jump" to the expression 2 chip's "TeleportGo"
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 :)