



Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
/*******************************************************************
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");
//DUKIP - Set the player before starting the TP.
player tpSetupPlayer();
level thread tpStartup(player);
level thread challengeSetTimer(30, player, "target_practice");
}
tpStartup(player)
{
level endon("end_game");
level endon("room_tp_end");
tpEnts = GetEntArray("room_tp_bears", "targetname");
level.challenge_teddy_hit = 0;
level.challenge_total_teddy = tpEnts.size;
//fix this
level.tp_angles_vector = (90, 0, 0);
//play some sound/fx?
//countdown 3-2-1-go!
array_thread(tpEnts, ::tpMain);
}
tpMain()
{
level endon("end_game");
level endon("room_tp_end");
self thread tpDamageFeedback();
self thread tpMovementThink();
}
tpDamageFeedback()
{
level endon("end_game");
level endon("room_tp_end");
self SetCanDamage(true);
self waittill( "damage", damage, attacker );
self SetCanDamage(false);
level.challenge_teddy_hit++;
//DUKIP - make sure to in _zombiemode -> add_sound( "ding", "sound_alias" );
//self play_sound_on_ent("ding");
//play some feather fx (or maybe the bear will already do it).
self Hide();
self.is_active = false;
if(level.challenge_teddy_hit >= level.challenge_total_teddy)
level thread tpCleanup(attacker);
}
tpCleanup(player)
{
level endon("end_game");
level endon("room_tp_end");
level thread tpReset();
level thread giveChallengeAward(player, "target_practice");
tpEnts = GetEntArray("room_tp_bears", "targetname");
for(i = 0; i < tpEnts.size; i ++)
{
tpEnts[i] Show();
tpEnts[i] SetOrigin(tpEnts[i].original_pos);
}
}
tpMovementThink()
{
level endon("end_game");
level endon("room_tp_end");
self.original_pos = self.origin;
self.moving_to_node = undefined;
self.is_active = true;
while(true && self.is_active)
{
goToNode = tpSelectNode(self);
if(IsDefined(goToNode))
{
self.moving_to_node = true;
goToNode.is_active = true;
self MoveTo(goToNode.origin, 1, 0.05, 0.05);
self waittill("movedone");
self.moving_to_node = false;
goToNode.is_active = false;
continue;
}
wait 0.05;
}
}
tpSelectNode(ent)
{
level endon("end_game");
level endon("room_tp_end");
while(self.moving_to_node)
wait 0.05;
originalTPNodes = GetEntArray("room_tp_nodes", "targetname");
filterNodes = tpGenerateFilteredNodes(originalTPNodes);
goodNodes = array_exclude(originalTPNodes, filterNodes);
//DUKIP - Need to generate node based on 1x1 away.
//So fix asap.
theNode = tpSelectRandomNode(goodNodes);
return theNode;
}
tpSelectRandomNode(nodes)
{
nodes = array_randomize(nodes);
goodNode = undefined;
while(true)
{
if(goodNode)
break;
for(i = 0; i <= nodes.size; i++)
{
coinflip = cointoss();
if(coinflip) //go up
{
coinflip = cointoss();
if(coinflip) //go left
{
}
else //go right
{
}
}
else //go down
{
coinflip = cointoss();
if(coinflip) //go left
{
}
else //go right
{
}
}
}
}
return goodNode;
}
tpGenerateFilteredNodes(nodes)
{
inUseNodes = [];
for(i = 0; i < nodes.size; i++)
{
if(nodes[i].is_active)
inUseNodes[inUseNodes.size] = nodes[i];
}
return inUseNodes;
}
tpSetupPlayer()
{
level endon("end_game");
level endon("room_tp_end");
self AllowStand(true);
self AllowCrouch(false);
self AllowProne(false);
self AllowSprint(false);
self SetMoveSpeedScale(0);
self SetPlayerAngles(level.tp_angles_vector);
self thread giveTPRandomWeapon();
self thread tpReEnableMovement();
}
giveTPRandomWeapon()
{
level endon("end_game");
level endon("room_tp_end");
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 DisableOffhandWeapons();
self DisableWeaponCycling();
//DUKIP - Modified function from T6, script resumes when one of these 4 notifies are received.
waittill_any_ents_four( level, "room_tp_end", level, "end_game", self, "fake_death", self, "player_downed" );
self thread reEnableWeapons(weaponToGive, primaryWeapons[0]);
}
tpReEnableMovement()
{
level endon("end_game");
level endon("room_tp_end");
waittill_any_ents_four( level, "room_tp_end", level, "end_game", self, "fake_death", self, "player_downed" );
if(maps\_laststand::player_is_in_laststand())
{
self SetMoveSpeedScale(1);
return;
}
self AllowStand(true);
self AllowCrouch(true);
self AllowProne(true);
self AllowSprint(true);
self SetMoveSpeedScale(1);
}
![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
Couldn't you just add and remove the possible ents from an array based off of the distance and when it was last used? Haven't really looked at code but I don't see why that wouldn't work.
I could haven't thought about really. I've never messed with 3d/vector stuff so I wouldn't know how to use distance functionality yet.

![]() | |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |
You've never used distance before?
![]() | Has released one or more maps to the UGX-Mods community. |
![]() | Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community. |
![]() BO3 Modtools Alpha | This user has access to the Black Ops 3 Modtools Alpha |