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

Power Puzzle Connection attempt (failing)

HOT
broken avatar :(
Created 12 years ago
by pashan
0 Members and 1 Guest are viewing this topic.
6,234 views
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
Signature
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
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.


This is my failed attempt at scripting something;

Code Snippet
Plaintext
power_job()
{
power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch_trig disable_trigger();

power = getEnt("use_power_switch", "targetname");
power disable_trigger();


level.connection = 0;

start = getEnt("power_notify", "targetname");
con = getEnt("con", "targetname");
con disable_trigger();



start waittill("trigger", player);
con enable_trigger();
iprintln("3 interuptions in Connection");

con waittill("trigger", player);
level.connection += 1;





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();

}
}

Is there any thing you can do to fix it? or is there a better way i can make something like this?
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
not quite sure what your meaning by puzzle. do you mind making an  image or describing it better?
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
not quite sure what your meaning by puzzle. do you mind making an  image or describing it better?

I made a mistake by putting puzzle in there. but here is a pic to better explain it:


So the players have to fix the "broken Connections" to complete the cycle.

And the players can fix the connections in any order.

Do you know what i mean now?
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
so they just have to fix the power stuff? seems easy enough. want it to have a progressbar like a buildable in tranzit?
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
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..
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
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
so they just have to fix the power stuff? seems easy enough. want it to have a progressbar like a buildable in tranzit?

if you teach me how. But first i would like it to work regular
Last Edit: July 25, 2014, 10:00:33 pm by pashan
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
Signature
Overrun
Lockdown
Overrun (Black Ops Mod)
Snowglobe
Leviathan
Abandoned School
Ski Resort
Leviathan Redux
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
but there are 3 triggers around the map.
He means that you need to get all three triggers into an array, not just a variable.
Code Snippet
Plaintext
GetEntArray("","targetname");
// instead of:
GetEnt("","targetname");
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
now the power is turn onable before i even press any other triggers  :'(
broken avatar :(
×
broken avatar :(
RadihaX
Location: caCanada
Date Registered: 2 September 2012
Last active: 5 years ago
Posts
978
Respect
Forum Rank
The Decider
Primary Group
Mapper Elite
My Groups
More
My Contact & Social Links
More
×
JBird632's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Mapper Elite Has shown excellence and experience in the area of custom mapping in the UGX-Mods community.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
JBird632's Contact & Social LinksJBird632JBird632JBird632JBird632JBird632Mapper
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.
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Here is my updated script...... Every thing in game is the same;

Code Snippet
Plaintext
power_job()
{
power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch_trig disable_trigger();

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.
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 15 March 2014
Last active: 7 years ago
Posts
214
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
WaW Scriptor
Signature
WaW Scriptor
×
PROxFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
PROxFTW's Contact & Social LinksPROxFTWPROxFTWPROxFTWPROxFTW
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 );

cheat = false;

/#
if( GetDvarInt( "zombie_cheat" ) >= 3 )
{
wait( 5 );
cheat = true;
}
#/

user = undefined;
if ( cheat != true )
{
while( 1 )
{
trig waittill("trigger",user);

if( level.Connection != 0 )
user iprintln( level.Connection + " interuptions in Connection" );
else
break;
                        wait .01;
}
}

master_switch rotateroll(-90,.3);

//TO DO (TUEY) - kick off a 'switch' on client script here that operates similiarly to Berlin2 subway.
master_switch playsound("switch_flip");

power_electric_switch_on();

playfx(level._effect["switch_sparks"] ,getstruct("power_switch_fx","targetname").origin);

trig delete();
}

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();
}
Last Edit: July 25, 2014, 11:34:23 pm by PROxFTW
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
here you go... this should work, sorry it took so long, thought someone did this already. tell me if theres any problems with it

Code Snippet
Plaintext
power_job()
{
power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch_trig disable_trigger();
        level.connection = 0;

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();
}
}
}
Last Edit: July 25, 2014, 11:26:27 pm by n123q45
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
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 );

cheat = false;

/#
if( GetDvarInt( "zombie_cheat" ) >= 3 )
{
wait( 5 );
cheat = true;
}
#/

user = undefined;
if ( cheat != true )
{
while( 1 )
{
trig waittill("trigger",user);

if( level.Connection != 0 )
user iprintln( level.Connection + " interuptions in Connection" );
else
break;
}
}

master_switch rotateroll(-90,.3);

//TO DO (TUEY) - kick off a 'switch' on client script here that operates similiarly to Berlin2 subway.
master_switch playsound("switch_flip");

power_electric_switch_on();

playfx(level._effect["switch_sparks"] ,getstruct("power_switch_fx","targetname").origin);

trig delete();
}

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.  :'(
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 15 March 2014
Last active: 7 years ago
Posts
214
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
WaW Scriptor
×
PROxFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
PROxFTW's Contact & Social LinksPROxFTWPROxFTWPROxFTWPROxFTW
Edit: Try the modified script I made up top. Adds the wait and something else just in case.
Last Edit: July 25, 2014, 11:36:23 pm by PROxFTW
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 5 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
×
pashan's Groups
Mapper Has released one or more maps to the UGX-Mods community.
here you go... this should work, sorry it took so long, thought someone did this already. tell me if theres any problems with it

Code Snippet
Plaintext
power_job()
{
power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch_trig disable_trigger();
        level.connection = 0;

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();
}
}
}


 
Loading ...