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

how to script a choice of choosing between 2 triggers.

broken avatar :(
Created 3 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
1,298 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
heres the logic im trying to achieve-

https://imgur.com/EM1JFbm
broken avatar :(
×
broken avatar :(
Location: usBaja California
Date Registered: 19 November 2018
Last active: 7 days ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
GabeTheGreat's Groups
GabeTheGreat's Contact & Social Linksjerri13hdezMy YouTube ChannelLilGabe#2429
heres the logic im trying to achieve-

https://imgur.com/U2XD5W0
Actually, what are you trying to do here, you're psuedo code is not really specific and what do you mean by "lot"?
Last Edit: December 27, 2020, 12:18:58 am by Jerri13
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
heres a vid of what im trying to do. its what ive done so far. i just need to sort the [select] bit out now. which is why i need 2 trigs to remain active and the player can choose from 1 of the 2 & depending on which one they choose depends on whether the script 'proceeds' or returns to start.

https://www.youtube.com/watch?v=RMqpV22urvs&ab_channel=PhilGibson

heres the code i have written also-

```

Code Snippet
Plaintext
gun_machine()

{

    zombie_ppsh = getEnt("zombie_ppsh","targetname"); //zombie_ppsh

    zombie_mg42 = getEnt("zombie_mg42","targetname"); //zombie_mg42

    zombie_cymbal_monkey = getEnt("zombie_cymbal_monkey","targetname"); //zombie_cymbal_monkey

    zombie_ppsh hide();

    zombie_mg42 hide();

    zombie_cymbal_monkey hide();

   

    trig = getEnt("gun_machine_trig", "targetname");

    trig setHintString("Press X to browse gun catalogue");

    trig setCursorHint("HINT_NOICON");

   

    pistol = getEnt("pistol", "targetname"); //buy weapon

    melee = getEnt("melee", "targetname"); //cycle thru weapons

   

    trig waittill ("trigger", player);

    zombie_ppsh show();

    trig setHintString("PPSH - [Cost 100] 'Shoot' to buy, OR 'Melee' to see next weapon");

   

        while(1)

        {    

            melee waittill ("trigger", player);

           

                zombie_ppsh hide();

                zombie_mg42 show();

               

                trig setHintString("MG42 - [Cost 100] 'Shoot' to buy, OR 'Melee' to see next weapon");

           

            melee waittill ("trigger", player);

           

                zombie_mg42 hide();

                zombie_cymbal_monkey show();

               

                trig setHintString("MONKEY's - [Cost 100] 'Shoot' to buy, OR 'Melee' to see next weapon");

           

            melee waittill ("trigger", player);

           

                zombie_cymbal_monkey hide();

                zombie_ppsh show();

               

                trig setHintString("PPSH - [Cost 100] 'Shoot' to buy, OR 'Melee' to see next weapon");

        }


        while(1)

        {    

            pistol waittill ("trigger", player);

       

            if (player.score >= 100)

            {

                primariesList = player getWeaponsListPrimaries(); //checks how many weapons player has

               

                if( primariesList.size >= 2 ) // ok, you have bla bla, ill now proceed accordingly

                {

                    iPrintLnBold ("Sorry. Both Weapon Slots Filled Already!"); // should only see this if i have 2(+) weapons

                }

                   

                else

                {

                    player maps\_zombiemode_score::minus_to_player_score( 100 );

                    player giveWeapon("zombie_ppsh");

                    player switchToWeapon("zombie_ppsh");

                    player giveStartAmmo("zombie_ppsh");

                    player giveMaxAmmo("zombie_ppsh");

                    iPrintLnBold("PPSH Acquired");

                }

            }

           

            else

            {

                iPrintLnBold("Insuficient Funds Available");

            }

        }


    while(1)

    {    

        pistol waittill ("trigger", player);

   

        if (player.score >= 100)

        {

            primariesList = player getWeaponsListPrimaries();

           

            if( primariesList.size >= 2 )

            {

                iPrintLnBold ("Sorry. Both Weapon Slots Filled Already!");

            }

               

            else

            {

                player maps\_zombiemode_score::minus_to_player_score( 100 );

                player giveWeapon("zombie_mg42");

                player switchToWeapon("zombie_mg42");

                player giveStartAmmo("zombie_mg42");

                player giveMaxAmmo("zombie_mg42");

                iPrintLnBold("MG42 Acquired");

            }

        }

       

        else

        {

            iPrintLnBold("Insuficient Funds Available");

        }

    }

   

    while(1)

    {    

        pistol waittill ("trigger", player);

   

        if (player.score >= 100)

        {

            primariesList = player getWeaponsListPrimaries();

           

            if( primariesList.size >= 2 )

            {

                iPrintLnBold ("Sorry. Both Weapon Slots Filled Already!");

            }

               

            else

            {

                player maps\_zombiemode_score::minus_to_player_score( 100 );

                player giveWeapon("zombie_cymbal_monkey");

                player switchToWeapon("zombie_cymbal_monkey");

                player giveStartAmmo("zombie_cymbal_monkey");

                player giveMaxAmmo("zombie_cymbal_monkey");

                iPrintLnBold("MONKEY's Acquired");

            }

        }

       

        else

        {

            iPrintLnBold("Insuficient Funds Available");

        }

    }

}
```

Double Post Merge: December 27, 2020, 09:19:11 am

Actually, what are you trying to do here, you're psuedo code is not really specific and what do you mean by "lot"?
this is what i mean by "lot" https://imgur.com/4gBsbWw
there are 2 weapons and monkeys in the machine. so 3 "lots" of trigs & each "lot" containing 2 trigs. 1 to cycle to next weapon & 1 to select a weapon.
broken avatar :(
×
broken avatar :(
Location: usBaja California
Date Registered: 19 November 2018
Last active: 7 days ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
GabeTheGreat's Groups
GabeTheGreat's Contact & Social Linksjerri13hdezMy YouTube ChannelLilGabe#2429
heres a vid of what im trying to do. its what ive done so far. i just need to sort the [select] bit out now. which is why i need 2 trigs to remain active and the player can choose from 1 of the 2 & depending on which one they choose depends on whether the script 'proceeds' or returns to start.
Can I see how you have it setup in Radiant? Also, add me on discord: LilGabe#2429
Last Edit: December 27, 2020, 12:14:21 pm by Jerri13
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 4 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
Signature
My published cod maps:

Subzero
Djinncaves
Enclosed (a.k.a baconcube)
Bayern
Snowblind
Furtrelock

Black Ops Perks: https://www.ugx-mods.com/forum/scripts/55/call-of-duty-world-at-war-black-ops-perks/22180/
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
You need to thread the methods to achieve your goal.
you know...
self thread Test1();
self thread Test2();
self thread Test3();

Like a crossway where you can task your workers to do stuff for you.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
You need to thread the methods to achieve your goal.
you know...
self thread Test1();
self thread Test2();
self thread Test3();

Like a crossway where you can task your workers to do stuff for you.
like you mentiond before-

"I don't know which way you want
you can loop through an array of triggers and thread it to one method
or you can get a few entities like I have here and thread those"

im currently trying out- "you can loop through an array of triggers and thread it to one method".

issue im having is even tho i can choose between 1 or the other trig. in order to get weapon 2 i 1st Have to get weapon1. i can cycle thru the 3 functions with no problem. it just wont let me get access to another other weapon until weapon1 trig has been activated. so even tho i can choose. i still have to also use both trigs to proceed to acquiring weapon2 from func2. i tried endon & notify. which i got it working. (to killt the function i mean by 'working'. not the script). but i need to call on each func at the end so terminating the func is no good here. as both trigs are within a loop and i have a break; outside of both trigs, but inside the loop. i thought that by selecting any trig it would then break out of the loop, therefore forgetting about the other trig and then proceed to func2();. but this isnt the case

 
Loading ...