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,119 views
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

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
     

       

}


If you want it to cost money to use the trigger and make the train move then use this:

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

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

UPDATE
Script Brushmodels Video:
http://youtu.be/m5MwxZj6-PE

Last Edit: March 08, 2014, 02:21:55 pm by GrantDaddy007
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
Your zombie pathing on the script_brushmodel did not work even with DYNAMICPATH, because you are never calling
Code Snippet
Plaintext
brushmdl ConnectPaths();
in your script to actually make the paths connect.

- Phil.
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
Your zombie pathing on the script_brushmodel did not work even with DYNAMICPATH, because you are never calling
Code Snippet
Plaintext
brushmdl ConnectPaths();
in your script to actually make the paths connect.

- Phil.

Very cool! That makes sense.

Thanks bro!  8)
Last Edit: February 03, 2014, 01:01:36 am by GrantDaddy007
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
cool, might use this in my next map :D
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 29 July 2013
Last active: 5 months ago
Posts
27
Respect
Forum Rank
Legless Crawler
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
greenlungs81's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
will this work with a script brush model
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
It even says in the title that it does  ;)

- 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?
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
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
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 have to add
Code Snippet
Plaintext
door ConnectPaths();
before this:
Code Snippet
Plaintext
door moveZ (-300, 1);
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:
Code Snippet
Plaintext
trigger UseTriggerRequireLookAt();
Code Snippet
Plaintext
door_flag = trigger.script_flag;
if(IsDefined(door_flag))
    flag_init(door_flag);
And before the MoveZ() I posted above, add:
Code Snippet
Plaintext
if(IsDefined(door_flag))
    flag_set(door_flag);

- Phil.
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
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! :P

Post Merge: February 23, 2014, 12:13:45 am
YaPhil beat me too it....   :P
Last Edit: February 23, 2014, 12:14:14 am by GrantDaddy007
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
how would you do more than one train?
broken avatar :(
×
broken avatar :(
Constants and Variables
Location: us
Date Registered: 18 August 2013
Last active: 2 years ago
Posts
889
Respect
Forum Rank
The Decider
Primary Group
Box Mappers Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
The Worst Secret Agent Ever
Signature
×
MAK911's Groups
Box Mappers Elite
Box Mappers Elite
Banned Elite
Banned Elite
MAK911's Contact & Social Linksmkramrtmkramrt
Found this link. Might help with the explosion. http://modsonline.com/Tutorials-read-580.html
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
how would you do more than one train?
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);

   
broken avatar :(
×
broken avatar :(
Location: usTravelers Rest
Date Registered: 24 September 2012
Last active: 6 years ago
Posts
385
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Letting Zombies eat my brains since 82
Signature
×
Zombiejelly's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Zombiejelly's Contact & Social LinksZombiejelly115Zombiejelly115@BradtimmsZombiejelly
wow this is a really nice tutorial
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);

   

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 pm
also 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
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
yes you would have to add the same targetname to the box that u used on your train.

 
Loading ...