Epic things
My most epic creations will go here.
Name: Hangman
Description: Hangman! It's too epic for words.
Note! After dupe, you need to update the expressions to get it to work.
Chat Commands
".add name" - Add a player to the player list (Any player in the player list can play hangman. Those who are not in the player will not be allowed to play.). (Owner only)
TIP: ".add *" will add EVERYONE to the list.
".remove name" - Remove a player from the player list. (Owner only)
".list" - Print the names of all players who are in the player list to chat. (Owner only)
".start word" - Start a new game with that word. (Owner only)
".stop" - Stop the current game (Owner only)
".g" / ".guess" + letter/1 word/whole thing - Type ".g" followed by a letter, 1 word, or the whole thing to guess.
".score name" - Make the score screen display the scores of target player.
Video/Pictures: Use fullscreen mode!
Hangman - Xfire Video
Additional Credits To: - Filipe for giving me the idea.
Dupe File: Wiremod.com Forums
Code:
Main E2
Code:
@name Hangman
@inputs [Sc Fls HSc]:wirelink RecieveWord InputWord:string Driver:entity
@persist On Fails MaxFails ScorePly StartPly:entity [FailGuess Ply STotal SWin SFail]:array Lookup:table [GuessWord Word Msg]:string
@trigger
if (first()|duped()) {
####
# Hangman
# Made by Divran
# http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
####
concmd("say Hangman - Made by Divran")
#Starting Stuff
#Variables
On = Fails = 0
runOnChat(1)
E = entity()
Ply[1,entity] = owner()
#Console Screen
Sc:writeCell(2041,1)
W = "Made by "
Sc:writeString(W,0,0)
W1 = "Divran"
Sc:writeString(W1,W:length(),0,611)
W = "- Hangman -"
Sc:writeString(W,15-round(W:length()/2),1,262)
W = "Type \".g\" or \".guess\" followedby a letter or a word to guess"
Sc:writeString(W,0,16)
Sc:writeCell(2042,333)
#Other console screen
Fls:writeCell(2041,1)
W = "Failed Guesses:"
Fls:writeString(W,15-round(W:length()/2),0)
W = "- None -"
Fls:writeString(W,15-round(W:length()/2),1)
Fls:writeCell(2042,333)
#High Score Console Screen
HSc:writeCell(2041,1)
HSc:writeCell(2042,333)
W = "Scoreboard"
HSc:writeString(W,15-round(W:length()/2),0,60)
ScorePly = owner():id()
timer("UpdateScore",0)
#Holograms
#Positions
Pos = array()
Pos[1,vector] = vec(100,0,0) #Base
Pos:pushVector(vec(100,45,100)) #Pole
Pos:pushVector(vec(100,20,201.5)) #Top pole
Pos:pushVector(vec(100,23,180)) #Diagonal pole
Pos:pushVector(vec(100,-5,160)) #Rope
Pos:pushVector(vec(100,-5,115)) #Head
Pos:pushVector(vec(100,-5,82)) #Stomach
Pos:pushVector(vec(100,6.5,80)) #Arm 1
Pos:pushVector(vec(100,-16.5,80)) #Arm 2
Pos:pushVector(vec(100,6.5,45)) #Leg 1
Pos:pushVector(vec(100,-16.5,45)) #Leg 2
MaxFails = Pos:count()
#Scales
Scale = array()
Scale[1,vector] = vec(100,100,25)
Scale:pushVector(vec(5,5,200))
Scale:pushVector(vec(5,5,50))
Scale:pushVector(vec(5,5,60))
Scale:pushVector(vec(2,2,75))
Scale:pushVector(vec(20,20,20))
for(I=1,5) {Scale:pushVector(vec(5,5,45))}
#Angles
Ang = array()
Ang[1,angle] = ang(0,0,0)
Ang:pushAngle(ang(0,0,0))
Ang:pushAngle(ang(90,90,0))
Ang:pushAngle(ang(-45,90,0))
for(I=1,3) {Ang:pushAngle(ang(0,0,0))}
Ang:pushAngle(ang(-30,90,0))
Ang:pushAngle(ang(30,90,0))
Ang:pushAngle(ang(-30,90,0))
Ang:pushAngle(ang(30,90,0))
#Materials
Mat = array()
for(I=1,5) {Mat[I,string] = "phoenix_storms/wood"}
for(I=6,Pos:count()) {Mat[I,string] = "models/debug/debugwhite"}
#Color
Col = array()
for(I=1,4) {Col[I,vector] = vec(180,180,180)}
Col[5,vector] = vec(255,255,255)
for(I=6,Pos:count()) {Col[I,vector] = vec(0,0,0)}
#Models
Model = array()
for(I=1,4) {Model[I,string] = "cube"}
Model:pushString("hqcylinder2")
Model:pushString("hqicosphere2")
for(I=7,Pos:count()) {Model[I,string] = "hqcylinder2"}
#Create Holograms
for(I=1,Pos:count()) {
holoCreate(I)
holoPos(I,E:toWorld(Pos[I,vector]:rotate(ang(90,90,-90))))
holoScale(I,(Scale[I,vector]/12)*1.04)
holoAng(I,E:angles()+ang(90,0,0)+Ang[I,angle])
holoMaterial(I,Mat[I,string])
holoModel(I,Model[I,string])
holoColor(I,Col[I,vector])
holoAlpha(I,0)
holoParent(I,E)
}
}
#Chat commands
if (chatClk()) {
M = lastSaid():upper():explode(" ")
M1 = M[1,string]
#Owner only commands
if (lastSpoke() == owner()) {
if (M1 == ".ADD") { #ADD
if (M[2,string]) {
if (M[2,string] == "AIM") {
Ent = owner():aimEntity()
} elseif (M[2,string] == "SELF") {
Ent = owner()
} elseif (M[2,string] == "*") {
findByClass("player")
Ply = findToArray()
print("Added everyone.")
exit()
} else {
Ent = findPlayerByName(M[2,string])
}
if (Ent & Ent:isPlayer()) {
print("Added " + Ent:name())
Ply:pushEntity(Ent)
} else {
print("[ERROR] Player not found.")
}
} else {
print("[ERROR] Second parameter must be either 'aim', 'self', or a player's name.")
}
} elseif (M1 == ".REMOVE") { #REMOVE
CurN = M[2,string]
if (CurN) {
CurFind = findPlayerByName(CurN)
if (CurFind) {
Lookup = invert(Ply)
CurNr = Lookup[toString(CurFind),number]
if (CurNr) {
print("Player removed.")
Ply:remove(CurNr)
} else {
print("[ERROR] Player not in player list.")
}
} else {
print("[ERROR] Player not found.")
}
} else {
print("[ERROR] Second parameter must be a string.")
}
} elseif (M1 == ".STOP") { #STOP
On = 0
Sc:writeCell(2039,8)
Sc:writeCell(2039,9)
print("Game stopped.")
} elseif (M1 == ".NEW" | M1 == ".START") { #START
M:remove(1)
CurWord = M:concat(" ")
if (CurWord) {
hideChat(1)
if (CurWord:length() <= 30) {
Word = CurWord
#Main Console Screen
CurWordR = Word:explode("")
GuessWordR = array()
for(I=1,CurWordR:count()) {
if (CurWordR[I,string] == " ") {
GuessWordR[I,string] = " "
} else {
GuessWordR[I,string] = "_"
}
}
GuessWord = GuessWordR:concat()
for(I=2,15) {Sc:writeCell(2039,I)}
Sc:writeString(GuessWord,15-round(GuessWord:length()/2),8)
#Stuff
On = 1, Fails = 0
for(I=1,MaxFails) {holoAlpha(I,0)}
#Failed Guesses Console Screen
FailGuess = array()
for(I=1,17) {Fls:writeCell(2039,I)}
W = "- None -"
Fls:writeString(W,15-round(W:length()/2),1)
W = "("+Fails+"/"+MaxFails+")"
Fls:writeString(W,30-W:length(),0)
StartPly = owner()
W = "This round was started by:"
Sc:writeString(W,15-round(W:length()/2),13,777)
W = StartPly:name()
Sc:writeString(W,15-round(W:length()/2),14,777)
#Message
print("Started a new game with the word: \""+Word+"\".")
} else {
print("[ERROR] The word is too long.")
}
} else {
print("[ERROR] Second parameter must be a string.")
}
} elseif (M1 == ".LIST") {
for(I=1,Ply:count()) {
print(I+": "+Ply[I,entity]:name())
}
}
}
#Guessing
if (On) {
if (M1 == ".GUESS" | M1 == ".G") {
CurPly = lastSpoke()
Allowed = 0
for(I=1,Ply:count()) {if (Ply[I,entity] == CurPly) {Allowed = 1, break}}
if (!Allowed) {exit()}
M:remove(1)
if (M[1,string]:length() == 0) {exit()}
if (M:count() == 1 & M[1,string]:length() == 1) { #ONE LETTER
CurLetter = M[1,string]:left(1)
WordR = Word:explode("")
GuessWordR = GuessWord:explode("")
#Check for success
Correct = 0
for(I=1,WordR:count()) {
if (CurLetter == WordR[I,string]) {
GuessWordR[I,string] = CurLetter
Correct = 1
}
}
if (Correct) {
#Scores
if (StartPly != CurPly) {
SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + 1
STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
}
GuessWord = GuessWordR:concat()
Sc:writeCell(2039,8)
Sc:writeString(GuessWord,15-round(Word:length()/2),8,999)
#Check for win
if (GuessWord == Word) {timer("Win",0)}
} else {
FailGuess[FailGuess:count()+1,string] = CurLetter
timer("Fail",0)
}
} elseif (M:count() == 1 & Word:explode(" "):count() != 1) { #ONE WORD
GuessWordB = GuessWord
WordR = Word:explode(" ")
Correct = 0
for(I=1,WordR:count()) {
if (M[1,string] == WordR[I,string]) {
GuessWordR = GuessWord:explode(" ")
GuessWordR[I,string] = WordR[I,string]
GuessWord = GuessWordR:concat(" ")
Correct = 1
}
}
if (Correct) {
if (StartPly != CurPly) {
Scr = 0
for(I=1,GuessWordB:length()) {
if (GuessWordB:index(I) == "_") {Scr+=1}
}
#Scores
SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + Scr + 1
STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
}
Sc:writeCell(2039,8)
Sc:writeString(GuessWord,15-round(Word:length()/2),8,999)
#Check for win
if (GuessWord == Word) {timer("Win",0)}
} else {
FailGuess[FailGuess:count()+1,string] = "\""+M[1,string]+"\""
timer("Fail",0)
}
} elseif (M:count() > 0) { #WHOLE WORD
GuessWordB = GuessWord
CurPly = lastSpoke()
CurWord = M:concat(" ")
if (CurWord == Word) { #SUCCESFUL GUESS
if (StartPly != CurPly) {
#Scores
Scr = 0
for(I=1,GuessWordB:length()) {
if (GuessWordB:index(I) == "_") {Scr+=1}
}
SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + Scr + 3
STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
}
soundPlay(1,5,"vo/coast/odessa/male01/nlo_cheer0"+randint(4)+".wav")
Sc:writeCell(2039,8)
Sc:writeString(Word,15-round(Word:length()/2),8,999)
On = Fails = 0
Msg = "[Hangman] You escaped the gallows! The winner is: " + lastSpoke():name()
timer("Msg",(CurPly == owner() ? 1000 : 0))
} else { #FAILED GUESS
FailGuess[FailGuess:count()+1,string] = "\""+CurWord+"\""
timer("Fail",0)
}
}
}
}
if (M1 == ".SCORE") {
M2 = M[2,string]
if (M2) {
CurPly = findPlayerByName(M2)
if (CurPly) {
ScorePly = CurPly:id()
timer("UpdateScore",0)
} else {
HSc:writeCell(2041,1)
HSc:writeCell(2042,333)
HSc:writeString("No player named '" + M2 + "' found.",0,5)
}
} else {
HSc:writeCell(2041,1)
HSc:writeCell(2042,333)
HSc:writeString("You must enter a name.",0,5)
}
}
} elseif (~RecieveWord & RecieveWord & !On) {
CurWord = InputWord:upper()
if (CurWord) {
hideChat(1)
if (CurWord:length() <= 30) {
Word = CurWord
#Main Console Screen
CurWordR = Word:explode("")
GuessWordR = array()
for(I=1,CurWordR:count()) {
if (CurWordR[I,string] == " ") {
GuessWordR[I,string] = " "
} else {
GuessWordR[I,string] = "_"
}
}
GuessWord = GuessWordR:concat()
for(I=2,15) {Sc:writeCell(2039,I)}
Sc:writeString(GuessWord,15-round(Word:length()/2),8)
#Stuff
On = 1, Fails = 0
for(I=1,MaxFails) {holoAlpha(I,0)}
#Failed Guesses Console Screen
FailGuess = array()
for(I=1,17) {Fls:writeCell(2039,I)}
W = "- None -"
Fls:writeString(W,15-round(W:length()/2),1)
W = " ("+Fails+"/"+MaxFails+")"
Fls:writeString(W,30-W:length(),0)
StartPly = Driver
W = "This round was started by:"
Sc:writeString(W,15-round(W:length()/2),13,777)
W = StartPly:name()
Sc:writeString(W,15-round(W:length()/2),14,777)
#Message
#print("Started a new game with the word: \""+Word+"\".")
Msg = "[Hangman] " + StartPly:name() + " started a new game!"
timer("Msg",0)
} else {
print("[ERROR] The word is too long.")
}
} else {
print("[ERROR] Second parameter must be a string.")
}
} elseif (clk("Msg")) {concmd("say " + Msg)}
#--------- FAIL AND WIN CODE
if (clk("Fail")) {
#Scores
if (StartPly != lastSpoke()) {
SFail[lastSpoke():id(),number] = SFail[lastSpoke():id(),number] + 1
STotal[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] - SFail[lastSpoke():id(),number]
if (entity(ScorePly) == lastSpoke()) {timer("UpdateScore",0)}
}
soundPlay(1,2,"vo/npc/male01/pain0"+randint(9)+".wav")
Fails++
for(I=1,17) {Fls:writeCell(2039,I)}
Fls:writeString(FailGuess:concat(" "),0,1)
W = " ("+Fails+"/"+MaxFails+")"
Fls:writeString(W,30-W:length(),0)
for(I=1,MaxFails) {
if (I<=Fails) {holoAlpha(I,255)} else {holoAlpha(I,0)}
}
if (Fails>=MaxFails) {
#Scores
if (StartPly != lastSpoke()) {
Scr = 0
for(I=1,GuessWord:length()) {
if (GuessWord:index(I) == "_") {Scr+=0.5}
}
SWin[StartPly:id(),number] = SWin[StartPly:id(),number] + round(Scr) + 5
STotal[StartPly:id(),number] = SWin[StartPly:id(),number] - SFail[StartPly:id(),number]
if (entity(ScorePly) == StartPly) {timer("UpdateScore",0)}
}
soundPlay(1,5,"vo/npc/male01/goodgod.wav")
On = Fails = 0
Msg = "[Hangman] Game over. You were hanged!"
timer("Msg",(lastSpoke() == owner() ? 1000 : 0))
W = "The word was: " + Word
Sc:writeString(W,15-round(W:length()/2),9)
}
} elseif (clk("Win")) {
#Scores
if (StartPly != lastSpoke()) {
SWin[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] + 3
STotal[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] - SFail[lastSpoke():id(),number]
if (entity(ScorePly) == lastSpoke()) {timer("UpdateScore",0)}
}
soundPlay(1,5,"vo/coast/odessa/male01/nlo_cheer0"+randint(4)+".wav")
On = Fails = 0
Msg = "[Hangman] You escaped the gallows! The winner is: " + lastSpoke():name()
timer("Msg",(CurPly == owner() ? 1000 : 0))
} elseif (clk("UpdateScore")) {
HSc:writeCell(2041,1)
HSc:writeCell(2042,333)
CurPly = entity(ScorePly)
W = "Scoreboard"
HSc:writeString(W,15-round(W:length()/2),0,60)
W = "Name: "
W2 = CurPly:name()
if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
HSc:writeString(W,0,1,60)
HSc:writeString(W2,W:length(),1)
W = "Correct Guesses: "
W2 = SWin[CurPly:id(),number]:toString()
if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
HSc:writeString(W,0,2,60)
HSc:writeString(W2,W:length(),2)
W = "Failed Guesses: "
W2 = SFail[CurPly:id(),number]:toString()
if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
HSc:writeString(W,0,3,60)
HSc:writeString(W2,W:length(),3)
W = "Total Score: "
W2 = STotal[CurPly:id(),number]:toString()
if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
HSc:writeString(W,0,4,60)
HSc:writeString(W2,W:length(),4)
Leader = noentity()
LeaderPoints = 0
findByClass("player")
Temp = findToArray()
for(I=1,Temp:count()) {
CurNumber = STotal[Temp[I,entity]:id(),number]
if (CurNumber > LeaderPoints) {
Leader = Temp[I,entity]
LeaderPoints = CurNumber
}
}
if (Leader) {
W = "Leader - (" + LeaderPoints + ")"
HSc:writeString(W,0,16,60)
W2 = Leader:name()
if (W2:length()>30) {W2 = W2:left(28) + ".."}
HSc:writeString(W2,0,17)
}
}
Derma Text Box E2
Code:
@name E2 Derma Text Box
@inputs Chair:entity Active
@outputs SendWord Word:string Eject Driver:entity
@persist Get
@trigger
if (Chair & !Get) {
####
# E2 Derma Text Box
# Made by Divran
# http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
####
Get = 1
dPod(Chair)
dPanel("Base",vec2(scrW()/2-100,scrH()/2-50),vec2(200,100))
dLabel("Title","Base",vec2(5,4))
dText("Title","Enter Word:")
dColor("Title",0,0,0,255)
dColor("Base",255,255,255,100)
dShow("Base",0)
dTextBox("Text","Base",vec2(10,30),180)
dButton("Ok","Base",vec2(10,60),vec2(30,25))
dButton("Exit Pod","Base",vec2(140,60),vec2(50,25))
}
if (~Active & Active) {
dShow("Base",1)
enableMouse(1)
} elseif (~Active & !Active) {
dShow("Base",0)
enableMouse(0)
}
CurB = dClk()
if (CurB) {
if (CurB == "Ok") {
CurWord = dSval("Text")
if (CurWord) {
if (CurWord:length() <= 30) {
Word = CurWord
Driver = Chair:driver()
SendWord = 1
} else {
Chair:printDriver("[ERROR] The word is too long.")
}
} else {
Chair:printDriver("[ERROR] You must enter a word.")
}
} elseif (CurB == "Exit Pod") {
dShow("Base",0)
dSetSval("Text","")
enableMouse(0)
Eject = 1
}
} else {SendWord = Eject = 0}
Name: Color CD Player
Description: I know this has been made loads of times before. But this one has some extra features. It automatically picks up the CD and puts it in the player and plays the song. Louder volume. And it looks awesome.
Update! I have added speakers, and they actually MOVE when you play music! (Not shown in the video, as that was filmed before I made the speakers)
Remember! After dupe, you need to push the Reset button to make it work.
Video/Pictures: Use fullscreen mode!
Color CD Player - Xfire Video

Additional Credits To: -
Dupe File: Wiremod.com Forums
Code:
Code:
@name Color CD Player
@inputs E:entity Eject Reset ResetClk On
@inputs [Skr1 Skr2 Skr3 Skr4 Skr5 Skr6]:entity
@outputs Txt:string TxtColor:vector
@persist [Pos1 Pos2]:vector Mode CD:entity Color:vector Sound:table Dist Next Fade SpeakerAnim
@trigger
if (first()|duped()) {
####
# Color CD Player
# Made by Divran
# http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
####
concmd("say Color CD Player - Made by Divran")
Pos1 = E:toWorld(vec(75,0,5):rotate(ang(0,-135,0)))
Pos2 = E:toWorld(vec(25,0,5):rotate(ang(0,-135,0)))
findIncludePlayerProps(owner())
holoCreate(10)
holoMaterial(10,"models/debug/debugwhite")
holoColor(10,vec(75,75,75))
holoScaleUnits(10,vec(35,-35,2))
holoCreate(11)
holoMaterial(11,"models/debug/debugwhite")
holoColor(11,vec())
holoModel(11,"dome")
holoScaleUnits(11,vec(30,30,8))
holoPos(11,E:toWorld(vec(25,0,11):rotate(ang(0,-135,0))))
holoAng(11,ang())
holoParent(11,E)
Temp = array( Skr1, Skr2, Skr3, Skr4, Skr5, Skr6 )
for(I=1,6) {
CurE = Temp[I,entity]
if (!CurE) {continue}
holoCreate(I)
holoPos(I,CurE:toWorld(CurE:boxCenter())-CurE:up()*6.5)
holoParent(I,CurE)
holoAng(I,CurE:angles())#+ang(90,0,0))
holoModel(I,"dome2")
holoScaleUnits(I,vec(47,47,3.5)*1.04+vec(0,0,4))
holoColor(I,vec(75,75,75))
}
for(I=21,26) {
holoCreate(I)
if (!holoEntity(I-20)) {continue}
holoPos(I,holoEntity(I-20):pos()+holoEntity(I-20):up()*3.5)
holoAng(I,holoEntity(I-20):angles()+ang(180,0,0))
holoModel(I,"dome")
holoScaleUnits(I,vec(20,20,10))
holoMaterial(I,"models/debug/debugwhite")
holoColor(I,vec())
holoParent(I,I-20)
}
#SOUND LIST
Sound[vec(255,0,0):toString(),string] = "ravebreak.mp3" #RED
Sound[vec(0,255,0):toString(),string] = "music/HL2_song12_long.mp3" #GREEN
Sound[vec(0,0,255):toString(),string] = "music/HL1_song25_remix3.mp3" #BLUE
Sound[vec():toString(),string] = "music/HL2_song20_submix0.mp3" #BLACK
Sound[vec(255,255,0):toString(),string] = "music/HL2_song3.mp3" #YELLOW
Sound[vec(255,0,255):toString(),string] = "music/HL2_song16.mp3" #PINK
Sound[vec(0,255,255):toString(),string] = "music/HL2_song31.mp3" #TEAL
Sound[vec(255,255,255):toString(),string] = "music/HL2_song4.mp3" #WHITE
Sound[vec(150,75,0):toString(),string] = "music/HL2_song23_SuitSong3.mp3" #BROWN
#You can add more sounds simply by coping the above, changing the color and file path.
}
# ON/OFF
if (~On | (first() & On)) {
if (On) {
Mode = 0
Txt = "-[ On ]-"
Fade = 255
runOnTick(1)
} elseif (!On) {
Txt = "-[ Off ]-"
Fade = 255
soundPurge()
SpeakerAnim = 0
Mode = 5
if (!CD) {runOnTick(0)}
}
}
# EJECT
if (Eject & ~Eject & Mode == 4) {
Txt = "-[ Ejecting.. ]-"
Fade = 255
soundPurge()
SpeakerAnim = 0
Mode = 5
}
# RESET
if (Reset & ResetClk) {
if (entity(ResetClk) == owner()) {
soundPurge()
reset()
} else {
Txt = "-[ Only the owner can reset ]-"
Fade = 255
}
}
# TEXT SCREEN FADING
if (Fade>1) {
if (!On) {interval(10)}
Fade-=1
TxtColor = vec(Fade,0,0)
}
# SPEAKER ANIMATION
if (SpeakerAnim) {
timer("Scale",250)
if (clk("Scale")) {
RandZ = randint(-4,4)
for(I=1,6) {
holoScaleUnits(I,vec(47,47,3.5+RandZ)*1.04)
holoScaleUnits(I+20,vec(20,20,10-RandZ)*1.04)
}
}
}
# SCAN
if (Mode == 0) {
holoAlpha(10,0)
interval(250*On)
if (clk() & On & findCanQuery()) {
findInSphere(Pos1,50)
findClipToModel("models/props_junk/sawblade001a.mdl")
findSortByDistance(Pos1)
CurEnt = find()
if (CurEnt & !CurEnt:isPlayerHolding()) {
Txt = "-[ CD Found ]-"
Fade = 255
E:soundPlay(1,1,"buttons/button14.wav")
CD = CurEnt
Mode = 1
}
}
# MOVE STEP 1
} elseif (Mode == 1) {
holoAlpha(10,255)
Cnt = CD:toWorld(CD:boxCenter())
CD:applyForce(((Pos1-Cnt)*10-CD:vel()*1.2)*CD:mass())
Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
CD:applyTorque((Torque*75-CD:angVelVector()*10)*CD:inertia())
if (Pos1:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
Mode = 2
}
holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
# MOVE STEP 2
} elseif (Mode == 2) {
Cnt = CD:toWorld(CD:boxCenter())
CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
CD:applyTorque((Torque*75-CD:angVelVector()*5)*CD:inertia())
if (Pos2:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
Mode = 3
}
holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
# GET COLOR AND START SOUND
} elseif (Mode == 3) {
holoAlpha(10,0)
Cnt = CD:toWorld(CD:boxCenter())
CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
Color = CD:getColor()
holoColor(11,Color)
String = Sound[Color:toString(),string]
if (!String) {
soundPurge()
SpeakerAnim = 0
Mode = 5
E:soundPlay(1,0,"buttons/button10.wav")
Txt = "-[ Invalid Color ]-"
Fade = 255
} else {
Mode = 4
for(I=1,6) {holoEntity(I):soundPlay(I,0,String)}
SpeakerAnim = 1
Txt = "-[ Now Playing ]-\n \""+String+"\""
Fade = 255
}
# IDLE - PLAYING
} elseif (Mode == 4) {
Cnt = CD:toWorld(CD:boxCenter())
CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
CD:applyAngForce(ang(0,45,0)*100)
Col2 = Color * (0.7+cos(curtime()*100)*0.3)
holoColor(11,Col2)
# EJECTING
} elseif (Mode == 5) {
holoAlpha(10,255)
Cnt = CD:toWorld(CD:boxCenter())
CD:applyForce(((Pos1-Cnt)*10-CD:vel()*1.2)*CD:mass())
Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
CD:applyTorque((Torque*50-CD:angVelVector()*10)*CD:inertia())
if (Pos1:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
Mode = 6
Dist = Pos2:distance(Cnt)
Next = 0
}
holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
if (CD:isPlayerHolding()) {Mode = 0}
# EJECTING STEP 2
} elseif (Mode == 6) {
timer("Mode",2500)
if (clk("Mode")) {Next = 1}
Dist-=Dist*0.1
holoPos(10,E:toWorld(vec(1*Dist+12.5,0,5):rotate(ang(0,-135,0))))
holoScaleUnits(10,vec(Dist+12.5,-35,2))
if (!On) {runOnTick(0)}
if (round(Dist)<=0 & Next) {Mode = 0, CD = noentity()}
if (CD:isPlayerHolding()) {Mode = 0, CD = noentity()}
}
Name: Toaster
Description: This is for you Schilcote.
Video/Pictures: Use fullscreen mode!
TOASTERS!!! - XFire Video
Additional Credits To: -
Dupe File: Wiremod.com Forums
Code:
Code:
@name TOASTERS!!!!
@inputs Base:entity Btn
@persist [Slots Toasts Stage]:array Toasting Toast
@trigger
if (first()|duped()) {
####
# Toaster
# Made by Divran
# http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
####
if (duped()) { #Only makes you say it when duped.. because of the "reset()" command in this code.
concmd("say Toaster - Made by Divran")
}
Slots[1,vector] = vec(-3,-15,19.5)
Slots[2,vector] = vec(-3,0,19.5)
Slots[3,vector] = vec(-3,15,19.5)
Slots[4,vector] = vec(3,-15,19.5)
Slots[5,vector] = vec(3,0,19.5)
Slots[6,vector] = vec(3,15,19.5)
runOnTick(1)
findIncludePlayerProps(owner())
}
if (Toasting == 0) {
Cnt = Base:toWorld(Base:boxCenter())
timer("Find",250)
if (clk("Find") & findCanQuery()) {
findExcludeEntities(Toasts)
findInSphere(Cnt+vec(0,0,30),50)
findClipToClass("prop_physics")
findClipToModel("models/squad/sf_plates/sf_plate1x1")
findSortByDistance(Cnt+vec(0,0,30))
Temp = findToArray()
for(I=1,Temp:count()) {
if (Toasts:count()<6 & !Temp[I,entity]:isPlayerHolding()) {
Temp[I,entity]:setMass(50)
Temp[I,entity]:setMaterial("models/debug/debugwhite")
Temp[I,entity]:setColor(250,200,0)
Toasts:pushEntity(Temp[I,entity])
Stage:pushNumber(0)
} else {
break
}
}
}
if (Toasts:count()>0) {
for(I=1,Toasts:count()) {
E = Toasts[I,entity]
if (!E) {Toasts:remove(I), Stage:remove(I), continue}
#applyForce
Cnt = E:toWorld(E:boxCenter())
TargetPos = Base:toWorld(Slots[I,vector] + vec(0,0,20 * !Stage[I,number]))
E:applyForce(((TargetPos-Cnt)*10-E:vel())*E:mass())
#applyTorque
Torque = E:toLocal(rotationVector(quat(Base:angles():setPitch(90))/quat(E))+E:pos())
E:applyTorque((Torque*100-E:angVelVector()*5)*E:inertia())
#Stage
if (TargetPos:distance(Cnt) < 2 & positive(Torque):length() < 1) {Stage[I,number] = 1}
}
if (~Btn & Btn & Stage:min() != 0) {Toasting = 1, Toast = 250}
}
} elseif (Toasting == 1) {
timer("Toast",500)
if (clk("Toast")) {Toast-=10}
for(I=1,Toasts:count()) {
E = Toasts[I,entity]
if (!E) {Toasts:remove(I), Stage:remove(I), continue}
#applyForce
Cnt = E:toWorld(E:boxCenter())
TargetPos = Base:toWorld(Slots[I,vector])
E:applyForce(((TargetPos-Cnt)*10-E:vel())*E:mass())
E:setColor(Toast,Toast-100,0)
}
if (Toast<=100 | (~Btn & Btn)) {
for(I=1,Toasts:count()) {
E = Toasts[I,entity]
if (!E) {Toasts:remove(I), Stage:remove(I), continue}
E:applyForce(vec(random(-5000,5000),random(-5000,5000),random(16000,19000)))
}
Toasting = 2
timer("Reset",5000)
}
}
if (clk("Reset")) {reset()} #I tried Toasts = array(), but it didn't want to find the toasts again. So I used reset()
Name: Lollercoaster
Description: A dynamic rollercoaster. Create the track as you ride on it!
Controls are:
W: Down
S: Up
A & D: Left & Right
Mouse1 & Mouse2: Roll left & Right
R: Reset angles
Shift: Speed boost
The coaster automatically ejects the driver if crashed into a wall.
How to spawn:
1: Spawn the coaster car prop.
2: Spawn a chair.
3: Nocollide the chair to the prop, position it, and weld it.
4: Dupe this with the normal duplicator tool.
5: Spawn as many other cars as you want using duplicator.
6: Spawn an adv pod controller, and link it to the chair. (On the main car. The first one.)
7: Use the Wirelink tool on the Adv pod controller
8: Spawn the E2 (On the main car. The first one.)
9: Wire "Pod [Wirelink]" to the Adv pod controller's new Wirelink output, and Active to Active.
10 Get in and drive!
NOTE: If you spawn new cars, you need to update the E2 so that it finds them.
Video/Pictures: Use fullscreen mode!
Lollercoaster - Xfire Video


Additional Credits To: - FlieBoy101 for giving me the idea (He has also made one just like this)
Code:
Code:
@name Lollercoaster
@inputs Pod:wirelink Active
@persist [Pos Ang Cars]:array CurPos:vector Quat:quaternion N N2 Count
@trigger
if (first()|duped()) {
####
# Lollercoaster
# Made by Divran
# http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
####
concmd("say Lollercoaster - Made by Divran")
for(I=1,2) {
holoCreate(I)
holoModel(I,"hqicosphere2")
holoMaterial(I,"models/debug/debugwhite")
holoColor(I,vec(75,75,75))
holoScale(I,vec(5,5,5)/12)
holoEntity(I):removeTrails()
holoEntity(I):setTrails(4,2,6,"cable/cable2",vec(),255)
holoAlpha(I,0)
}
for(I=3,30) {
holoCreate(I)
holoMaterial(I,"models/debug/debugwhite")
holoColor(I,vec(100,30,0))
holoScale(I,vec(5,45,2)/12)
holoAlpha(I,0)
}
findIncludePlayerProps(owner())
findByModel("models/XQM/coastertrain2seat.mdl")
findSortByDistance(entity():pos())
Cars = findToArray()
for(I=1,Cars:count()) {
if (Cars[I,entity]:mass() != 50000) {Cars[I,entity]:setMass(50000)}
}
}
runOnTick(Active)
if (~Active) {
if (Active) {
Quat = quat(Cars[1,entity])
Pos[1,vector] = Cars[1,entity]:pos() + vec(0,0,20)
for(I=1,30) {holoAlpha(I,255), holoPos(I,vec())}
for(I=1,Cars:count()) {
Cars[I,entity]:soundPlay(I,0,"vehicles/fast_windloop1.wav")
}
} else {
Pos = array()
Ang = array()
soundPurge()
for(I=1,Cars:count()) {
Cars[I,entity]:applyForce(-Cars[I,entity]:vel()*Cars[I,entity]:mass())
}
Pod["Eject",number] = 0
for(I=1,30) {holoAlpha(I,0)}
}
}
if (Active) {
#Get controls
W = Pod["W",number]
A = Pod["A",number]
S = Pod["S",number]
D = Pod["D",number]
M1 = Pod["Mouse1",number]
M2 = Pod["Mouse2",number]
Shift = Pod["Shift",number]
R = Pod["R",number]
#WASD Controls
P2 = qRotation(Quat:right(),(S-W)*(1+Shift))
Y2 = qRotation(Quat:up(),(A-D)*(1+Shift))
R2 = qRotation(Quat:forward(),(M2-M1)*(2+Shift*2))
Quat = (Y2*P2*R2) * Quat
#Arrays
Pos:unshiftVector(Pos[1,vector]+Quat:forward()*(8+Shift*20))
Ang:unshiftAngle(Quat:toAngle())
#Holograms
holoPos(1,Pos[1,vector]+Quat:right()*25)
holoPos(2,Pos[1,vector]-Quat:right()*25)
Dist = CurPos:distance(Pos[1,vector])
if (Dist > 50) {
CurPos = Pos[1,vector]
N++
if (N > 30) {N = 3}
holoPos(N,Pos[1,vector])
holoAng(N,Ang[1,angle])
}
#Align to ang(0,X,0)
if (R) {Quat = slerp(Quat,quat(ang(0,Quat:toAngle():yaw(),0)),0.06)}
if (Pos:count()>=50) {
#Ranger Check
rangerFilter(array(Cars[1,entity], Pod["Entity",entity]))
Rng = rangerOffset(100,Pos[50,vector],quat(Ang[50,angle]):forward())
if (Rng:hit()) {Pod["Eject",number] = 1}
}
for(I=1,min(5,Cars:count())) {
#Count
Count++
if (Count>Cars:count()) {Count = 1}
#Get E
E = Cars[Count,entity]
if (!E) {continue, Cars:remove(I)}
#Array Num
Num = 50+(Count-1)*30
if (Pos:count()<Num) {continue}
#Apply Torque
V = E:toLocal(rotationVector(quat(Ang[Num,angle])/quat(E))+E:pos())
E:applyTorque((V*800-E:angVelVector()*15)*E:inertia())
#Apply Force
E:applyForce(((Pos[Num,vector]-E:toWorld(E:boxCenter()-vec(0,0,20)))*10-E:vel())*E:mass())
#Clear Array
if (Count == Cars:count()) {Pos:remove(Num), Ang:remove(Num)}
soundPitch(Count,clamp(E:vel():length()/20,50,300))
}
}
Bookmarks