Modme Forums
Menu:

Adding the progress bar for buildables.

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


ModmeBot:

Thread By: Immens3_Modder
Hi, I am currently working on a script for a build-able jetgun and it works, however its very basic and based on a script i found on ugx and i was wondering how to improve it. Sidenote at the moment it spawns a thundergun because i don't have access to tranzit to port the actual jetgun however i am working on the scripts for the jetgun separately, help with obtaining jetgun xmodels/xanims would also be helpful.
The current code:

function jetgun_craft()
{
	workbench = getent("jetgun_craftable_trigger","Targetname");
	workbench SetHintString("Missing parts");
	workbench SetCursorHint("HINT_NOICON");
	
	level.allParts = 0;
	level.finishedCraft = 3;

	level thread jetEngine();
	level thread tubing();
	level thread blades();
}

function jetEngine()
{
	jetgunTrig = getent("jetgun_part1_trigger", "targetname");
	jetgunTrig SetHintString("Press and hold ^3&&1 ^7to pickup part");
	jetgunTrig SetCursorHint("HINT_NOICON");
	jetgunModel = getent("jetgun_part1", "targetname");
	
	while(1)
	{
		jetgunTrig waittill("trigger", Player);
		
		level.allParts++;
		
		IPrintLnBold(level.allParts);
		
		thread buildjetgun();
		
		break;
	}
	
	jetgunTrig delete ();
	jetgunModel delete();
	
}

function tubing()
{
	tubingTrig = getent("jetgun_part2_trigger", "targetname");
	tubingTrig SetHintString("Press and hold ^3&&1 ^7to pickup part");
	tubingTrig SetCursorHint("HINT_NOICON");
	tubingModel = getent("jetgun_part2", "targetname");
	
	while(1)
	{
		tubingTrig waittill("trigger", Player);
		
		level.allParts++;
		
		IPrintLnBold(level.allParts);
		
		thread buildjetgun();
		
		break;
	}
	
	tubingTrig delete ();
	tubingModel delete();
	
}

function blades()
{
	bladesTrig = getent("jetgun_part3_trigger", "targetname");
	bladesTrig SetHintString("Press and hold ^3&&1 ^7to pickup part");
	bladesTrig SetCursorHint("HINT_NOICON");
	bladesModel = getent("jetgun_part3", "targetname");
	
	while(1)
	{
		bladesTrig waittill("trigger", Player);
		
		level.allParts++;
		
		IPrintLnBold(level.allParts);
		
		thread buildjetgun();
		
		break;
	}
	
	bladesTrig delete ();
	bladesModel delete();
	
}

function buildjetgun()
{
	
	while(1)
	{
		self waittill( level.allParts >= level.finishedCraft);
			
		if ( level.allParts >= level.finishedCraft)
		{
			IPrintLnBold("Bulit");
					
			workbench = getent("jetgun_craftable_trigger","Targetname");
			workbench SetHintString("^7Press and hold ^2&&1 ^7to craft Jet Gun");
			workbench SetCursorHint("HINT_NOICON");
			workbench waittill("trigger", player);
			
			workbench SetHintString("");

			wait(2.7);
			
			IPrintLnBold("Done");

			workbench SetHintString("^7Press and hold ^2&&1 ^7for Jetgun");
			workbench SetCursorHint("HINT_NOICON");

			workbench waittill("trigger", player);
			
			weapon = GetWeapon( "thundergun" );
			player TakeWeapon( weapon ); 
			player zm_weapons::weapon_give( weapon, undefined, undefined, true ); 
			
			workbench delete();
				}
		break;
	}
}


ModmeBot:

Reply By: mathfag
Start with this

self.hackProgressBar = player hud::createPrimaryProgressBar();
				self.hackProgressText = player hud::createPrimaryProgressBarText();
				self.hackProgressBar hud::updateBar( 0.0, 0.0 );
				self.hackProgressBar hud::showElem();
				self.hackProgressText hud::showElem();
				self.hackProgressText SetText("building craft");

update with this (you may want to use a for loop here)
self.hackProgressBar hud::updateBar( progress from 0 to 1, 0.0 );

end with this
self.hackProgressBar hud::destroyElem();
					self.hackProgressText hud::destroyElem();




using
#using scripts\shared\hud_util_shared;


ModmeBot:

Reply By: Harry Bo21
once again someone recreating something already in the tools

just add your craftable to the 3arc system - its not hard - and all the code is set up, working, and had 2 years of bug testing and corrections


ModmeBot:

Reply By: Immens3_Modder
Thanks, that works