Modme Forums
Menu:

Need help making this function loop

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: modric
(Based loosely of of PSH's care package script)...This works perfectly and drops 1 package which gives a powerup and then deletes itself. I would like it to loop and have a plane fly either every few rounds or every couple minutes, anyway... i made it so that rather than deleting models and triggers, they get hidden and disabled and can be moved back to their start struct, ready to go through the sequence again. I think i need to set up some sort of loop with a return back to the first function in order to have the sequence loop every few rounds/minutes.

function carepackages()
{
	level flag::wait_till( "initial_blackscreen_passed" );
	//IPrintLn("Blackscreen passed.");
	care_model = GetEnt("care_model", "targetname");
	care_model Hide();
	model = GetEnt("plane1a", "targetname");
	model Hide();
	struct_start = struct::get("plane1a_start","targetname");
	model MoveTo((struct_start.origin), 1);
	care_struct = struct::get("care_start_struct","targetname");
	care_model MoveTo((care_start_struct.origin), 1);
	wait(100);
	IPrintLn("Wait over.");
	thread planesSetup();
}

function planesSetup()
{
	IPrintLnBold("Launching.");
	struct = struct::get("plane1a_stop","targetname");
	model = GetEnt("plane1a", "targetname");
	model Show();
	model PlaySoundToTeam("plane_fly", "allies");
	model MoveTo((struct.origin), 20);
	IPrintLnBold("model moved");
	
	wait(10);

	care_struct = struct::get("care_start_struct","targetname");
	plane_package_struct = struct::get("plane_package_struct","targetname");
	care_model = GetEnt("care_model", "targetname");
	care_model Show();
	care_model MoveTo((plane_package_struct.origin), 15);
	wait (15);
	PlayFX( level._effect["powerup_grabbed"], care_model.origin );
	care_model PlaySoundToTeam("fly_land_imp_fast_plr_metal" , "allies");
	care_model PlaySoundToTeam("zmb_couch_slam" , "allies");
	//IPrintLnBold("package dropped");

	model Hide();
	IPrintLnBold("plane deleted");

	care_trig = GetEnt("care_trig", "targetname" );
	care_trig TriggerEnable (false);
	IPrintLnBold("package trig off");
	wait(15);

	care_trig TriggerEnable (true);
	IPrintLnBold("package trig on");
	care_trig SetHintString("Hold to open care package");
	care_trig waittill( "trigger", player);
	IPrintLnBold("package opened");
	PlayFX( level._effect["powerup_grabbed"], care_model.origin );
	care_model Hide();
	IPrintLnBold("package deleted");
	care_trig SetHintString("");
	care_trig TriggerEnable(false);

 


	



        		rand = RandomIntRange( 0, 6 ); 
            if(rand == 0)
                thread zm_powerups::specific_powerup_drop( "full_ammo", plane_package_struct.origin);
            if(rand == 1)
                thread zm_powerups::specific_powerup_drop( "nuke", plane_package_struct.origin);
            if(rand == 2)
                thread zm_powerups::specific_powerup_drop( "insta_kill", plane_package_struct.origin);
            if(rand == 3)
                thread zm_powerups::specific_powerup_drop( "free_perk", plane_package_struct.origin);
            if(rand == 7)
                thread zm_powerups::specific_powerup_drop( "fire_sale", plane_package_struct.origin);
            if(rand == 5)
                thread zm_powerups::specific_powerup_drop( "double_points", plane_package_struct.origin);
            if(rand == 6)
                thread zm_powerups::specific_powerup_drop( "carpenter", plane_package_struct.origin);
          
        

	wait (1);

	return;
	
	
	
	
	
}	


ModmeBot:

Reply By: modric
I tested it without the return; at the end, i added that when messing around and cant edit the code i pasted so ignore it


ModmeBot:

Reply By: modric
I got it to loop after all, but if anyone knows how i could make it wait like 3 rounds instead of 200 seconds to start the plane that would be great


ModmeBot:

Reply By: mathfag

modric
I got it to loop after all, but if anyone knows how i could make it wait like 3 rounds instead of 200 seconds to start the plane that would be great

instead of the wait(); paste this:
rounds_to_wait = 3;
for( i=0;i<rounds_to_wait;i++ )="" {="" level="" waittill("between_round_over");=""></rounds_to_wait;i++>