Modme Forums
Menu:

Need some help with my easter egg progression script

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


ModmeBot:

Thread By: modric
Ok so my easter egg will be using other people's scripts but the first step to initiate the ee is custom. The problem is that I am not good at scripting in the slightest so I need help getting it sorted. Basically I want to have a trigger with a hintstring make other models/triggers appear to collect and then the rest of the ee is other scripts. So really i just need to figure out how to make the trigs waittill one trig is used before they show. Here is what i have so far:

function tony_ee()
{

	start_trig = GetEnt("ee_start_trig", "targetname");
	start_trig SetHintString("Press to start quest");
	tony_trigs = GetEntArray("tony_trig", "targetname");
	tony_trigs hide();
	//also want tony_trigs model to be hidden/shown with trigs
	self waittill(//start trig is triggered)
	Show tony_trigs (); //and tony trigs models
	//these tony trigs are already working trigs from another script and the rest of the ee is figured out. 
}


ModmeBot:

Reply By: mathfag
Here you go:

function tony_ee()
{

	start_trig = GetEnt("ee_start_trig", "targetname");
	start_trig SetHintString("Press to start quest");
	tony_trigs = GetEntArray("tony_trig", "targetname");
	tony_model = GetEntArray("tony_model", "targetname");
	
	foreach(trig in tony_trigs)
		{
		trig TriggerEnable(0); //you could use Hide();
		IPrintLnBold("trigger hidden");
		}

	foreach(trig in tony_model)
		{
		trig Hide();
		IPrintLnBold("model hidden");
		}

	//also want tony_trigs model to be hidden/shown with trigs
	start_trig waittill("trigger", player);


	foreach(trig in tony_trigs)
		{
		trig TriggerEnable(1); //you could use Show();
		IPrintLnBold("trigger shown");
		}	

	foreach(trig in tony_model)
		{
		trig Show();
		IPrintLnBold("model shown");
		}

}


ModmeBot:

Reply By: modric
Didn't work, the hidden trigs and objects were visible the whole time and every trig including the start ee one says not available. Do i need to thread something?


ModmeBot:

Reply By: mathfag

modric
Didn't work, the hidden trigs and objects were visible the whole time and every trig including the start ee one says not available. Do i need to thread something?

did you actually start the function (thread functionname();) because the start trigger should say
Press to start quest
no questions asked.


also

to remove the not available from the other triggers add

trig SetHintString("");
trig SetCursorHint("HINT_NOICON");
where the triggers are being hidden and

trig SetHintString("insert text here");
when you make them reapear


ModmeBot:

Reply By: modric
Ok thanks so far so good, but I think it would be easier to just seperate this ee step from others to make it easier to script. Could I make the tony objects and triggers disappear once triggered? also could I make them only triggered by a trigger damage with a specific gun? like the ray gun or something?


ModmeBot:

Reply By: mathfag
Here's an update. Add trigger_damages and make the model the target of the trigger. Make the trigger and model into a prefab (you don't need to) and copy paste it where ever you want as many times as you want. And make sure the models DON'T HAVE A TARGETNAME. It has to be autogenerated when you make them targets. To autogenerate shift click on the trigger then shift click on the model and press W.

function tony_ee()
{

	start_trig = GetEnt("ee_start_trig", "targetname");
	start_trig SetHintString("Press to start quest");
	tony_trigs = GetEntArray("tony_trig", "targetname");

	level.tonytrigs_total = tony_trigs.size;
	level.tonytrigs_current = 0;

	foreach(trig in tony_trigs)
		{
		trig TriggerEnable(0); //you could use Hide();
		IPrintLnBold("trigger hidden");
		hide_model(); //calling the hdie_model() function
		}

	start_trig waittill("trigger", player);


	foreach(trig in tony_trigs)
		{
		trig TriggerEnable(1); //you could use Show();
		IPrintLnBold("trigger shown");
		trig thread shoot_tony();
		}	

}


function hide_model()
{
model = GetEnt( self.target, "targetname" );
model Hide();
IPrintLnBold("model hidden");	
}


function shoot_tony()
{
model = GetEnt( self.target, "targetname" );
model Show();
IPrintLnBold("model shown");

while(1)
	{
	self waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
	if(weapon == GetWeapon("INSERT GUN NAME HERE"))
		{
		PlayFX("fx name/path",model.origin);
		model PlaySound("sound aliat");
		wait(0.05); //only is you're playing sound
		model Delete();
		trig Delete();
		level.tonytrigs_current++;
		IPrintLnBold("Collected "+level.tonytrigs_current+"/"+level.tonytrigs_total);	
		break;
		}
	}
}


ModmeBot:

Reply By: modric
Wow thank you this script is awesome. I just want to ask though , for the final reward, would it be possible to have a simple door move as one of the "rewards" for collecting all 3? just a simple script model to move or disappear would be awesome


ModmeBot:

Reply By: mathfag
In the last function after the iprintlnbold and before the break; add thread tony_reward();

and this to the bottom:

function tony_reward()
{
perk_struct = struct::get("perk_struct", "targetname");
doors = GetEntArray("tony_doors","targetname");
rewards = array("door", "powerup", "perk"); //remove what you don't want



doordis = 1; //door disappear = 1, move = 0
drop = "fire_sale"; //check bellow and delete the line if you want a random drop
perk = "specialty_armorvest"; //check _zm_perks.gsh

if(level.tonytrigs_current == level.tonytrigs_total)
	{
	foreach(reward in rewards)
		{
		if(reward == "door")
			{
			if(doordis == 1)
				{
				foreach(door in doors)
				door Delete();
				}
			else
				{
				door MoveZ(-200,0.5,0.1,0.1); //MoveZ(<point>,<time>,[acceleration time],[deceleration time])
				}
			}

		if(reward == "powerup")
			{ //drop is defined above, delete the line you don't want
			zm_powerups::specific_powerup_drop(drop, perk_struct.origin,undefined ,undefined ,undefined , undefined, true); 
			zm_powerups::powerup_drop(perk_struct.origin);
			}

		if(reward == "perk")
			{
			foreach(player in GetPlayers())
				{
				player zm_perks::give_perk(perk)
				}	
			}
		}

	}
}	</time></point>

I made is so you can open multiple doors but you can place only 1 (or 0) if you want.
Also I wrote this in 5 mins so hope it works.


ModmeBot:

Reply By: Harry Bo21
you need to run

entity connectPaths()


on the blocker before removing it or zombies will derp out if a player goes in there