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
}
If you want it to cost money to use the trigger and make the train move then use this:
cost = 1000; //you can change this to whatever who = undefined; 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 move train[Cost: "+cost+"]");
while(1) { trigger waittill("trigger",who);
// got the money ?? if(who.score >= cost) { who maps\_zombiemode_score::minus_to_player_score(cost);
trigger playsound("cha_ching");
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
} else { trigger playsound("no_cha_ching");
} wait 0.15; }
}
Build mod and make sure that the new train_move.gsc file is checked Compile like usual
So a quick question for ya. I'm going to redo candyland again since I can actually do things way better then when I first made it. And seeing this tut inspired me to make the rocket actually launch. So I have the rocket moving and the corresponding door to open once launched. Thing is I need a rocket sound and maybe making it explode like in ascension if shot. Not great at scripting yet so maybe if u have idea or something would be great. Thanks man. Good tut also. Sorry one more thing is where do I add the connect path function that ya ph1l posted so it becomes a dynamic path and zombies will enter that area. Also if that door is is to activate a new zone would I need to add a kvp to the trigger?
Last Edit: February 22, 2014, 07:36:55 pm by iBarnett
As for the zones, a KVP alone won't do anything. You need code that uses the KVP. To make the script_flag KVP work like on normal debris, add this before:
So a quick question for ya. I'm going to redo candyland again since I can actually do things way better then when I first made it. And seeing this tut inspired me to make the rocket actually launch. So I have the rocket moving and the corresponding door to open once launched. Thing is I need a rocket sound and maybe making it explode like in ascension if shot. Not great at scripting yet so maybe if u have idea or something would be great. Thanks man. Good tut also. Sorry one more thing is where do I add the connect path function that ya ph1l posted so it becomes a dynamic path and zombies will enter that area. Also if that door is is to activate a new zone would I need to add a kvp to the trigger?
Cool bro! Glad I sparked an idea for you!
There are several ways you can go about making the rocket explode if shot. I've never done it so the best I can do is tell you to do some research on "trigger damage". See what you can find about adding FX with that.
As for the connect paths I got this from another thread on here that Yaphil answered. In the script you can see how Yaphil uses the connect path function:
Code Snippet
Plaintext
door = GetEnt("tiki_door", "targetname"); door NotSolid(); door ConnectPaths(); door MoveZ(-200, 2); door waittill("movedone"); door Delete();
For Rocket sounds there are several free sound sites out there that are user submitted without copyrights.
Hope this was helpful!
Cheers! Post Merge: February 23, 2014, 12:13:45 amYaPhil beat me too it....
Last Edit: February 23, 2014, 12:14:14 am by GrantDaddy007
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);
thanks, if you would like to see what it will be used for you can watch the video on this page http://ugx-mods.com/forum/index.php?topic=2095.0 Post Merge: March 04, 2014, 11:52:41 pmalso would there be a way to like call a train and have it bring a mystery box on it? I feel like if I just added the train then put a mystery box in it the box would just be left behind and be floating where the train was
Last Edit: March 04, 2014, 11:52:41 pm by chromastone10