Modme Forums

Play Fx and spawn trigger on Brutus Corpse

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


ModmeBot:

Thread By: Abnormal202

So I'm scripting the easter egg for Psh's map, Gulag, and part of it requires a "soul" to appear out of dead Brutus bodies, that can be picked up. I've edited the nsz_brutus.gsc to spawn the Brutus's at a scripted time (which works) but for some reason I cannot get an fx or trigger to spawn on their corpses. Here's what I have for the death function I've changed:

function new_death()
{
	self waittill( "death" );
	self.light delete(); 
	level.current_brutuses--;
	PlayFx( SPAWN_FX, self.origin ); 
	if(self.alternate_spawn == false)
	{
		if( level.current_brutuses < 1 )
			thread zm_powerups::specific_powerup_drop( undefined, self.origin);
	}
	else if(self.alternate_spawn == true && level.bruti_dead == 2)
	{
		thread zm_powerups::specific_powerup_drop( "full_ammo", self.origin);
	}
	self PlaySound( "brutus_helmet" ); 
	self PlaySound( "brutus_defeated_0"+randomintrange(0,3) ); 
	self PlaySound( "brutus_death" ); 
	
	nsz_iprintlnbold( "^2Brutus Died" ); 
	clone = spawn( "script_model", self.origin ); 
	clone.angles = self.angles; 
	clone SetModel( "bo2_brutus_fb" );
	self hide(); 
	clone UseAnimTree( #animtree ); 
	clone AnimScripted( "placeholder", clone.origin, clone.angles, %brutus_death );	
	wait( GetAnimLength(%brutus_death) ); 
	if(self.alternate_spawn == true)
	{
		level.bruti_dead ++;
		IPrintLnBold(level.bruti_dead + " down");
		if(level.bruti_dead == 3)
		{
			level notify("all_bruti_dead");
		}
		self soulspawn();
	}

	self delete(); 
	wait(30); 
	clone delete(); 
}
function soulspawn()
{
	invisible_ent = spawn( "script_model", self.origin + (0,0,40));
	invisible_ent SetModel( "tag_origin" );
	PlayFxOnTag( SOUL_FX, invisible_ent, "tag_origin" );

	trig = spawn("trigger_use", invisible_ent.origin);
	trig SetHintString(level.soul_hintstring);
	trig waittill("trigger",player);
	invisible_ent Delete();
	trig Delete();
}



Everything works how it should except that the FX and trigger don't spawn. Before you ask, I have precached my FX at the top of the function:

#define SOUL_FX			"zombie/fx_powerup_on_green_zmb" 
#precache( "fx", SOUL_FX );



is there something I'm missing? can you actually spawn a trigger use like that?


ModmeBot:

Reply By: ZoekMeMaar

function new_death()
{
	self waittill( "death" );
	self.light delete(); 
	level.current_brutuses--;
	PlayFx( SPAWN_FX, self.origin ); 
	if(self.alternate_spawn == false)
	{
		if( level.current_brutuses < 1 )
			thread zm_powerups::specific_powerup_drop( undefined, self.origin);
	}
	else if(self.alternate_spawn == true && level.bruti_dead == 2)
	{
		thread zm_powerups::specific_powerup_drop( "full_ammo", self.origin);
	}
	self PlaySound( "brutus_helmet" ); 
	self PlaySound( "brutus_defeated_0"+randomintrange(0,3) ); 
	self PlaySound( "brutus_death" ); 
	
	nsz_iprintlnbold( "^2Brutus Died" ); 
	clone = spawn( "script_model", self.origin ); 
	clone.angles = self.angles; 
	clone SetModel( "bo2_brutus_fb" );
	self hide(); 
	clone UseAnimTree( #animtree ); 
	clone AnimScripted( "placeholder", clone.origin, clone.angles, %brutus_death );	
	wait( GetAnimLength(%brutus_death) ); 
	if(self.alternate_spawn == true)
	{
		level.bruti_dead ++;
		IPrintLnBold(level.bruti_dead + " down");
		if(level.bruti_dead == 3)
		{
			level notify("all_bruti_dead");
		}
		clone thread soulspawn(); // calls the script on the clone
	}
	
	self delete(); 
	if(self.alternate_spawn != true){
	    wait(30); 
	    clone delete();
	}
}
function soulspawn()
{
	PlayFxOnTag( SOUL_FX, self, "tag_origin" );// no need to make an invisble model we can use the origin of the clone
	trig = spawn("trigger_use", self.origin);
	trig SetHintString(level.soul_hintstring);
	trig SetCursorHint("HINT_NOICON");
	trig waittill("trigger",player);
	self Delete(); // delets clone if trigger is used
	trig Delete(); // delets trigger if trigger is used
}



So i changed a bit, u were calling stuff on self model as that gets hidden and clone is set in place we need to call script on clone, also i deleted the invisble model no need to use that just use origin of clone


ModmeBot:

Reply By: Abnormal202

ZoekMeMaar
function new_death()
{
	self waittill( "death" );
	self.light delete(); 
	level.current_brutuses--;
	PlayFx( SPAWN_FX, self.origin ); 
	if(self.alternate_spawn == false)
	{
		if( level.current_brutuses < 1 )
			thread zm_powerups::specific_powerup_drop( undefined, self.origin);
	}
	else if(self.alternate_spawn == true && level.bruti_dead == 2)
	{
		thread zm_powerups::specific_powerup_drop( "full_ammo", self.origin);
	}
	self PlaySound( "brutus_helmet" ); 
	self PlaySound( "brutus_defeated_0"+randomintrange(0,3) ); 
	self PlaySound( "brutus_death" ); 
	
	nsz_iprintlnbold( "^2Brutus Died" ); 
	clone = spawn( "script_model", self.origin ); 
	clone.angles = self.angles; 
	clone SetModel( "bo2_brutus_fb" );
	self hide(); 
	clone UseAnimTree( #animtree ); 
	clone AnimScripted( "placeholder", clone.origin, clone.angles, %brutus_death );	
	wait( GetAnimLength(%brutus_death) ); 
	if(self.alternate_spawn == true)
	{
		level.bruti_dead ++;
		IPrintLnBold(level.bruti_dead + " down");
		if(level.bruti_dead == 3)
		{
			level notify("all_bruti_dead");
		}
		clone thread soulspawn(); // calls the script on the clone
	}
	
	self delete(); 
	if(self.alternate_spawn != true){
	    wait(30); 
	    clone delete();
	}
}
function soulspawn()
{
	PlayFxOnTag( SOUL_FX, self, "tag_origin" );// no need to make an invisble model we can use the origin of the clone
	trig = spawn("trigger_use", self.origin);
	trig SetHintString(level.soul_hintstring);
	trig SetCursorHint("HINT_NOICON");
	trig waittill("trigger",player);
	self Delete(); // delets clone if trigger is used
	trig Delete(); // delets trigger if trigger is used
}



So i changed a bit, u were calling stuff on self model as that gets hidden and clone is set in place we need to call script on clone, also i deleted the invisble model no need to use that just use origin of clone

Oh sorry, guess I should've said I figured it out. I had contacted NSZ and he helped me work it out.


ModmeBot:

Reply By: Exofile

Abnormal202

Oh sorry, guess I should've said I figured it out. I had contacted NSZ and he helped me work it out.

Feel free to post the solution here for anyone that might need the same help in the future.