UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: Dust on September 16, 2015, 06:02:07 pm

Title: [Tutorial] Players "deposit" points to open a door. Will scale to players size
Post by: Dust on September 16, 2015, 06:02:07 pm
PURPOSE:
This is a simple tutorial that will add a door so the players can deposit points to it to open it, and you can also change it to have it cost more depending on how many players are in the map. This is the script I made for Undead Overkill, map by PCModder.

SCRIPT:
1. Open up your mapname.gsc, towards the middle of the file, you will see
Code Snippet
Plaintext
maps\_zombiemode::main();
UNDER it paste this in
Code Snippet
Plaintext
thread deposit_door();

2. At the bottom of the file, paste this into it

Code Snippet
Plaintext
door()
{
level.deposited_points = 0; //this will go up as the players deposit the points
level.amount_required = 1000; //this will be how much the players need to get if playing solo
players = get_players();
if(players.size == 2) //if 2 players are in the map
{
level.amount_required = 2000; //Change this to how much you want it to be for 2 players
}
if(players.size == 3) //if 3 players are in the map
{
level.amount_required = 3000; //Change this to how much you want it to be for 3 players
}
if(players.size == 4) //if 4 players are in the map
{
level.amount_required = 4000; //Change this to how much you want it to be for 4 players
}
level.deposit = 1000; //this is how much the players deposit at a time
door = getent("door","targetname"); //door in radiant
door_clip = getent("door_clip","targetname"); //clip around door in radiant
door_trig = getent("door_trig","targetname"); //trigger in radiant
door_trig SetCursorHint("HINT_NOICON"); //Getting rid of hand symbol
door_trig SetHintString("Press &&1 to deposit "+level.deposit+ " points, Total Cost: " +level.amount_required); //hint string that the players will see, feel free to change it
while(1) //while loop so players can activate it more than once
{
wait 0.1;
door_trig waittill("trigger",player);
if(player.score >= level.deposit)
{
player maps\_zombiemode_score::minus_to_player_score( level.deposit );
level.deposited_points = level.deposited_points + level.deposit;
iprintlnbold("You have deposited " +level.deposited_points+ " out of " +level.amount_required);

if(level.deposited_points >= level.amount_required)
{
door_trig delete();
door_clip delete();
door delete();
door connectpaths();
flag_set("enter_zone1"); //change this to whatever your zone is called
}
}
}
}

You will see some variables at the top.
Only thing you should worry about is the
Code Snippet
Plaintext
level.amount_required
. That is where you will put how many points the players need to deposit to open the door. I left some comments in so you know which one to change to make it for solo,2 player, 3 player, or 4 player.
You can also change the
Code Snippet
Plaintext
level.deposit
if you want. That is how much the players can deposit at 1 time, default is 1000 points.
Code Snippet
Plaintext
flag_set("enter_zone1");
That is the name of the flag for the zone you are entering, it is set up the same way as a normal zone, so make sure it matches the zone that you are entering.

RADIANT:

1. Make a new door in radiant, make sure its a script_brushmodel. Give it the KVP: Key: targetname, Value: door. Make sure Dynamic Path is checked!
2. Make a clip that is also a script_brushmodel, give it the KVP: Key: targetname, Value:door_clip. Make sure dynamic path is checked!
3. Make a trigger_use around the door, give it the KVP: Key, targetname, Value:door_trig

FINAL:
Compile map, and build mod and your done!
Please give me credit if you use this script
If you have any questions, don't hesitate to ask
Title: Re: [Tutorial] Players "deposit" points to open a door. Will scale to players size
Post by: Ramiabdh on September 16, 2015, 06:49:19 pm
Awesome tut man. :D This will bring about some cool challenges.
Title: Re: [Tutorial] Players "deposit" points to open a door. Will scale to players size
Post by: Tim Smith on September 17, 2015, 11:32:17 am
good work :D i surely find a use of this
Title: Re: [Tutorial] Players "deposit" points to open a door. Will scale to players size
Post by: kitos on August 05, 2017, 09:10:59 am
this is with souls to open door? or only is deposit point to open? im searching how to do deposit to open the trigger but not with points with zombie souls like this video:

http://www.youtube.com/watch?v=Gs5TxKedWuU (http://www.youtube.com/watch?v=Gs5TxKedWuU)

the souls go to the door and when they take souls the door is open can you help me? please?