Custom Script Issues

broken avatar :(
Created 17 days ago
by halodude423
0 Members and 1 Guest are viewing this topic.
131 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 8 May 2020
Last active: 6 hours ago
Posts
14
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
halodude423's Groups
halodude423's Contact & Social Links
I'm looking to spawn a powerup (either by script_struct or otherwise) using scripts when a trigger is pressed.

EDIT:
I have done a little digging into stock scripts and I have come up with this(i have also put it into it's own file as well).

One big issue I have is that the flags will be set (i have pushed to two buttons) but it won't let me hit the main switch and it doesn't update the hint string to the next part (still using &"ZOMBIE_HALTED" as if they buttons are not pushed.

The better half can't figure it out and she is a devop dev so i came here.
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_zone_manager;
#include maps\_music;
#include maps\dlc3_code;
#include maps\dlc3_teleporter;

main()
{

    flag_init("trigger1_door_activated");
    flag_init("trigger2_door_activated");
    thread secret_trigger_1();
    thread secret_trigger_2();
    thread secret_door();
}

Secret_trigger_1()
{
    trigger1_cost = 3000;
    trig1 = getEnt("secret_trigger","targetname");
    trig1 SetCursorHint( "HINT_NOICON" );
    trig1 setHintString("Turn On Power First To Resume Powerup");
    flag_wait("electricity_on");
    trig1 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger1_cost + "]");
    trig1 waittill("trigger", player );
    if( player.score >= trigger1_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger1_cost );
    flag_set("trigger1_door_activated");
    trig1 delete();
}

Secret_trigger_2()
{
    trigger2_cost = 3000;
    trig2 = getEnt("secret_trigger2","targetname");
    trig2 SetCursorHint( "HINT_NOICON" );
    trig2 setHintString("Turn On power First To Resume Powerup");
    flag_wait("electricity_on");
    trig2 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger2_cost + "]");
    trig2 waittill("trigger", player );
    if( player.score >= trigger2_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger2_cost );
    flag_set("trigger2_door_activated");
    trig2 delete();
}

secret_door()
{
    door = getEnt("secret_door","targetname");
    door SetCursorHint( "HINT_NOICON" );
    door setHintString("Must Turn On power First");
    flag_wait("electricity_on");
    door setHintString(&"ZOMBIE_HALTED");
    flag_wait("trigger1_door_activated");
    flag_wait("trigger2_door_activated");
    door setHintString(&"ZOMBIE_RE");
    door waittill("trigger", player );
    door setHintString(&"ZOMBIE_WAIT");
    wait 10;
    players = get_players();
    for( i = 0; i < players.size; i++ )
    {
    players[i] playsound("door_slide_open");
    }
    door setHintString(&"ZOMBIE_MA");
    door waittill("trigger", player );
    players = get_players();
    for ( i = 0; i < players.size; i++ )
    {
        primaryWeapons = players[i] GetWeaponsList();
        players[i] playsound( "full_ammo" );

            for( x = 0; x < primaryWeapons.size; x++ )
            {

                players[i] GiveMaxAmmo( primaryWeapons[x] );
            }

    }
    door delete();
}
Last Edit: January 09, 2021, 09:13:49 am by halodude423
broken avatar :(
×
broken avatar :(
Location: englandlondon
Date Registered: 16 November 2020
Last active: 20 hours ago
Posts
28
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Phil168912's Groups
Phil168912's Contact & Social Links
I'm looking to spawn a powerup (either by script_struct or otherwise) using scripts when a trigger is pressed.

EDIT:
I have done a little digging into stock scripts and I have come up with this(i have also put it into it's own file as well).

One big issue I have is that the flags will be set (i have pushed to two buttons) but it won't let me hit the main switch and it doesn't update the hint string to the next part (still using &"ZOMBIE_HALTED" as if they buttons are not pushed.

The better half can't figure it out and she is a devop dev so i came here.
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_zone_manager;
#include maps\_music;
#include maps\dlc3_code;
#include maps\dlc3_teleporter;

main()
{

    flag_init("trigger1_door_activated");
    flag_init("trigger2_door_activated");
    thread secret_trigger_1();
    thread secret_trigger_2();
    thread secret_door();
}

Secret_trigger_1()
{
    trigger1_cost = 3000;
    trig1 = getEnt("secret_trigger","targetname");
    trig1 SetCursorHint( "HINT_NOICON" );
    trig1 setHintString("Turn On Power First To Resume Powerup");
    flag_wait("electricity_on");
    trig1 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger1_cost + "]");
    trig1 waittill("trigger", player );
    if( player.score >= trigger1_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger1_cost );
    flag_set("trigger1_door_activated");
    trig1 delete();
}

Secret_trigger_2()
{
    trigger2_cost = 3000;
    trig2 = getEnt("secret_trigger2","targetname");
    trig2 SetCursorHint( "HINT_NOICON" );
    trig2 setHintString("Turn On power First To Resume Powerup");
    flag_wait("electricity_on");
    trig2 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger2_cost + "]");
    trig2 waittill("trigger", player );
    if( player.score >= trigger2_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger2_cost );
    flag_set("trigger2_door_activated");
    trig2 delete();
}

secret_door()
{
    door = getEnt("secret_door","targetname");
    door SetCursorHint( "HINT_NOICON" );
    door setHintString("Must Turn On power First");
    flag_wait("electricity_on");
    door setHintString(&"ZOMBIE_HALTED");
    flag_wait("trigger1_door_activated");
    flag_wait("trigger2_door_activated");
    door setHintString(&"ZOMBIE_RE");
    door waittill("trigger", player );
    door setHintString(&"ZOMBIE_WAIT");
    wait 10;
    players = get_players();
    for( i = 0; i < players.size; i++ )
    {
    players[i] playsound("door_slide_open");
    }
    door setHintString(&"ZOMBIE_MA");
    door waittill("trigger", player );
    players = get_players();
    for ( i = 0; i < players.size; i++ )
    {
        primaryWeapons = players[i] GetWeaponsList();
        players[i] playsound( "full_ammo" );

            for( x = 0; x < primaryWeapons.size; x++ )
            {

                players[i] GiveMaxAmmo( primaryWeapons[x] );
            }

    }
    door delete();
}
 you could just make max ammo a wall buyable
i found code online a while ago where it spawn a max ammo but once its gone (picked up, or dissappears if not picked up. like normal) its gone. i havent figured out how to keep it there permanently until picked up. so i created a max ammo wall buyable
Last Edit: January 13, 2021, 06:46:26 am by Phil168912
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 8 May 2020
Last active: 6 hours ago
Posts
14
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
halodude423's Groups
halodude423's Contact & Social Links
 you could just make max ammo a wall buyable
i found code online a while ago where it spawn a max ammo but once its gone (picked up, or dissappears if not picked up. like normal) its gone. i havent figured out how to keep it there permanently until picked up. so i created a max ammo wall buyable

I did figure it out in some way but i was looking to have it have the steps of the extra buttons and all more like an easter egg. In fact it does mostly work but I get issues where sometimes only parts of it work. For example it gets to the point where I can hit the main switch that is waiting for the two script flags from the others and i hit the button but once it goes past that it doesn't do the next step of letting me push the button again and sometimes it lets me go through the whole script but stops changing the hintstring at some point even though it does everything else. Very inconsistant.
   
In anycase if i only use a shorter version of the steps(the second set of code is currently in and working i believe) but nothing changed just taking out some steps from the door script (originally i had made it a door) it works as far as I can see. Just not sure why it doesn't let me do more steps when it originally did and had no issues. In anycase it works enough to be called usible just not as long as i would of liked since it's super buggy if i mess with it more.



(code for what i would like to work(and what did work in the begining), and the bottom one is code that currently works

EDIT:

The code shown to work at the bottom said to work still has accosional issues of hintstrings not updating but the script itself is still working fine not sure what it is with hintstrings. Thanks for anying able to help with hintstrings or give advice.
main()
{

    flag_init("trigger1_door_activated");
    flag_init("trigger2_door_activated");
    thread secret_trigger_1();
    thread secret_trigger_2();
    thread secret_door();
}

Secret_trigger_1()
{
    trigger1_cost = 3000;
    trig1 = getEnt("secret_trigger","targetname");
    trig1 SetCursorHint( "HINT_NOICON" );
    trig1 setHintString("Turn On Power First To Resume Powerup");
    flag_wait("electricity_on");
    trig1 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger1_cost + "]");
    trig1 waittill("trigger", player );
    if( player.score >= trigger1_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger1_cost );
    flag_set("trigger1_door_activated");
    trig1 delete();
}

Secret_trigger_2()
{
    trigger2_cost = 3000;
    trig2 = getEnt("secret_trigger2","targetname");
    trig2 SetCursorHint( "HINT_NOICON" );
    trig2 setHintString("Turn On power First To Resume Powerup");
    flag_wait("electricity_on");
    trig2 setHintString("Press and hold &&1 To Resume Powerup of System (1 of 2) [" + trigger2_cost + "]");
    trig2 waittill("trigger", player );
    if( player.score >= trigger2_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger2_cost );
    flag_set("trigger2_door_activated");
    trig2 delete();
   
}

secret_door()
{
    door = getEnt("secret_door","targetname");
    door SetCursorHint( "HINT_NOICON" );
    door setHintString("Must Turn On power First");
    flag_wait("electricity_on");
    door setHintString(&"ZOMBIE_HALTED");
    flag_wait("trigger1_door_activated");
    flag_wait("trigger2_door_activated");
    flag_clear( "trigger1_door_activated" );
    flag_clear( "trigger2_door_activated" );
    door setHintString(&"ZOMBIE_RE");
    door waittill("trigger", player );
    door setHintString(&"ZOMBIE_WAIT");
    wait 60;
    players = get_players();
    for( i = 0; i < players.size; i++ )
    {
    players[i] playsound("door_slide_open");
    }
    door setHintString(&"ZOMBIE_MA");
    door waittill("trigger", player );
    players = get_players();
    for ( i = 0; i < players.size; i++ )
    {
        primaryWeapons = players[i] GetWeaponsList();
        players[i] playsound( "full_ammo" );

            for( x = 0; x < primaryWeapons.size; x++ )
            {

                players[i] GiveMaxAmmo( primaryWeapons[x] );
            }

    }
    door delete();
}
    flag_init("trigger1_door_activated");
    flag_init("trigger2_door_activated");
    thread secret_trigger_1();
    thread secret_trigger_2();
    thread secret_door();
   
   
   
   
    Secret_trigger_1()
{
    trigger1_cost = 0;
    trig1 = getEnt("secret_trigger","targetname");
    trig1 SetCursorHint( "HINT_NOICON" );
    flag_wait("electricity_on");
    trig1 setHintString("Press and hold &&1 To Restart System");
    trig1 waittill("trigger", player );
    if( player.score >= trigger1_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger1_cost );
    trig1 delete();
    flag_set("trigger1_door_activated");
}

Secret_trigger_2()
{
    trigger2_cost = 0;
    trig2 = getEnt("secret_trigger2","targetname");
    trig2 SetCursorHint( "HINT_NOICON" );
    flag_wait("electricity_on");
    trig2 setHintString("Press and hold &&1 To Restart System");
    trig2 waittill("trigger", player );
    if( player.score >= trigger2_cost )
        player maps\_zombiemode_score::minus_to_player_score( trigger2_cost );
    trig2 delete();
    flag_set("trigger2_door_activated");
   
}

secret_door()
{
    door = getEnt("secret_door","targetname");
    door SetCursorHint( "HINT_NOICON" );
    door setHintString("Must Turn On power First");
    flag_wait("electricity_on");
    door setHintString(&"ZOMBIE_HALTED");
    flag_wait("trigger1_door_activated");
    flag_wait("trigger2_door_activated");
    door setHintString(&"ZOMBIE_MA");
    door waittill("trigger", player );
    players = get_players();
    for ( i = 0; i < players.size; i++ )
    {
        primaryWeapons = players[i] GetWeaponsList();
        players[i] playsound( "full_ammo" );

            for( x = 0; x < primaryWeapons.size; x++ )
            {

                players[i] GiveMaxAmmo( primaryWeapons[x] );
            }

    }
    door delete();
}
 
Last Edit: January 14, 2021, 08:01:37 am by halodude423

 

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
Loading ...