Modme Forums

trigger for killing a player?

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


ModmeBot:

Thread By: KillJoyYT
is it possible to have a trigger use or damage for killing a player? I know you can end the game by setting the "script_flag_set_on_touching" to "end_game"


any help would be muchly appreciated :-)

I am already aware of the trigger hurt.

what I'm looking for is press x on the trigger and you're instantly downed


ModmeBot:

Reply By: mathfag

trig waittill("trigger", player);

player DoDamage(42069, player.origin);


ModmeBot:

Reply By: KillJoyYT
Thank you brother i will try this when i get out of work


ModmeBot:

Reply By: KillJoyYT
would it look something like this?

level down_player();

function down_player();
trig waittill (down_player, player);
player dodamage(42069, player.origin);


ModmeBot:

Reply By: HitmanVere

// Threading it, put this inside main()
level down_player_func();

// Put this all the way at bottom, func itself
function down_player_func()
{
	// Finding the trigger in map
	damaging_trigger = getEnt("damaging_trigger", "targetname");
	// Text that you want to show on trigger
	damaging_trigger setHintstring("This trigger might kill you");

	// In case you want this to be retriggerable again
	while(1)
	{
		// Wait for player to hit it
		damaging_trigger waittill("trigger", player);
		// Kill the player
		player doDamage(666, player.origin);
		// Just in case since it is a loop
		wait 0.05;
		// Uncomment this, if you want it to be triggered only once
		// break;
	}

	// If trigger can be hit only once, delete it
	damaging_trigger delete();
}

Just a simple thing, look at comments and modify to your liking


ModmeBot:

Reply By: Harry Bo21

HitmanVere
// Threading it, put this inside main() level down_player_func(); // Put this all the way at bottom, func itself function down_player_func() { // Finding the trigger in map damaging_trigger = getEnt("damaging_trigger", "targetname"); // Text that you want to show on trigger damaging_trigger setHintstring("This trigger might kill you"); // In case you want this to be retriggerable again while(1) { // Wait for player to hit it damaging_trigger waittill("trigger", player); // Kill the player player doDamage(666, player.origin); // Just in case since it is a loop wait 0.05; // Uncomment this, if you want it to be triggered only once // break; } // If trigger can be hit only once, delete it damaging_trigger delete(); } Just a simple thing, look at comments and modify to your liking

"loops" dont need waits - "infinite" loops need waits


ModmeBot:

Reply By: KillJoyYT
thank you guys i'll try this shortly :-)


ModmeBot:

Reply By: KillJoyYT
I put a trigger use in my game with the targetname damaging_trigger
I put the script in my gsc and as soon as I start the game up it says

"game over"
"you survived 0s"




I deleted a part of the script and it launched me into the game but the trigger wasn't showing


ModmeBot:

Reply By: Harry Bo21

KillJoyYT
I put a trigger use in my game with the targetname damaging_trigger I put the script in my gsc and as soon as I start the game up it says "game over" "you survived 0s" I deleted a part of the script and it launched me into the game but the trigger wasn't showing

coz hitman - as much as he doesnt believe - is not a scripter


// Threading it, put this inside main()
level down_player_func();


^^ no


// Threading it, put this inside main()
level thread down_player_func();


^^ yes


also the sensible thing to do would be
player doDamage( player.health + 666, player.origin );


and first check the player is even valid first


if ( player laststand::player_is_in_laststand() || IS_TRUE( player.intermission ) )
	continue;


if ( !zm_utility::is_player_valid( player ) )
	continue;


ModmeBot:

Reply By: HitmanVere

KillJoyYT
I put a trigger use in my game with the targetname damaging_trigger I put the script in my gsc and as soon as I start the game up it says "game over" "you survived 0s" I deleted a part of the script and it launched me into the game but the trigger wasn't showing

Yo, add me in Discord: SnowmanVere#7069 Easier for me to talk there unlike through forum + not busy with math exam starting unlike few days ago, lmao


ModmeBot:

Reply By: KillJoyYT
okay thanks I added you on discord

going to try it again with the level thread now




- works perfect thank you guys



function down_player_func()
{
// Finding the trigger in map
damaging_trigger = getEnt("damaging_trigger", "targetname");
// Text that you want to show on trigger
damaging_trigger setHintstring("Hold &&1 for Jugger-Nog [Cost: 2500]");
// In case you want this to be retriggerable again
while(1)
{
// Wait for player to hit it
damaging_trigger waittill("trigger", player);
// Kill the player
player doDamage( player.health + 666, player.origin );
}
// If trigger can be hit only once, delete it
damaging_trigger delete();
}