trigger = getent("train_trig","targetname"); //trigger that calls train train = getEnt("train", "targetname"); //train that moves door = getEnt("door", "targetname"); //door that moves
trigger UseTriggerRequireLookAt(); trigger SetCursorHint( "HINT_NOICON" ); trigger setHintString("The power must be activated first"); //remove line if you want it to work without power flag_wait( "electricity_on" ); //remove line if you want it to work without power trigger SetHintString( "Press &&1 to Call Train" ); //what the trigger tells the players
trigger waittill ("trigger"); trigger delete();
players = get_players(); for( i = 0; i < players.size; i++ ) players[i] playsound("trainhorn"); //sound that plays when train is called (sound file NOT included in tutorial)
wait 1;
train moveX (-800, 3);
wait 7;
players = get_players(); for( i = 0; i < players.size; i++ ) players[i] playsound("door_slide_open"); //if you open a door/area with or after object has moved
door moveZ (-300, 1);
wait 10;
door delete(); //door or debris that is no longer seen be the player
}
Build mod and make sure that the new train_move.gsc file is checked Compile like usual
Is there also a way to make the train keep moving? like it stops at a station and then you can use it again? and make it buyable? (making it buyable is probably very easy )
Is there also a way to make the train keep moving? like it stops at a station and then you can use it again? and make it buyable? (making it buyable is probably very easy )
I just updated the tutorial and added a buyable script...
As for using it again all you have to do is repeat the script changing ONLY the targetname of the trigger... However in doing this There are some things you'll have to work out... if the player hasn't triggered the first trigger then the train will only move so far. What I mean is... if you're trying to move the train on down the tracks from the first trigger, then the player will need to use the first trigger FIRST to get the train in the right position to use the next trigger. (hope that makes sense)
Add another script model of a train car(or whatever you are using). Give it it's own targetname (ex:train2)
Then add it to the .gsc
Code Snippet
Plaintext
train2 = getEnt("train2", "targetname");
Also make it move with the 1st train script model.
Code Snippet
Plaintext
train moveX (-800, 3); train2 moveX (-800, 3);
Will that work like on zombie train? Where you had one train come in by activating the first switch, then later you activate the other switch and another train comes in? Also could you post the soundaliases for the "trainhorn" sound? I already have a custom sound made but the sound aliases I tried to use wouldn't convert the sound
Hey so a question for someone. I have added all my stuff into radiant and made my self my rocket_move.gsc file. compiled my map and mod just fine but when I go to launch my game now I get a [ server script compile error uninitialized variable 'rocket' ] is this because I have used a prefab (made my rocket and saved it as a .map file) instead of a script_brushmodel?? and I still also don't have any sounds that I have added?? would any of that cause this error? thanks in advance.
trigger = getent("rocket_trig","targetname"); //trigger that calls rocket train = getEnt("rocket", "targetname"); //rocket that moves door = getEnt("door", "targetname"); //door that moves
trigger UseTriggerRequireLookAt(); trigger SetCursorHint( "HINT_NOICON" ); trigger setHintString("The power must be activated first"); //remove line if you want it to work without power flag_wait( "electricity_on" ); //remove line if you want it to work without power trigger SetHintString( "Press &&1 to launch the Rocket" ); //what the trigger tells the players
trigger waittill ("trigger"); trigger delete();
players = get_players(); for( i = 0; i < players.size; i++ ) players[i] playsound("trainhorn"); //sound that plays when train is called (sound file NOT included in tutorial)
wait 1;
rocket moveZ (1100, 3);
wait 7;
players = get_players(); for( i = 0; i < players.size; i++ ) players[i] playsound("door_slide_open"); //if you open a door/area with or after object has moved
door moveY (-300, 1);
wait 10;
door delete(); //door or debris that is no longer seen be the player
}
Then for the script I just changed all the "train" words to fit my map with "rocket" and also renamed my .gsc file to rocket_move.gsc
thanks buddy that was my problem!!! last question. so I have found a rocket sound file that I found on IE and I have it in .mp3 and .wav. (guessing its the .wav file since thats what I needed for the jukebox songs I added) just wondering how I go about adding that sound file so that it corresponds with my rocket launch... sorry it wasn't in the tut above from grantdaddy. do I just throw that .wav into MAPNAME/sounds then add the .wav name to my rocket_move.gsc
So here with another question. I have everything going good and map compiled. But then I go and hit my trigger my rocket dosent move. but yet my corresponding door opens a little after 9like it should).. Why no rocket launch?? At first I made a rocket and made it a prefab by saving it as a .map (no luck) I then made all my brushes script_brushmodels (no luck). do I need a actual script_model for it to work?? In the tut video you state it must be a script_model but I cant seem to make it one just a script_brushmodel? Any help would be great!
Last Edit: March 07, 2014, 12:41:38 am by iBarnett
So here with another question. I have everything going good and map compiled. But then I go and hit my trigger my rocket dosent move. but yet my corresponding door opens a little after 9like it should).. Why no rocket launch?? At first I made a rocket and made it a prefab by saving it as a .map (no luck) I then made all my brushes script_brushmodels (no luck). do I need a actual script_model for it to work?? In the tut video you state it must be a script_model but I cant seem to make it one just a script_brushmodel? Any help would be great!
This might be because you did not make the model A script model most of the time that why this happens. if you want to make it a scirpt model then, right cick on the model then do SCRIPT-MODEL then that's it