The thing i am trying to do is teh player has to complete teh connection of teh power before teh player can acttivate the power.
The player can press teh connection trigger in any order. So basicly the player presses a trigger (which is on the power (in this script it is power_notify)) and a message shows. Then the player has to go around the map fix teh connection (teh con trigger (there will be 3 of them)) and then the player can activate teh trigger.
one thing i noticed while quickly looking over it, you dont have a loop in it and it only does +1 once.. so it'll never reach the var 2 or 3 like that. Put it in a loop is the easiest way to make that work, but you need to setup your triggers in an array otherwise it would be hard to make it a random order i think..
one thing i noticed while quickly looking over it, you dont have a loop in it and it only does +1 once.. so it'll never reach the var 2 or 3 like that. Put it in a loop is the easiest way to make that work, but you need to setup your triggers in an array otherwise it would be hard to make it a random order i think..
but there are 3 triggers around the map. Post Merge: July 25, 2014, 10:00:32 pm
Well your code is not setup to use an array, basically you cannot call something on an array since it holds a bunch of things, you need to call stuff on the specific part of the array (ie: power_switch_trigger[0] - 0 being the first trigger and use 1 for second and 2 for third).
There's a couple other things wrong with your code, but I need leave now, hopefully the others can help you.
power = getEnt("use_power_switch", "targetname"); power disable_trigger();
level.connection = 0;
start = getEnt("start", "targetname"); start sethintstring("Press and Hold &&1 to Turn on Power"); con = GetEntArray("con", "targetname"); con sethintstring("Press and Hold &&1 To Connect"); con setCursorHInt( "HINT_NOICON" ); con disable_trigger();
start waittill("trigger", player); con enable_trigger(); iprintln("3 interuptions in Connection");
con waittill("trigger", player); level.connection += 1;
for(;;) {
if (level.connection == 1) { iprintln("One Connection Fixed");
}
if (level.connection == 2) { iprintln("Two Connections Fixed");
}
if (level.connection == 3) { iprintln("Connections Fixed"); power enable_trigger(); power_switch_trig enable_trigger();
} } }
Could someone fix this code for me or may write me a new one, so i can learn from the script.
Hoping this is what you want. In dlc3_code.gsc find the function
Code Snippet
Plaintext
power_electric_switch() { // Code }
and replace it with
Code Snippet
Plaintext
power_electric_switch() { level.Connection = 3; // Amount of triggers. Since you have 3 before power, 3 is set. trig = getent("use_power_switch","targetname"); master_switch = getent("power_switch","targetname"); master_switch notsolid(); trig sethintstring(&"ZOMBIE_ELECTRIC_SWITCH");
Connection = GetEntArray( "con", "targetname" ); // Trigger of some sort with the targetname of con for( i = 0; i < Connection.size; i++ ) Connection[i] thread ConnectionTrigs( trig );
ConnectionTrigs( Trig ) { // Use the code commented below if you want user to hit the main switch first // Trig waittill( "trigger", user ); // Use commented code below for a hintstring message // self SetHintString( "Connection Interrupted" ); self SetCursorHint( "HINT_NOICON" ); self waittill( "trigger", user ); level.Connection--; user iprintln( level.Connection + " connections left to go" ); self delete(); }
power = getEnt("use_power_switch", "targetname"); power SetCursorHint( "HINT_NOICON" ); start = getEnt("power_notify", "targetname"); start SetCursorHint( "HINT_NOICON" ); con = getEnt("con", "targetname"); con SetCursorHint( "HINT_NOICON" );
thread power_thinking(power, "Press and Hold &&1 To Attempt The Puzzle"); thread power_thinking(start, "Press and Hold &&1 To Attempt The Puzzle"); thread power_thinking(con, "Press and Hold &&1 To Attempt The Puzzle"); }
power_thining(trigger, hint){ for(;;){ if(level.connection < 4 - 1){ // makes sure itll be 3 if(level.connection == 3 - 1){ trigger SetHintString("Press and Hold &&1 To Solve The Puzzle"); } else { trigger SetHintString(hint); } trigger waittill("trigger", player); player disableWeapons(); player freezeControls(true); done_time = 4.5; time = 0; bar = player createPrimaryProgressBar(); bar updateBar( 0.01, 1 / done_time ); bar.color = ( .5, 1, 1 ); while(player useButtonPressed()){ wait(.5); time++; //play_sound_at_pos("", trig); if ( player maps\_laststand::player_is_in_laststand()){ break; } if(time - .5 >= done_time ){ level.connection++; trigger delete(); break; } wait(.5); } } else { power_switch_trig enable_trigger(); } } }
Hoping this is what you want. In dlc3_code.gsc find the function
Code Snippet
Plaintext
power_electric_switch() { // Code }
and replace it with
Code Snippet
Plaintext
power_electric_switch() { level.Connection = 3; // Amount of triggers. Since you have 3 before power, 3 is set. trig = getent("use_power_switch","targetname"); master_switch = getent("power_switch","targetname"); master_switch notsolid(); trig sethintstring(&"ZOMBIE_ELECTRIC_SWITCH");
Connection = GetEntArray( "con", "targetname" ); // Trigger of some sort with the targetname of con for( i = 0; i < Connection.size; i++ ) Connection[i] thread ConnectionTrigs( trig );
ConnectionTrigs( Trig ) { // Use the code commented below if you want user to hit the main switch first // Trig waittill( "trigger", user ); // Use commented code below for a hintstring message // self SetHintString( "Connection Interrupted" ); self waittill( "trigger", user ); level.Connection--; user iprintln( level.Connection + " connections left to go" ); self delete(); }
Game freezes when u turn on the power and nothing happens when u hit the con triggers.
power = getEnt("use_power_switch", "targetname"); power SetCursorHint( "HINT_NOICON" ); start = getEnt("power_notify", "targetname"); start SetCursorHint( "HINT_NOICON" ); con = getEnt("con", "targetname"); con SetCursorHint( "HINT_NOICON" );
thread power_thinking(power, "Press and Hold &&1 To Attempt The Puzzle"); thread power_thinking(start, "Press and Hold &&1 To Attempt The Puzzle"); thread power_thinking(con, "Press and Hold &&1 To Attempt The Puzzle"); }
power_thining(trigger, hint){ for(;;){ if(level.connection < 4 - 1){ // makes sure itll be 3 if(level.connection == 3 - 1){ trigger SetHintString("Press and Hold &&1 To Solve The Puzzle"); } else { trigger SetHintString(hint); } trigger waittill("trigger", player); player disableWeapons(); player freezeControls(true); done_time = 4.5; time = 0; bar = player createPrimaryProgressBar(); bar updateBar( 0.01, 1 / done_time ); bar.color = ( .5, 1, 1 ); while(player useButtonPressed()){ wait(.5); time++; //play_sound_at_pos("", trig); if ( player maps\_laststand::player_is_in_laststand()){ break; } if(time - .5 >= done_time ){ level.connection++; trigger delete(); break; } wait(.5); } } else { power_switch_trig enable_trigger(); } } }