Here's my 'stay in place' code so far, unfortunately it doesn't work...
Code:
@name Music Chip V3.0
@persist Vector:vector E:entity CurPos:vector
#Timers and trails
Follow = 1
if(first())
{
runOnTick(1)
runOnChat(1)
entity():setTrails(7,1,1,"trails/tube",vec(255,255,255),200)
}
#If run on game ticks
if(tickClk())
{
if(entity():isConstrained()) {
E=entity():isConstrainedTo()
}
else {
E=entity()
}
Vector=owner():pos()-E:pos()+vec(0,0,100)
E:applyForce(1*(2*Vector+30*$Vector))
}
#When something is said
if(chatClk(owner())){
Said = owner():lastSaid():lower()
if(Said:find("/music_disco")){
hint("Music: HL1 Disco Remix", 5)
entity():soundPlay(1,0,"music/HL1_song25_REMIX3.mp3")
}
}
#When something is said
if(chatClk(owner())){
Said = owner():lastSaid():lower()
if(Said:find("/music_stillalive")){
hint("Music: Still Alive", 5)
entity():soundPlay(1,0,"music/portal_still_alive.mp3")
}
if(chatClk(owner())){
Said = owner():lastSaid():lower()
if(Said:find("/music_rock")){
hint("Music: Combine Theme", 5)
entity():soundPlay(1,0,"music/hl2_song15.mp3")
}
}
if(Said:find("/nomusic")){
hint("Music off", 5)
soundStop(1)
}
}
if(Said:find("/stay")){
Follow = 0
hint("Staying at current world position", 5)
CurPos = E:pos()
}
if(Follow == 0){
if(tickClk())
{
if(entity():isConstrained()) {
E=entity():isConstrainedTo()
}
else {
E=entity()
}
E:applyForce(1*(1*CurPos*$CurPos))
}
}
Bookmarks