Modme Forums

How would I make a zetsubou style round based ee?

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


ModmeBot:

Thread By: modric
Like reach round 50 and a model appears outside the map... maybe even with a trigger that plays a song or fx or gives the player points.


ModmeBot:

Reply By: Abnormal202

level.round_number

that should give you the round number. It also might help to use waittills such as:
level waittill( "start_of_round" );
//or
level waittill( "end_of_round" );


ModmeBot:

Reply By: mathfag

level waittill("between_round_over");
if(level.round_number == 50)
{
do stuff
}


ModmeBot:

Reply By: modric
I have this and nothing happens. I want it to spawn in a model and trigger and also play a sound when the round is reached. The model and shootable trigger are shot and then the shootable trig opens a secret door.

function distant()
{
	
level waittill("between_round_over");
if(level.round_number == 5)
{
IPrintLnBold ("Super Easter Egg confirmed");
}


ModmeBot:

Reply By: Scobalula

modric
I have this and nothing happens. I want it to spawn in a model and trigger and also play a sound when the round is reached. The model and shootable trigger are shot and then the shootable trig opens a secret door. function distant() { level waittill("between_round_over"); if(level.round_number == 5) { IPrintLnBold ("Super Easter Egg confirmed"); }


You need a loop that will constantly check each time then break when you get to round x and execute your code, since this will just return on first notify since it won't be round 5 (it will be round 1 or 2).


ModmeBot:

Reply By: mathfag

while(1)
{
	level waittill("between_round_over");
	if(level.round_number == 50)
	{
	do stuff
	}
}


ModmeBot:

Reply By: modric

mathfag
while(1) { level waittill("between_round_over"); if(level.round_number == 50) { do stuff } }

To be honest I don't know what your change does exactly. Should I just run function distant() and then this?


ModmeBot:

Reply By: mathfag

modric
mathfag whle(1) { level waittill("between_round_over"); if(level.round_number == 50) { do stuff } } To be honest I don't know what your change does exactly. Should I just run function distant() and then this?


while(1) //repeats forever
{
	level waittill("between_round_over"); //when round changes this runs
	if(level.round_number == 50) //if the round number is 50
	{ //stuff in here happens
	do stuff
	}
}//start again

the change is that before it only checked once now it does it forever


ModmeBot:

Reply By: modric
Since you already helped me with a shootable script, I figured I could use that one and combine with this for the actual reward part of the distant easter egg. I'm sure I screwed something up when combining them but let me know if this would work

function tony_distant()
{

	trig = GetEnt("distant_trig", "targetname");

	level.trig_total = tony_trigs.size;
	level.trig_current = 0;

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

	while(1) //repeats forever

	level waittill("between_round_over"); //when round changes this runs
	if(level.round_number == 5) //if the round number is 50


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

}


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


function shoot_tony2()
{
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("bo3_m1911"))
		{
		IPrintLnBold("Yayyyyy");
		PlayFX("fx_smk_explode_lg",model.origin);
		model PlaySound("Samlullaby");
		wait(0.05); //only is you're playing sound
		model Delete();
		level.tonytrigs_current++;
		IPrintLnBold("Collected tony "+level.tonytrigs_current+"/"+level.tonytrigs_total);	
		tony_reward();
		break;
		}
	}
}


ModmeBot:

Reply By: Harry Bo21


trig = GetEnt("distant_trig", "targetname");

level.trig_total = tony_trigs.size;


instantly

tony_trigs - not defined

and its not like you just mis typed "trig" either - coz that would still be an error - as it isnt an array


hide_model()

doesnt exist - and seemingly would do nothing

while(1) //repeats forever


syntax error... no parenthesis...


if(level.round_number == 5) //if the round number is 50


syntax error... no parenthesis... - again ( and thats also round 5 - not 50... )

level.tonytrigs_current++;


another error - level.tonytrigs_current is not defined, so that is

"undefined" + 1

which also means that...

IPrintLnBold("Collected tony "+level.tonytrigs_current+"/"+level.tonytrigs_total);	


is also yet another error... ( infact, even better - its "two" errors in one line )

and


tony_reward();


is again - another undefined function




Please pay more attention to the scripts you post to people or refrain from giving them. Thats 7 complete break errors


ModmeBot:

Reply By: modric
Thank you for your help Harry with the syntax stuff, I tried to sort out the syntax errors, but still feel the
while (1) //repeats forever
level waittill("between_round_over"); //when round changes this runs
if level.round_number == 5 stuff needs parenthesis. I am more concerned with the concept of the script, that everything lines up, since this is 2 scripts mixed that include some concepts I am not so familiar with. I am going to test it soon assuming the syntax is cleaned up.

function tony_distant()
{

	trig = GetEnt("distant_trig", "targetname");

	level.trig_total = trigs.size;
	level.trig_current = 0;

	foreach(trig in trigs)
		{
		trig Hide(); //you could use Hide();
		IPrintLnBold("trigger hidden");
		hide_model2(); //calling the hdie_model() function
		}

	while (1) //repeats forever

	level waittill("between_round_over"); //when round changes this runs
	if level.round_number == 5 //if the round number is 50


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

}


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


function shoot_tony2()
{
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("bo3_m1911"))
		{
		IPrintLnBold("Yayyyyy");
		PlayFX("fx_smk_explode_lg",model.origin);
		model PlaySound("Samlullaby");
		wait(0.05); //only is you're playing sound
		model Delete();
		level.trigs_current++;	
		break;
		}
	}
}


ModmeBot:

Reply By: Harry Bo21

trig = GetEnt("distant_trig", "targetname");

	level.trig_total = trigs.size;


still have an error immediatly

trig - is not an array

while (1) //repeats forever


you still havent added a parenthesis here

if level.round_number == 5 //if the round number is 50


5 still isnt 50

hide_model2(); //calling the hdie_model() function


is running on "level" not the trig - level has no "target"

level.trigs_current++;	


is "still" a undeclared variable ( you have spelt it wrong )


ModmeBot:

Reply By: modric
yea sorry i left some syntax in there i kind of rushed that, its all cleaned up now.


ModmeBot:

Reply By: mathfag

modric
yea sorry i left some syntax in there i kind of rushed that, its all cleaned up now.

read this

http://natesmithzombies.com/wiki.html


ModmeBot:

Reply By: Harry Bo21

modric
yea sorry i left some syntax in there i kind of rushed that, its all cleaned up now.

dude your not even paying attention to what im saying

trig = GetEnt("distant_trig", "targetname");

	level.trig_total = trigs.size;


"TRIG" IS NOT AN ARRAY


for the third flipping time


if level.round_number == 5 //if the round number is 50


and that is EVEN WORSE and STILL not round 50


while (1) //repeats forever


this still has no damn {}





posting bad code is one thing, fixing it but missing some is another - but three times? completely ignoring all the major errors that ive literally called out multiple times?


ModmeBot:

Reply By: mathfag


function tony_distant()
{

	trigs = GetEntArray("distant_trig", "targetname");

	level.trig_total = trigs.size;
	level.trig_current = 0;

	foreach(trig in trigs)
		{
		trig TriggerEnable(0); //you could use Hide();
		model = GetEnt( self.target, "targetname" );
		model Hide();
		IPrintLnBold("model and trigger hidden");	
		}

	while (1) //repeats forever
		{
		level waittill("between_round_over"); //when round changes this runs
		if (level.round_number == 50) //if the round number 50
			{
			foreach(trig in trigs)
				{
				trig TriggerEnable(1); //you could use Show();
				IPrintLnBold("trigger shown");
				trig thread shoot_tony2();
				}	
			}
		}
}


function shoot_tony2()
{
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("bo3_m1911"))
		{
		IPrintLnBold("Yayyyyy");
		PlayFX("fx_smk_explode_lg",model.origin);
		PlaySoundAtPosition("Samlullaby", model.origin); //if you use playsound it will stop when you delete the model i think
		wait(0.05); //only is you're playing sound
		model Delete();
		level.trigs_current++;	
		break;
		}
	}
}


ModmeBot:

Reply By: Harry Bo21
almost

model = GetEnt( self.target, "targetname" );



self == level


ModmeBot:

Reply By: mathfag

Harry Bo21
almost model = GetEnt( self.target, "targetname" ); self == level

Ye that line used to be in a new function
model = GetEnt( trig.target, "targetname" );


ModmeBot:

Reply By: modric
I actually made the script nearly from scratch before you posted your new one mathfag, obviously I am not very good at scripting stuff but let me know if I'm on the right track. I'll use yours for my map since its guaranteed to be better, but mine is a start I think.

function distant_monster()
{
	trig = GetEnt("distant_trig", "targetname")
	model = GetEnt("distant_model", "targetname")
	trig Hide();
	model Hide();

}
function show_distant()
{

	while (1) 

	level waittill("between_round_over"); 
	if (level.round_number == 5) 
	trig Show();
	model Show();
	IPrintLnBold ("model shown");

	trig thread shoot_distant();
}
function shoot_distant()
{	
	self waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
	if(weapon == GetWeapon("bo3_m1911"))
	{
		trig Delete();
		model Delete();
		PlayFX("fx_smk_explode_lg",model.origin);
		IPrintLnBold ("Yayyyyyyyy")

	}

}


ModmeBot:

Reply By: Harry Bo21

while (1) 

	level waittill("between_round_over"); 
	if (level.round_number == 5) 


are you ever gonna learn to use the {} ffs....

function show_distant()
{

	while (1) 

	level waittill("between_round_over"); 
	if (level.round_number == 5) 
	trig Show();
	model Show();
	IPrintLnBold ("model shown");

	trig thread shoot_distant();
}

"trig" AND "model" are both undeclared variables within this functions space too...

function shoot_distant()
{	
	self waittill( "damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel );
	if(weapon == GetWeapon("bo3_m1911"))
	{
		trig Delete();
		model Delete();
		PlayFX("fx_smk_explode_lg",model.origin);
		IPrintLnBold ("Yayyyyyyyy")

	}

}

same again here... and "trig" is "self" here anyway...


show_distant()


is not threaded on anything anywhere



test your code... stop posting game and compile crashing errors


ModmeBot:

Reply By: Harry Bo21

function do_the_stuff()
{
	e_model = getEnt( "distant_model", "targetname" );
	if ( !isDefined( e_model ) )
		return;
	
	e_model thread do_logic();
}

function do_logic()
{
	self hide();
	
	while ( level.round_number < 5 )
		wait .05;
	
	self show();
	self setCanDamage( 1 );
	
	while ( 1 )
	{
		self waittill( "damage", n_damage, e_attacker, v_dir, v_point, str_mod, str_model, str_tag, str_part, w_weapon, str_flags, e_inflictor, n_charge_level );
		if ( w_weapon.name == "bo3_m1911" )
			break;
	
	}
	playFX( "fx_smk_explode_lg", self.origin );
	playSoundAtPosition( "Samlullaby", self.origin );
	self delete();
}



this "only" needs a model, no trigger, and to be threaded


ModmeBot:

Reply By: modric
OK thanks, just out of curiosity, why did you choose to do model with no trigger in script? I assume I would target the trig with the model with w, but most scripts use trig targeting model. Is there any reason to use one or the other?


ModmeBot:

Reply By: Harry Bo21
1 - dont need a trigger
2 - hit detection will be "exact"
3 - using a trigger "as well" is a waste of your "limited" entities


ModmeBot:

Reply By: modric
OK that is much better, I just have never seen model only in a script. Thanks again