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

Need Expert Scripting Advice

broken avatar :(
Created 11 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
4,825 views
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
So I had a cool idea that I wanted to implement and was wondering if any scripters could give me some advice on how to script this, or maybe give me a general outline to accomplish this. Basically, I wanted it so at the beginning of each round it teleports a random player to a random room that will be identified, and the other players will still be in the map carrying on the rounds, and each room has a different challenge that will start depending on which room the player gets teleported to. Each challenge will be like finding something in 30 seconds, killing zombies, etc. and if they complete  the challenge they will be awarded points or something else but if they fail, they either lose points, a perk, a gun etc. Each challenge I will have a certain point value, as well as a certain fail value. So I dont need help with that, but I do need help with it choosing a random player to teleport as well as finding a room to teleport to, and then it starting the challenge that is suppose to start in the room, for instance it wouldnt make much sense if they get teleported to a room where they must find something but instead it gives them the kill zombies challenge. Would something like this be possible? and if so, would a noob like me be able to make it happen.
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21'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.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Code Snippet
Plaintext
// Get random player
player = get_players();
random_player = randomInt( players.size );

// Will return a random player

// I use script_origins in these cases, just call them like "teleport_locations" or something
locations = getEntArray( "WHATEVER YOU CALLED THE ENTS THEY TELEPORT TO", "TARGETNAME" );
random_location = randomInt( locations.size );

those two functions can be used to at least get the random room, or player. You would also need to dis-include the player from the zombies targeting, or on solo have a "zombie_interest" point i guess

Would it be entirely random what room your taken to? Or would it be the same one until you eventually pass it?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 4 years ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Signature
Hey if you had tons of fun on playing my maps please DONATE :)

play ESTATE now, and claim your mansion back from the undead!
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
jei9363's Contact & Social Linksjayingardiajei9363jei9363
to go along with his code ^^

Code Snippet
Plaintext
main()
{
 thread random_challenges(); //thread because of while loop
}

random_challenges()
{
while(1) //do for whole game
{
player = get_players();
random_player = randomInt( players.size ); //choose random index
ChallengeOver = false; //challenge has not been complete
ChallengeWon = false; //assume failure

player_origin = player[random_player].origin; //save pre teleport origin

player[random_player] setOrigin(locations[randomInt(locations.size)]); //simple teleport for now

switch (randomInt(locations.size)) //pick a game
{
case 1:
player[random_player] thread shoot_targets();
break;
case 2:
player[random_player] thread kill_zombies();
break;
default:
break;
}


while(!ChallengeOver) // wait til challenge concludes
{
wait .1;
}

player[random_player] setOrigin(player_origin); // return player

if(ChallengeWon)
{
//reward player
}
}
}

shoot_targets()
{
//game logic

if(1) //change this 1 to logic
ChallengeWon = true;

wait 30;
ChallengeOver = true;
}

kill_zombies()
{
//game logic
// you'll need to manually spawn game independent zombies here

if(1)
ChallengeWon = true;

wait 30;
ChallengeOver = true;
}
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Would it be entirely random what room your taken to? Or would it be the same one until you eventually pass it?

It will be a random room each time.

Also jei, would this make it so they go to a different room, or would it be the same room but different challenge? I guess it could be either or. I was just going to have like 4-5 rooms outside of the map depending on how many challenges I wanted and have them teleport to a random script_origin that is inside the individual rooms, named differently for each room obviously.
Marked as best answer by thezombiekilla6 11 years ago
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Easy enough I did something similar for someone else just now (teleporting player's wise). I could restructure it for what you need, PM me.

Also use GetStructArray rather than GetEntArray and use KVP script_string :P
Last Edit: February 25, 2015, 02:51:39 am by DidUknowiPwn
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21'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.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
this would be totally random, but was also mean you could be teleported to the same room twice in a row (unlikely but possible)

We could make sure its a different room to the last one visited each time or something I guess :)
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
to go along with his code ^^

Code Snippet
Plaintext
main()
{
 thread random_challenges(); //thread because of while loop
}

random_challenges()
{
while(1) //do for whole game
{
player = get_players();
random_player = randomInt( players.size ); //choose random index
ChallengeOver = false; //challenge has not been complete
ChallengeWon = false; //assume failure

player_origin = player[random_player].origin; //save pre teleport origin

player[random_player] setOrigin(locations[randomInt(locations.size)]); //simple teleport for now

switch (randomInt(locations.size)) //pick a game
{
case 1:
player[random_player] thread shoot_targets();
break;
case 2:
player[random_player] thread kill_zombies();
break;
default:
break;
}


while(!ChallengeOver) // wait til challenge concludes
{
wait .1;
}

player[random_player] setOrigin(player_origin); // return player

if(ChallengeWon)
{
//reward player
}
}
}

shoot_targets()
{
//game logic

if(1) //change this 1 to logic
ChallengeWon = true;

wait 30;
ChallengeOver = true;
}

kill_zombies()
{
//game logic
// you'll need to manually spawn game independent zombies here

if(1)
ChallengeWon = true;

wait 30;
ChallengeOver = true;
}

why the hell did you put a while loop with just a wait statement in it - that makes no sense whatsoever especially considering the ChallengeWon var isn't a level variable so it would never change anyway, lol.

But i digress, what are you actually looking to do? Have it so any zone can have any challenge or have it so that only certain zones have specific objectives?

If the rooms have a specific objective then it makes things a hell of a lot easier. Essentially what you can then do is create a function similar to zones in a normal zombie maps and use that for getting spawners, teleport structs, etc without making a mess of things.
Last Edit: February 25, 2015, 04:44:56 am by daedra descent
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
why the hell did you put a while loop with just a wait statement in it - that makes no sense whatsoever especially considering the ChallengeWon var isn't a level variable so it would never change anyway, lol.

But i digress, what are you actually looking to do? Have it so any zone can have any challenge or have it so that only certain zones have specific objectives?

If the rooms have a specific objective then it makes things a hell of a lot easier. Essentially what you can then do is create a function similar to zones in a normal zombie maps and use that for getting spawners, teleport structs, etc without making a mess of things.

In short, I want it so it picks a random player at the start of a round to teleport to a random room, a room that none of the players can get to without teleporting, outside of the map somwhere. Have a challenge in the specific room, once they complete the challenge they get a reward, but if they fail they lose something.

DidyouknowIpwn is helping me through PM for this anyway.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 4 years ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
jei9363's Contact & Social Linksjayingardiajei9363jei9363
Quote
why the hell did you put a while loop with just a wait statement in it - that makes no sense whatsoever especially considering the ChallengeWon var isn't a level variable so it would never change anyway, lol.

Im away from my home computer so I didnt have a reference for setting flags. the while loop would end after the condition is set to true from the game type threads. theres ChallengeWon and ChallengeOver

Double Post Merge: February 25, 2015, 05:39:19 am
but yeah you'd have to increase its scope anyway or pass it
Last Edit: February 25, 2015, 05:39:19 am by jei9363
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21'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.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
There would be a lot of side cases to handle, but DidUKnowIPWN is quite the able scripter, im sure hell come up with something good for you :)
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_dukip_utility;

init()
{
//DUKIP - Will add stuff in here when needed
//Also remember to call this init function later.
}

moveRandomPlayer()
{
//DUKIP - Grab total players and randomize the array.
players = get_players();
players = array_randomize( players );
player = players[0];
//DUKIP - Grab our tp structs and randomize the array.
tp_points = GetStructArray("player_teleport_point", "targetname");
tp_points = array_randomize( tp_points );
teleportPoint = undefined;
teleportPoint = tp_points[randomInt(tp_points.size)];

if(IsDefined(teleportPoint))
player thread movePlayerToRoom(teleportPoint);
else
IPrintLnBold("^1ERROR^7: Failed to generate teleportPoint.");
}

movePlayerToRoom(tpPoint)
{
//DUKIP - Disable player controls and weapons.
self FreezeControls(true);
self DisableWeapons();
//DUKIP - Spawn HUD element
fadeToBlack = NewClientHudElem( self );
fadeToBlack.x = 0;
fadeToBlack.y = 0;
fadeToBlack.alpha = 0;
fadeToBlack.horzAlign = "fullscreen";
fadeToBlack.vertAlign = "fullscreen";
fadeToBlack.foreground = false;
fadeToBlack.sort = 50;
fadeToBlack SetShader( "black", 640, 480 );
//DUKIP - Fade at 0.5 seconds
fadeToBlack FadeOverTime( 0.5 );
fadeToBlack.alpha = 1;
wait 1;
//DUKIP - Wait one second, then move player to new point, unlock controls and enable weapons.
self SetOrigin(tpPoint.origin);
self FreezeControls(false);
self EnableWeapons();
level thread startRoomChallenge(tpPoint.script_string, self);
wait 0.5;
//DUKIP - Fade at 0.5 seconds
fadeToBlack FadeOverTime( 0.5 );
fadeToBlack.alpha = 0;
wait 1;
//DUKIP - Make sure to destroy the element.
fadeToBlack Destroy();

}

startRoomChallenge(roomType, player)
{
level endon("end_game");
level endon("room_challenge_end");

if(!IsDefined(roomType))
return;

switch(roomType)
{
case "kill_zm":
level thread roomKillZM(player);
break;

case "target_practice":
level thread roomTargetPractice(player);
break;

case "trivia":
level thread roomTrivia(player);
break;

case "scavenger":
level thread roomScavenger(player);
break;

case "parkour":
level thread roomParkour(player);
break;
}
}

giveChallengeAward(player, roomType)
{
switch(roomType)
{
case "kill_zm":
level notify("room_kill_zm_end");
//reward
break;

case "target_practice":
level notify("room_tp_end");
//reward
break;

case "trivia":
level notify("room_trivia_end");
//reward
break;

case "scavenger":
level notify("room_scavenger_end");
//reward
break;

case "parkour":
level notify("room_parkour_end");
//reward
break;
}
}

giveChallengeFail(player, roomType)
{
switch(roomType)
{
case "kill_zm":
level notify("room_kill_zm_end");
//failure
break;

case "target_practice":
level notify("room_tp_end");
//failure
break;

case "trivia":
level notify("room_trivia_end");
//failure
break;

case "scavenger":
level notify("room_scavenger_end");
//failure
break;

case "parkour":
level notify("room_parkour_end");
//failure
break;
}
}

/*******************************************************************
Challenge - Kill Zombies
Objective: Get X amount of kills while in an enclosed space.
Also survive using a completely random weapon.
*******************************************************************/
roomKillZM(player)
{
level endon("end_game");
level endon("room_kill_zm_end");

player thread giveRandomWeapon();
player thread killZMCounter();
player thread generateZMHUD();
}

giveRandomWeapon()
{
self endon("death");
self endon("disconnect");

primaryWeapons = self GetWeaponsListPrimaries();
weaponToGive = maps\_zombiemode_weapons::treasure_chest_ChooseRandomWeapon(self);
self GiveWeapon(weaponToGive);
self GiveMaxAmmo(weaponToGive);
self SwitchToWeapon(weaponToGive);
self DisableWeaponCycling();

//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self thread reEnableWeapons(weaponToGive, primaryWeapons[0]);
}

killZMCounter()
{
level endon("end_game");
level endon("room_kill_zm_end");
self endon("death");
self endon("disconnect");

curr_kills = 0;
max_kills = level.challenge_zm_kills;

while(IsAlive(self))
{
self waittill("zom_kill");
curr_kills++;

self.ZM_AMTHUD SetValue(curr_kills);
self.ZM_AMTHUD_Shadow SetValue(curr_kills);

if(curr_kills >= max_kills)
{
level thread giveChallengeAward(self, "kill_zm");
break;
}
}
}

generateZMHUD()
{
//DUKIP - Something I tossed in from old ZM Counter I had done with WhiteDevilHD.
x = 275;
y = 465;
self.ZM_HUD = newClientHudElem( self );
self.ZM_HUD.x = (x+1);
self.ZM_HUD.y = (y-11);
self.ZM_HUD.foreground = 1;
self.ZM_HUD.fontscale = 1.05;
self.ZM_HUD.alpha = 1;
self.ZM_HUD.sort = 0;
self.ZM_HUD.color = (1, 0, 0);
self.ZM_HUD SetText("Zombies Killed: ");

  self.ZM_HUD_Shadow = newClientHudElem( self );
self.ZM_HUD_Shadow.x = (x+2);
self.ZM_HUD_Shadow.y = (y-11);
self.ZM_HUD_Shadow.foreground = 1;
self.ZM_HUD_Shadow.fontscale = 1.05;
self.ZM_HUD_Shadow.alpha = 0.4;
self.ZM_HUD.sort = -1;
self.ZM_HUD_Shadow.color = (0, 0, 0);
self.ZM_HUD_Shadow SetText("Zombies Killed: ");
self.ZM_HUD_Shadow SetParent(self.ZM_HUD);

self.ZM_AMTHUD = newClientHudElem( self );
self.ZM_AMTHUD.x = (x+10);
self.ZM_AMTHUD.y = (y-11);
self.ZM_AMTHUD.foreground = 1;
self.ZM_AMTHUD.fontscale = 1.05;
self.ZM_AMTHUD.alpha = 1;
self.ZM_AMTHUD.sort = 0;
self.ZM_AMTHUD.color = (1, 0, 0);
self.ZM_AMTHUD SetValue(0);

  self.ZM_AMTHUD_Shadow = newClientHudElem( self );
self.ZM_AMTHUD_Shadow.x = (x+11);
self.ZM_AMTHUD_Shadow.y = (y-11);
self.ZM_AMTHUD_Shadow.foreground = 1;
self.ZM_AMTHUD_Shadow.fontscale = 1.05;
self.ZM_AMTHUD_Shadow.alpha = 0.4;
self.ZM_AMTHUD.sort = -1;
self.ZM_AMTHUD_Shadow.color = (0, 0, 0);
self.ZM_AMTHUD_Shadow SetValue(0);
self.ZM_AMTHUD_Shadow SetParent(self.ZM_AMTHUD);

self thread destroyZMHUD();
}

destroyZMHUD()
{
//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self.ZM_HUD Destroy();
self.ZM_HUD_Shadow Destroy();

self.ZM_AMTHUD Destroy();
self.ZM_AMTHUD_Shadow Destroy();
}

/*******************************************************************
Challenge - Target Practice
Objective: Test your skills here! Shoot all the teddy's to win.
----
*******************************************************************/
roomTargetPractice(player)
{
level endon("end_game");
level endon("room_tp_end");

}

/*******************************************************************
Challenge - Trivia
Objective: Answer the questions or fail.
----
*******************************************************************/
roomTrivia(player)
{
level endon("end_game");
level endon("room_trivia_end");

//DUKIP - For this I'm going through a menu based solution.
level.trivia_question_num = 1;
level.trivia_question_passed = 0;
//DUKIP - 5 for now.
level.trivia_total_questions = 5;
level thread triviaGenerateQuestions();
player thread triviaMenu();
}

triviaGenerateQuestions()
{
//DUKIP - Convert to level, answers will be parsed by strTok in updated triviaSetVars().
//Should randomize it keep answer first token for easy access?
level.trivia_questions = [];
level.trivia_questions[1] = "American?";
level.trivia_questions[1]["answers"] = "Dempsey,Eagles,Freedom";
level.trivia_questions[2] = "German?";
level.trivia_questions[2]["answers"] = "Richtofen,Hitler,MP40";
level.trivia_questions[3] = "Russian?";
level.trivia_questions[3]["answers"] = "Nikolai,Vodka,Boobs";
level.trivia_questions[4] = "Japanese?";
level.trivia_questions[4]["answers"] = "Takeo,Fish,Honor";
level.trivia_questions[5] = "1337est?";
level.trivia_questions[5]["answers"] = "DUKIP,SparkyMcSparks,Cookies";
}

triviaMenu()
{
triviaSetVars();
self thread triviaMenuResponse();
}

triviaSetVars()
{
//DUKIP - Console handles strings by "@""rather than "&"
//Menu handler USED strings.
setDvar("ui_number_choice1", "A)" );
setDvar("ui_number_choice2", "B)" );
setDvar("ui_number_choice3", "C)" );
//Leave them blank for initial set.
//Still have to add support for randomized questions
//requires arrays and stuff :D
setDvar("ui_choice1", "");
setDvar("ui_choice2", "");
setDvar("ui_choice3", "");

}

triviaMenuResponse()
{
level endon("end_game");
level endon("room_trivia_end");

for(;;)
{
self waittill("menuresponse", menu, response);

if(menu != "dukip_trivia_menu")
continue;

answer = trivaDetermineAnswer(response, level.trivia_question_num);
if(answer)
level.trivia_question_passed++;
level.trivia_question_num++;
//update question now
}
}

trivaDetermineAnswer(input, num)
{
answer = strTok(level.trivia_questions[num], ",");

if(input == answer[0])
return true;

return false;
}

/*******************************************************************
Challenge - Scavenger Hunt
Objective: Find all the items in time or you fail :D!
----
*******************************************************************/
roomScavenger(player)
{
level endon("end_game");
level endon("room_scavenger_end");

level thread setupScavengerRoom(player);
}

setupScavengerRoom(player)
{
level endon("end_game");
level endon("room_scavenger_end");

level.challenge_found_scav_items = 0;
scavenger_items = GetEntArray("room_scavenger_item", "targetname");
level.challenge_max_scav_items = scavenger_items.size;
array_thread(scavenger_items, ::scavengerItemTrigger);
}

scavengerItemTrigger()
{
self Show();
self trigger_on();
//DUKIP - Might have to spawn trigger_radius rather than assuming trigger_use will work out right in the end.
while(true)
{
self waittill("trigger", player);

if( !is_player_valid( player ) )
{
player thread ignore_triggers( 0.5 );
continue;
}
self trigger_off();
//DUKIP - Play some FX or sound?
//play_sound_at_pos( "sound thing!", self.origin, self );
//PlayFXOnTag(level._effect["the effect"], self, "tag_origin");

level.challenge_found_scav_items++;
if(level.challenge_found_scav_items == level.challenge_max_scav_items)
{
//DUKIP - No idea if I'll continue with this.
//self thread scavengerItemAnimation();
break;
}
}
}

/*******************************************************************
Challenge - Parkour
Objective: Run through a parkour course. Fail you get killed or so.
----
*******************************************************************/
roomParkour(player)
{
level endon("end_game");
level endon("room_parkour_end");

player thread setParkourClass();
level thread setupParkourRoom(player);
}

setParkourClass()
{
self endon("death");
self endon("disconnect");

primaryWeapons = self GetWeaponsListPrimaries();
self GiveWeapon("hands?");
self SwitchToWeapon("hands?");
self DisableWeaponCycling();

//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self thread reEnableWeapons("hands?", primaryWeapons[0]);
}

setupParkourRoom(player)
{
level endon("end_game");
level endon("room_parkour_end");
player endon("death");
player endon("disconnect");

//DUKIP - This is a trigger radius by the way.
//Have this trigger a bit down from the platforms so the player can see that he messed up or you know experience it :D
//You get my drift (hopefully).
parkourFailTrigg = GetEnt("room_parkour_fail_trigg", "targetname");
parkourFailTrigg thread parkourFailure();
}

parkourFailure()
{
level endon("end_game");
level endon("room_parkour_end");

while(true)
{
self waittill("trigger", player);

level thread giveChallengeFail(player, "parkour");
}
}

Working all over the code :p
Instance #2
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_dukip_utility;

init()
{
//DUKIP - Will add stuff in here when needed
//Also remember to call this init function later.
}

moveRandomPlayer()
{
//DUKIP - Grab total players and randomize the array.
players = get_players();
players = array_randomize( players );
player = players[0];
//DUKIP - Grab our tp structs and randomize the array.
tp_points = GetStructArray("player_teleport_point", "targetname");
tp_points = array_randomize( tp_points );
teleportPoint = undefined;
teleportPoint = tp_points[randomInt(tp_points.size)];

if(IsDefined(teleportPoint))
player thread movePlayerToRoom(teleportPoint);
else
IPrintLnBold("^1ERROR^7: Failed to generate teleportPoint.");
}

movePlayerToRoom(tpPoint)
{
//DUKIP - Disable player controls and weapons.
self FreezeControls(true);
self DisableWeapons();
//DUKIP - Spawn HUD element
fadeToBlack = NewClientHudElem( self );
fadeToBlack.x = 0;
fadeToBlack.y = 0;
fadeToBlack.alpha = 0;
fadeToBlack.horzAlign = "fullscreen";
fadeToBlack.vertAlign = "fullscreen";
fadeToBlack.foreground = false;
fadeToBlack.sort = 50;
fadeToBlack SetShader( "black", 640, 480 );
//DUKIP - Fade at 0.5 seconds
fadeToBlack FadeOverTime( 0.5 );
fadeToBlack.alpha = 1;
wait 1;
//DUKIP - Wait one second, then move player to new point, unlock controls and enable weapons.
self SetOrigin(tpPoint.origin);
self FreezeControls(false);
self EnableWeapons();
level thread startRoomChallenge(tpPoint.script_string, self);
wait 0.5;
//DUKIP - Fade at 0.5 seconds
fadeToBlack FadeOverTime( 0.5 );
fadeToBlack.alpha = 0;
wait 1;
//DUKIP - Make sure to destroy the element.
fadeToBlack Destroy();

}

startRoomChallenge(roomType, player)
{
level endon("end_game");
level endon("room_challenge_end");

if(!IsDefined(roomType))
return;

switch(roomType)
{
case "kill_zm":
level thread roomKillZM(player);
break;

case "target_practice":
level thread roomTargetPractice(player);
break;

case "trivia":
level thread roomTrivia(player);
break;

case "scavenger":
level thread roomScavenger(player);
break;

case "parkour":
level thread roomParkour(player);
break;
}
}

giveChallengeAward(player, roomType)
{
switch(roomType)
{
case "kill_zm":
level notify("room_kill_zm_end");
//reward
break;

case "target_practice":
level notify("room_tp_end");
//reward
break;

case "trivia":
level notify("room_trivia_end");
//reward
break;

case "scavenger":
level notify("room_scavenger_end");
//reward
break;

case "parkour":
level notify("room_parkour_end");
//reward
break;
}
}

giveChallengeFail(player, roomType)
{
switch(roomType)
{
case "kill_zm":
level notify("room_kill_zm_end");
//failure
break;

case "target_practice":
level notify("room_tp_end");
//failure
break;

case "trivia":
level notify("room_trivia_end");
//failure
break;

case "scavenger":
level notify("room_scavenger_end");
//failure
break;

case "parkour":
level notify("room_parkour_end");
//failure
break;
}
}

/*******************************************************************
Challenge - Kill Zombies
Objective: Get X amount of kills while in an enclosed space.
Also survive using a completely random weapon.
*******************************************************************/
roomKillZM(player)
{
level endon("end_game");
level endon("room_kill_zm_end");

player thread giveRandomWeapon();
player thread killZMCounter();
player thread generateZMHUD();
}

giveRandomWeapon()
{
self endon("death");
self endon("disconnect");

primaryWeapons = self GetWeaponsListPrimaries();
weaponToGive = maps\_zombiemode_weapons::treasure_chest_ChooseRandomWeapon(self);
self GiveWeapon(weaponToGive);
self GiveMaxAmmo(weaponToGive);
self SwitchToWeapon(weaponToGive);
self DisableWeaponCycling();

//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self thread reEnableWeapons(weaponToGive, primaryWeapons[0]);
}

killZMCounter()
{
level endon("end_game");
level endon("room_kill_zm_end");
self endon("death");
self endon("disconnect");

curr_kills = 0;
max_kills = level.challenge_zm_kills;

while(IsAlive(self))
{
self waittill("zom_kill");
curr_kills++;

self.ZM_AMTHUD SetValue(curr_kills);
self.ZM_AMTHUD_Shadow SetValue(curr_kills);

if(curr_kills >= max_kills)
{
level thread giveChallengeAward(self, "kill_zm");
break;
}
}
}

generateZMHUD()
{
//DUKIP - Something I tossed in from old ZM Counter I had done with WhiteDevilHD.
x = 275;
y = 465;
self.ZM_HUD = newClientHudElem( self );
self.ZM_HUD.x = (x+1);
self.ZM_HUD.y = (y-11);
self.ZM_HUD.foreground = 1;
self.ZM_HUD.fontscale = 1.05;
self.ZM_HUD.alpha = 1;
self.ZM_HUD.sort = 0;
self.ZM_HUD.color = (1, 0, 0);
self.ZM_HUD SetText("Zombies Killed: ");

  self.ZM_HUD_Shadow = newClientHudElem( self );
self.ZM_HUD_Shadow.x = (x+2);
self.ZM_HUD_Shadow.y = (y-11);
self.ZM_HUD_Shadow.foreground = 1;
self.ZM_HUD_Shadow.fontscale = 1.05;
self.ZM_HUD_Shadow.alpha = 0.4;
self.ZM_HUD.sort = -1;
self.ZM_HUD_Shadow.color = (0, 0, 0);
self.ZM_HUD_Shadow SetText("Zombies Killed: ");
self.ZM_HUD_Shadow SetParent(self.ZM_HUD);

self.ZM_AMTHUD = newClientHudElem( self );
self.ZM_AMTHUD.x = (x+10);
self.ZM_AMTHUD.y = (y-11);
self.ZM_AMTHUD.foreground = 1;
self.ZM_AMTHUD.fontscale = 1.05;
self.ZM_AMTHUD.alpha = 1;
self.ZM_AMTHUD.sort = 0;
self.ZM_AMTHUD.color = (1, 0, 0);
self.ZM_AMTHUD SetValue(0);

  self.ZM_AMTHUD_Shadow = newClientHudElem( self );
self.ZM_AMTHUD_Shadow.x = (x+11);
self.ZM_AMTHUD_Shadow.y = (y-11);
self.ZM_AMTHUD_Shadow.foreground = 1;
self.ZM_AMTHUD_Shadow.fontscale = 1.05;
self.ZM_AMTHUD_Shadow.alpha = 0.4;
self.ZM_AMTHUD.sort = -1;
self.ZM_AMTHUD_Shadow.color = (0, 0, 0);
self.ZM_AMTHUD_Shadow SetValue(0);
self.ZM_AMTHUD_Shadow SetParent(self.ZM_AMTHUD);

self thread destroyZMHUD();
}

destroyZMHUD()
{
//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self.ZM_HUD Destroy();
self.ZM_HUD_Shadow Destroy();

self.ZM_AMTHUD Destroy();
self.ZM_AMTHUD_Shadow Destroy();
}

/*******************************************************************
Challenge - Target Practice
Objective: Test your skills here! Shoot all the teddy's to win.
----
*******************************************************************/
roomTargetPractice(player)
{
level endon("end_game");
level endon("room_tp_end");

}

/*******************************************************************
Challenge - Trivia
Objective: Answer the questions or fail.
----
*******************************************************************/
roomTrivia(player)
{
level endon("end_game");
level endon("room_trivia_end");

//DUKIP - For this I'm going through a menu based solution.
level.trivia_question_num = 1;
level.trivia_question_passed = 0;
//DUKIP - 5 for now.
level.trivia_total_questions = 5;
level thread triviaGenerateQuestions();
player thread triviaMenu();
}

triviaGenerateQuestions()
{
//DUKIP - Convert to level, answers will be parsed by strTok in updated triviaSetVars().
//Should randomize it keep answer first token for easy access?
level.trivia_questions = [];
level.trivia_questions[1] = "American?";
level.trivia_questions[1]["answers"] = "Dempsey,Eagles,Freedom";
level.trivia_questions[2] = "German?";
level.trivia_questions[2]["answers"] = "Richtofen,Hitler,MP40";
level.trivia_questions[3] = "Russian?";
level.trivia_questions[3]["answers"] = "Nikolai,Vodka,Boobs";
level.trivia_questions[4] = "Japanese?";
level.trivia_questions[4]["answers"] = "Takeo,Fish,Honor";
level.trivia_questions[5] = "1337est?";
level.trivia_questions[5]["answers"] = "DUKIP,SparkyMcSparks,Cookies";
}

triviaMenu()
{
triviaSetVars();
self thread triviaMenuResponse();
}

triviaSetVars()
{
//DUKIP - Console handles strings by "@""rather than "&"
//Menu handler USED strings.
setDvar("ui_number_choice1", "A)" );
setDvar("ui_number_choice2", "B)" );
setDvar("ui_number_choice3", "C)" );
//Leave them blank for initial set.
//Still have to add support for randomized questions
//requires arrays and stuff :D
setDvar("ui_choice1", "");
setDvar("ui_choice2", "");
setDvar("ui_choice3", "");

}

triviaMenuResponse()
{
level endon("end_game");
level endon("room_trivia_end");

for(;;)
{
self waittill("menuresponse", menu, response);

if(menu != "dukip_trivia_menu")
continue;

answer = trivaDetermineAnswer(response, level.trivia_question_num);
if(answer)
level.trivia_question_passed++;
level.trivia_question_num++;
//update question now
}
}

trivaDetermineAnswer(input, num)
{
answer = strTok(level.trivia_questions[num], ",");

if(input == answer[0])
return true;

return false;
}

/*******************************************************************
Challenge - Scavenger Hunt
Objective: Find all the items in time or you fail :D!
----
*******************************************************************/
roomScavenger(player)
{
level endon("end_game");
level endon("room_scavenger_end");

level thread setupScavengerRoom(player);
}

setupScavengerRoom(player)
{
level endon("end_game");
level endon("room_scavenger_end");

level.challenge_found_scav_items = 0;
scavenger_items = GetEntArray("room_scavenger_item", "targetname");
level.challenge_max_scav_items = scavenger_items.size;
array_thread(scavenger_items, ::scavengerItemTrigger);
}

scavengerItemTrigger()
{
self Show();
self trigger_on();
//DUKIP - Might have to spawn trigger_radius rather than assuming trigger_use will work out right in the end.
while(true)
{
self waittill("trigger", player);

if( !is_player_valid( player ) )
{
player thread ignore_triggers( 0.5 );
continue;
}
self trigger_off();
//DUKIP - Play some FX or sound?
//play_sound_at_pos( "sound thing!", self.origin, self );
//PlayFXOnTag(level._effect["the effect"], self, "tag_origin");

level.challenge_found_scav_items++;
if(level.challenge_found_scav_items == level.challenge_max_scav_items)
{
//DUKIP - No idea if I'll continue with this.
//self thread scavengerItemAnimation();
break;
}
}
}

/*******************************************************************
Challenge - Parkour
Objective: Run through a parkour course. Fail you get killed or so.
----
*******************************************************************/
roomParkour(player)
{
level endon("end_game");
level endon("room_parkour_end");

player thread setParkourClass();
level thread setupParkourRoom(player);
}

setParkourClass()
{
self endon("death");
self endon("disconnect");

primaryWeapons = self GetWeaponsListPrimaries();
self GiveWeapon("hands?");
self SwitchToWeapon("hands?");
self DisableWeaponCycling();

//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_kill_zm_end", level, "end_game", self, "fake_death", self, "player_downed" );
self thread reEnableWeapons("hands?", primaryWeapons[0]);
}

setupParkourRoom(player)
{
level endon("end_game");
level endon("room_parkour_end");
player endon("death");
player endon("disconnect");

//DUKIP - This is a trigger radius by the way.
//Have this trigger a bit down from the platforms so the player can see that he messed up or you know experience it :D
//You get my drift (hopefully).
parkourFailTrigg = GetEnt("room_parkour_fail_trigg", "targetname");
parkourFailTrigg thread parkourFailure();
}

parkourFailure()
{
level endon("end_game");
level endon("room_parkour_end");

while(true)
{
self waittill("trigger", player);

level thread giveChallengeFail(player, "parkour");
}
}

Working all over the code :p
Instance #2

Nice :D Looking good! I assume for the parkour challenge, I should just make a weapon file which only has the viewhands in it, and have it give the player that "weapon" in the script? Or I guess I could just use the knuckle crack weapon file but get rid of the pack a punch anims in it.
Last Edit: February 25, 2015, 06:53:19 am by thezombiekilla6
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
There should be sprinting animus in bo1 or bo2so I suggest using that. Also noticed a few holes in code sorry wrote it at 9-10PM, brain dead now.
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
There should be sprinting animus in bo1 or bo2so I suggest using that. Also noticed a few holes in code sorry wrote it at 9-10PM, brain dead now.

haha, its fine. I am fixing to go to bed anyway, will talk more tomorrow about it.

 
Loading ...