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

Help Adding Difficulty Setting in UGX v1.0.3? :D

broken avatar :(
Created 10 years ago
by ProGamerzFTW
0 Members and 1 Guest are viewing this topic.
1,470 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 10 October 2013
Last active: 4 months ago
Posts
541
Respect
Forum Rank
Zombie Enslaver
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
ProGamerzFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
EDIT: I got it working but if you know a way to allow the vars to waittill("ugxm_voting_complete"); inside _zombiemode instead of moving some of them to ugxm_init, feel free to tell me.



Ok, I pretty much got everything up and working in the vote menus (tested with prints) but how would I be able to add a

Code Snippet
Plaintext
level waittill("ugxm_voting_complete");

to some zombie vars?

i tried putting a

Code Snippet
Plaintext
level thread hankey_difficulty();
and then tried putting this in init_levelvars() but didnt work as that people start off with 0 points with all 3 difficulty settings

Code Snippet
Plaintext
hankey_difficulty()
{
level waittill("ugxm_voting_complete");
if(GetDvarint( "hankey_difficulty" ) == 1)//Easy
{
set_zombie_var( "zombie_spawn_delay", 1.5 );
        set_zombie_var( "zombie_health_start", 150 );
set_zombie_var( "zombie_score_start", 500 );
}
else if(GetDvarint( "hankey_difficulty" ) == 2)//Medium
{
set_zombie_var( "zombie_spawn_delay", 1   );
set_zombie_var( "zombie_health_start", 350 );
set_zombie_var( "zombie_score_start", 250 );
}
else if(GetDvarint( "hankey_difficulty" ) == 3)//Hard
{
set_zombie_var( "zombie_spawn_delay", 0.2 );
set_zombie_var( "zombie_health_start", 650 );
set_zombie_var( "zombie_score_start", 0 );
}
}

however, when i remove the waittill, it almost works as intended, if i set the difficulty, it requires a restart to take effect.

Any help is appreciated.

edit: i tried changing things to level.ugxm_settings["hankey_difficulty"].
almost everything seems to work, the zombie health changes like it should, but the players still only starts with 0 points.

edit2: omg, i think i got it working O_O

edit3: yes indeed it appears to be working, i need to test in multiplayer though.

ive moved the three vars into ugxm_init, and made the player.score wait till the vote is complete, seems to work fine.
Last Edit: March 14, 2014, 01:05:55 am by ProGamerzFTW
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
EDIT: I got it working but if you know a way to allow the vars to waittill("ugxm_voting_complete"); inside _zombiemode instead of moving some of them to ugxm_init, feel free to tell me.
It's a level notify, so as long as your waittil is in a threaded function which was called before ugxm_init (so, before _zombiemode.gsc), you will catch the notify.

If you need something to happen right after the game starts there are more ways to do it than this notify. Explaining your purpose would allow me to be more specific.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 10 October 2013
Last active: 4 months ago
Posts
541
Respect
Forum Rank
Zombie Enslaver
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
ProGamerzFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
It's a level notify, so as long as your waittil is in a threaded function which was called before ugxm_init (so, before _zombiemode.gsc), you will catch the notify.

If you need something to happen right after the game starts there are more ways to do it than this notify. Explaining your purpose would allow me to be more specific.

in ugxm_init, the level.ugxm_settings["difficulty"] is defined to 1, 2 or 3 depended on what is voted, which works. What I've tried to do is thread a function in init_levelvars, and have that function waittil the voting is complete! as putting a waittill within the init_levelvars causes problems, and when the voting is complete, my debug prints is displayed correctly, but zombie vars aren't being set.

heres the function

Code Snippet
Plaintext
zombie_difficulty()
{
level waittill("ugxm_voting_complete");
if(level.ugxm_settings["difficulty"] == 1)
{
iprintln("^3Picked Original");
set_zombie_var( "zombie_spawn_delay", 2 );
        set_zombie_var( "zombie_health_start", 150 );
set_zombie_var( "zombie_score_start", 500 );
}
else if(level.ugxm_settings["difficulty"] == 2)
{
iprintln("^3Picked Hard");
set_zombie_var( "zombie_spawn_delay", 1   );
set_zombie_var( "zombie_health_start", 350 );
set_zombie_var( "zombie_score_start", 250 );
}
else if(level.ugxm_settings["difficulty"] == 3)
{
iprintln("^3Picked Legendary");
set_zombie_var( "zombie_spawn_delay", 0.2 );
set_zombie_var( "zombie_health_start", 650 );
set_zombie_var( "zombie_score_start", 0 );
}
}

Edit: I tried adding level thread maps\_zombiemode::zombie_difficulty(); in the vote beneath where the difficulty is selected, removed the waittill in the zombie_difficulty function and it works fine, not sure if its the preferred method.

still dont know it doesnt work with the other method i said. lol
Last Edit: March 14, 2014, 01:27:08 am by ProGamerzFTW

 
Loading ...