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.
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
// 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?
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
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.
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
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.
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 ambut yeah you'd have to increase its scope anyway or pass it
Last Edit: February 25, 2015, 05:39:19 am by jei9363
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(); }
//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]); }
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();
/******************************************************************* 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"; }
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", "");
/******************************************************************* 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");
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); }
//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(); }
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(); }
//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]); }
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();
/******************************************************************* 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"; }
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", "");
/******************************************************************* 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");
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); }
//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(); }
Nice 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