UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

GrantDaddy007's Scripting Tutorials

HOT
broken avatar :(
Created 10 years ago
by GrantDaddy007
0 Members and 1 Guest are viewing this topic.
17,152 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 8 January 2014
Last active: 6 years ago
Posts
840
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Embers are the new lens flares
×
chromastone10's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
chromastone10's Contact & Social Linkschromastone10chromastone1chromastone10

Requested Tutorial

Alright guys... This is my first time doing something like this so Hopefully I do it right and it's helpful!!!

How to make Models/Brushmodels Move (Trains in Zombie Train)


http://youtu.be/d27ySm6P9n0



Radiant

Create a script model and call it:
Code Snippet
Plaintext
targetname
Code Snippet
Plaintext
train

Create a trigger_use and call it:
Code Snippet
Plaintext
targetname
Code Snippet
Plaintext
train_trig

Create a script brushmodel and call it:
Code Snippet
Plaintext
targetname
Code Snippet
Plaintext
door

That's it for the radiant side of things...



Scripts

Place in your Mapname.gsc after maps\_zombiemode::main();
Code Snippet
Plaintext
level thread maps\train_move::main(); //calls the train_move.gsc

Create .GSC file in you root/mods/mapname/maps folder and call it train_move.gsc
Here's the script that goes in train_move.gsc

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_zombiemode_utility;
#include maps\_utility;
main()
{


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 :P)
broken avatar :(
×
broken avatar :(
Location: usNC
Date Registered: 19 June 2013
Last active: 7 years ago
Posts
261
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Mapper Elite
My Groups
More
My Contact & Social Links
More
×
GrantDaddy007's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
GrantDaddy007's Contact & Social LinksGrantDaddyGrantdaddy007
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 :P)

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)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 8 January 2014
Last active: 6 years ago
Posts
840
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Embers are the new lens flares
×
chromastone10's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
chromastone10's Contact & Social Linkschromastone10chromastone1chromastone10
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
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
Did you try using the sound alies program that trem made?
broken avatar :(
×
broken avatar :(
Location: caCranbrook
Date Registered: 1 June 2013
Last active: 11 months ago
Posts
334
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombies?
Signature
http://www.speedtest.net/result/3950067582.png

WaW - Nazi_zombie_candyland/Nazi_zombie_ascension2.0  90%-95% (Not completed)
WaW - Nazi_zombie_meth/Nazi_zombie_lamanai  100% (complete)
WaW - Nazi_zombie_killswitch 100% (complete)
WaW - Nazi_zombie_pax 100%  (complete + UGX 1.1 edition)
BO3 - zm_epping_woods 80%
×
iBarnett's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
iBarnett's Contact & Social LinksiBarnettiBarnettiBarnettCorey Barnett
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.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
No, the error is caused by a fault in the script.

- Phil.
broken avatar :(
×
broken avatar :(
Location: caCranbrook
Date Registered: 1 June 2013
Last active: 11 months ago
Posts
334
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombies?
×
iBarnett's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
iBarnett's Contact & Social LinksiBarnettiBarnettiBarnettCorey Barnett
No, the error is caused by a fault in the script.

- Phil.

Maybe you could help me then. The only things I have changed is

Code Snippet
Plaintext
level thread maps\rocket_move::main();
//calls the rocket_move.gsc    - changed it from train_move to rocket_move

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_zombiemode_utility;
#include maps\_utility;
main()
{

     
     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


Last Edit: March 06, 2014, 06:33:28 pm by SajeOne
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
You forgot to change one of the trains to rocket
broken avatar :(
×
broken avatar :(
Location: caCranbrook
Date Registered: 1 June 2013
Last active: 11 months ago
Posts
334
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombies?
×
iBarnett's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
iBarnett's Contact & Social LinksiBarnettiBarnettiBarnettCorey Barnett
You forgot to change one of the trains to rocket
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
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
You need to create a soundalias and convert the sound. There are numerous tutorials for that  :)

- Phil.
broken avatar :(
×
broken avatar :(
Location: caCranbrook
Date Registered: 1 June 2013
Last active: 11 months ago
Posts
334
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombies?
×
iBarnett's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
iBarnett's Contact & Social LinksiBarnettiBarnettiBarnettCorey Barnett
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
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
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 :D
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
also make sure it has the right targetname
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
A script_brushmodel will work as well as a script_model. Just make sure the KVPs are okay.

- Phil.
broken avatar :(
×
broken avatar :(
Location: caCranbrook
Date Registered: 1 June 2013
Last active: 11 months ago
Posts
334
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombies?
×
iBarnett's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
iBarnett's Contact & Social LinksiBarnettiBarnettiBarnettCorey Barnett
Well that's good it can be a script_brushmodel because it will not let me make my brushes just a script_model. And as for the kvp's theres only one!
Code Snippet
Plaintext
targetname - rocket
for my script_brushmodel

don't know what else to check!!

Code Snippet
Plaintext
targetname - rocket_trig
for my trigger_use


 
Loading ...