UGX-Mods

Call of Duty 5: World at War => Help Desk => Topic started by: pashan on March 31, 2014, 01:35:44 am

Title: Script Help Check if Statements
Post by: pashan on March 31, 2014, 01:35:44 am
How do i script to tell the computer to make a trigger activable if a certain trigger has been activated?
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 01:46:22 am
first disable the trigger at the very start of the function with
Code Snippet
Plaintext
disable_trigger();
and after the player use the first trigger set a falg like this
Code Snippet
Plaintext
flag_set("stop_wait");
and make the trigger that you disabled to wait till the flag has been set up to show it to the players like
Code Snippet
Plaintext
flag_wait("stop_wait");
enable_trigger();
it would be easier to understand if you could post your code to make the required changes
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 01:55:49 am
first disable the trigger at the very start of the function with
Code Snippet
Plaintext
disable_trigger();
and after the player use the first trigger set a falg like this
Code Snippet
Plaintext
flag_set("stop_wait");
and make the trigger that you disabled to wait till the flag has been set up to show it to the players like
Code Snippet
Plaintext
flag_wait("stop_wait");
enable_trigger();
it would be easier to understand if you could post your code to make the required changes

what if i have multiple triggers to disable and enable:

What i mean:

( player uses trigger 1 = makes trigger 2 usable
 player uses trigger 2 = makers trigger 3 usable

and so on.....)

can i keep on changing "stop_wait"

to stop_wait_two

stop_wait_three

and so on..... ?!?!

Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 01:58:34 am
everytrigger must wait for the last trigger to notify the flag. yeah you should be fine
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 02:00:20 am
Yes, you can set it up to do that.
Personally I wouldn't use flags, I would just set it up like this:
Code Snippet
Plaintext
trigger1 waittill("trigger", player);
// do stuff
trigger2 waittill("trigger", player);
// do stuff
trigger3 waittill("trigger", player);
// do stuff
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 02:03:08 am
how would i make a trigger display a meassage
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 02:04:41 am
jbrid wouldnt that way the triggers stay active all the time?  ???

Code Snippet
Plaintext
trig SetHintString( "YOLO!!!\o/" );
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 02:05:22 am
jbrid wouldnt that way the triggers stay active all the time?  ???
you hide them and show them where I said "do stuff"
also to set the hintstring you simply put:
Code Snippet
Plaintext
trigger1 SetHintString( "What ever you want it to say" );
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 02:07:19 am
you hide them and show them where I said "do stuff"
also to set the hintstring you simply put:
Code Snippet
Plaintext
trigger1 SetHintString( "What ever you want it to say" );
well i prefer using flags cause i've had bad memories using waittill player but i think it might work the same  :o
if you want the hint string to have something like "press F" you put
Code Snippet
Plaintext
press &&1
inside the hinstring, also if ou want the text to be yellow you put
Code Snippet
Plaintext
press ^3&&1^7
ex:
Code Snippet
Plaintext
    level.storagecost = 500; 		
trig setHintString("Press ^3&&1^7 to store your weapon["+level.storagecost+"]");
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 02:08:09 am
well i prefer using flags cause i've had bad memories using waittill player but i think it might work the same  :o
your way should work, however flags can be a bit buggy and not always work.
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 02:11:41 am
your way should work, however flags can be a bit buggy and not always work.
buggy?  :o i've never had problems with them and i like that you wait fotr the flag in another script :P
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 02:19:20 am
buggy?  :o i've never had problems with them and i like that you wait fotr the flag in another script :P
Well if I wanted something from another script to begin, then I would rather call it,
or use a level notify
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 02:32:14 am
well but thats just personal choice :P
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 02:36:56 am
well but thats just personal choice :P
The stuff I said about flags is not a personal choice, that is how the game engine works.
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 03:35:10 am
you hide them and show them where I said "do stuff"
also to set the hintstring you simply put:
Code Snippet
Plaintext
trigger1 SetHintString( "What ever you want it to say" );


dosn't sethintstring make if so when your near the trigger it will display a little message

then thing i want is a message to show up after i use the trigger (like an objective thing on the top left corner)
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 03:36:30 am
Code Snippet
Plaintext
 iprintln("what you want it to say");
Title: Re: Script Help Check if Statements
Post by: jjbradman on March 31, 2014, 03:38:57 am
use
Code Snippet
Plaintext
IPrintLn( "stuff?" );
or
Code Snippet
Plaintext
IPrintLnBold( "maybe?" );
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 03:52:09 am
i am a beginer to scripting:

I get a bad synatx error in this script

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;


ray_steps();
{

trigger_one = getent("s_one", "targetname");
trigger_one sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );

trigger waittill("trigger", players");
flag_set("stop_wait");
iprintln("onjective 1");

trigger delete();
}
{

disable_trigger();

trigger_two = getent("s_two", "targetname");
trigger_two sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );
flag_wait("stop_wait");
enable_trigger();

trigger waittill("trigger", players");
flag_set("stop_wait_two");
iprintln("onjective 2");

trigger delete();

}

this is also a test script for a step by step easter egg to get a ray gun at the end
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 03:59:18 am
You ended the function and started a new new one with out a function name/function call?
Lines 18 and 19

Also when you said
Code Snippet
Plaintext
trigger delete();
it should be
Code Snippet
Plaintext
trigger_one delete();
(same with the second one)

When you tell the game to enable/disable a trigger you must put the trigger name that you want to enable/disable
example:
Code Snippet
Plaintext
trigger_one disable_trigger();
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 04:06:59 am
You ended the function and started a new new one with out a function name/function call?
Lines 18 and 19

Also when you said
Code Snippet
Plaintext
trigger delete();
it should be
Code Snippet
Plaintext
trigger_one delete();
(same with the second one)

When you tell the game to enable/disable a trigger you must put the trigger name that you want to enable/disable
example:
Code Snippet
Plaintext
trigger_one disable_trigger();

i did what you told me but i still get the same error

bad syntax
ray_steps();

Updated:

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;


ray_steps();
{

trigger_one = getent("s_one", "targetname");
trigger_one sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );

trigger waittill("trigger", players");
flag_set("stop_wait");
iprintln("onjective 1");

trigger_one delete();
}

ray_steps_two();
{

disable_trigger_two();

trigger_two = getent("s_two", "targetname");
trigger_two sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );
flag_wait("stop_wait");
enable_trigger();

trigger waittill("trigger", players");
flag_set("stop_wait_two");
iprintln("onjective 2");

trigger delete();

}
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 04:08:59 am
Didn't even notice that, you have a semicolon at the end of your function name
Code Snippet
Plaintext
ray_steps();
remove the semicolon
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 04:09:50 am
Didn't even notice that, you have a semicolon at the end of your function name
Code Snippet
Plaintext
ray_steps();
remove the semicolon

oh lol thanks for the help man

Post Merge: March 31, 2014, 04:19:25 am
it giving me another error now

bad syntax
trigger_two = getent("s_two", "targetname");

updated:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;


ray_steps()
{

trigger_one = getent("s_one", "targetname");
trigger_one sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );

trigger_one waittill("trigger_one", players);
flag_set("stop_wait");
iprintln("onjective 1");

trigger_one delete();
}

ray_steps_two()
{

disable_trigger_two()

trigger_two = getent("s_two", "targetname");
trigger_two sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );
flag_wait("stop_wait");
enable_trigger();

trigger_two waittill("trigger_two", players);
flag_set("stop_wait_two");
iprintln("onjective 2");

trigger_two delete();

}
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 04:33:07 am
This was probably going to go back and forth for a while so I just edited the code:
Code Snippet
Plaintext
ray_steps()
{
trigger_one = getent("s_one", "targetname");
trigger_one sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );
trigger_two = getent("s_two", "targetname");
trigger_two sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );

trigger_two Hide();
trigger_two disable_trigger();
trigger_one waittill("trigger", player);
iprintln("onjective 1");
trigger_one delete();
trigger_two thread ray_steps_two();
}

ray_steps_two()
{
self Show();
self enable_trigger();

self waittill("trigger", player);
iprintln("onjective 2");

self delete();
}
Like I said before, I prefer not using flags, so I instead called the second function from the first.
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 04:39:21 am
This was probably going to go back and forth for a while so I just edited the code:
Code Snippet
Plaintext
ray_steps()
{
trigger_one = getent("s_one", "targetname");
trigger_one sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );
trigger_two = getent("s_two", "targetname");
trigger_two sethinstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );

trigger_two Hide();
trigger_two disable_trigger();
trigger_one waittill("trigger", player);
iprintln("onjective 1");
trigger_one delete();
trigger_two thread ray_steps_two();
}

ray_steps_two()
{
self Show();
self enable_trigger();

self waittill("trigger", player);
iprintln("onjective 2");

self delete();
}
Like I said before, I prefer not using flags, so I instead called the second function from the first.

get an error

unknow function
trigger_one sethinstring (" Press and hold &&1 for Ray Gun ");

Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 04:44:18 am
add this stuff back to the top of the code:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;
Also how are you calling this code?
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 04:46:05 am
add this stuff back to the top of the code:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;
Also how are you calling this code?

i have this at the top of the code.

and in nazi_zombie_mapname.gsc

under

Code Snippet
Plaintext
maps\_zombiemode::main();

i have

Code Snippet
Plaintext
thread maps\ray::ray_steps();

ray.gsc is the name of the gsc i have the script in
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 04:49:34 am
Oh it was missing a 't'
Code Snippet
Plaintext
ray_steps()
{
trigger_one = getent("s_one", "targetname");
trigger_one sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );
trigger_two = getent("s_two", "targetname");
trigger_two sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );

trigger_two Hide();
trigger_two disable_trigger();
trigger_one waittill("trigger", player);
iprintln("onjective 1");
trigger_one delete();
trigger_two thread ray_steps_two();
}

ray_steps_two()
{
self Show();
self enable_trigger();

self waittill("trigger", player);
iprintln("onjective 2");

self delete();
}
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 04:53:03 am
sorry for bothering you but what if i wanted to add more triggers like 3 or 4 more
Title: Re: Script Help Check if Statements
Post by: Ege115 on March 31, 2014, 04:59:07 am
You make a new enity with the Getent stuff like this to lets say that we name it to trigger_three.
Code Snippet
Plaintext
trigger_three = getent("trigger_three", "targetname");
And then you have the different functions in your code you can choose from like,
Code Snippet
Plaintext
trigger_three hide();
And when you want the trigger to show,
Code Snippet
Plaintext
trigger_three show();
Title: Re: Script Help Check if Statements
Post by: JBird632 on March 31, 2014, 05:01:02 am
Code Snippet
Plaintext
ray_steps()
{
// Setting Up Triggers
trigger_one = getent("s_one", "targetname");
trigger_one sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );
trigger_two = getent("s_two", "targetname");
trigger_two sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_two setCursorHInt( "HINT_NOICON" );
trigger_three = getent("s_three", "targetname");
trigger_three sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_three setCursorHInt( "HINT_NOICON" );
trigger_four = getent("s_four", "targetname");
trigger_four sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_four setCursorHInt( "HINT_NOICON" );

// Hiding|Disabling Triggers
trigger_two Hide();
trigger_two disable_trigger();
trigger_three Hide();
trigger_three disable_trigger();
trigger_four Hide();
trigger_four disable_trigger();

// Trigger One
trigger_one waittill("trigger", player);
iprintln("onjective 1");
trigger_one delete();

// Enable Trigger Two
trigger_two Show();
trigger_two enable_trigger();

// Trigger Two
trigger_two waittill("trigger", player);
iprintln("onjective 2");
trigger_two delete();

// Enable Trigger Three
trigger_three Show();
trigger_three enable_trigger();

// Trigger Three
trigger_three waittill("trigger", player);
iprintln("onjective 2");
trigger_three delete();

// Enable Trigger Four
trigger_four Show();
trigger_four enable_trigger();

// Trigger Four
trigger_four waittill("trigger", player);
iprintln("onjective 2");
trigger_four delete();
}
I removed the second function, cause I didn't feel like making multiple functions which you would have to transfer the variables through
Title: Re: Script Help Check if Statements
Post by: pashan on March 31, 2014, 05:01:52 am
Thanks for the help guys imma credit all of you  on my next map thank you  :)

Post Merge: April 01, 2014, 12:49:12 am
Whats wrong with this script

Code Snippet
Plaintext
ray_steps()
{
// Setting Up Triggers
trigger_one = getent("s_one", "targetname");
trigger_one sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_one setCursorHInt( "HINT_NOICON" );
trigger_two = getent("s_two", "targetname");
trigger_two sethintstring("");
trigger_two setCursorHInt( "HINT_NOICON" );
trigger_three = getent("s_three", "targetname");
trigger_three sethintstring("");
trigger_three setCursorHInt( "HINT_NOICON" );
trigger_four = getent("s_four", "targetname");
trigger_four sethintstring("");
trigger_four setCursorHInt( "HINT_NOICON" );
trigger_five = getent("s_five", "targetname");
trigger_five sethintstring(" Press and hold &&1 for Ray Gun ");
trigger_five setCursorHInt( "HINT_NOICON" );

// Hiding|Disabling Triggers
trigger_two Hide();
trigger_two disable_trigger();
trigger_three Hide();
trigger_three disable_trigger();
trigger_four Hide();
trigger_four disable_trigger();
trigger_five Hide();
trigger_five disable_trigger();

// Trigger One
trigger_one waittill("trigger", player);
iprintln("Trying To get the Ray Gun, Shoot Sam for the Ray Gun");
trigger_one delete();

// Enable Trigger Two
trigger_two Show();
trigger_two enable_trigger();

// Trigger Two
trigger_two waittill("trigger", player);
iprintln("Its in the Box next Phd");
trigger_two delete();

// Enable Trigger Three
trigger_three Show();
trigger_three enable_trigger();

// Trigger Three
trigger_three waittill("trigger", player);
iprintln("Ha Ha, Not here, Ill give it to you if you if you shoot that female, she is sitting on the couch");
trigger_three delete();

// Enable Trigger Four
trigger_four Show();
trigger_four enable_trigger();

// Trigger Four
trigger_four waittill("trigger", player);
iprintln("Good Job, Go get the Ray Gun its in the filing cabinate.");
trigger_four delete();

// Enable Trigger Five
trigger_five Show();
trigger_five enable_trigger();

// Trigger Five
trigger_five waittill("trigger", player);
iprintln("Here ya go - Pashan");
{
current_weapon = players getCurrentWeapon();
weapon_list = players GetWeaponsListPrimaries();

if(isdefined(current_weapon) && weapon_list.size > 1)
{
players TakeWeapon( current_weapon );
}

players GiveWeapon( "ray_gun" );
players SwitchToWeapon( "ray_gun" )
}

trigger_five delete();



}

getting bad syntax

}
Title: Re: Script Help Check if Statements
Post by: SajeOne on April 01, 2014, 03:07:11 am

dosn't sethintstring make if so when your near the trigger it will display a little message

then thing i want is a message to show up after i use the trigger (like an objective thing on the top left corner)
If you are creating objectives use the objective functions which can be found here:

http://www.zeroy.com/script/ (http://www.zeroy.com/script/) (look under objective)

Specifically: "objective_add()", "objective_delete()", and "objective_state()"

If you just want to print something the way an objective would outside of an objective context you can use the function:

Code Snippet
Plaintext
iprintln("Text");

Do not apply this function to all players if you are using a trigger though. When my friend presses a trigger in the game, almost always I don't need to see it as I wasn't the person who pressed it. For this you can use something such as:

Code Snippet
Plaintext
trigger waittill("trigger", player);
player iprintln("You just pressed that button");