Modme Forums

change from trig use to trig damage for func

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


ModmeBot:

Thread By: KillJoyYT

function down_player_func1()
{
 // Finding the trigger in map
 damaging_trigger1 = getEnt("damaging_trigger1", "targetname");
 // Text that you want to show on trigger
 damaging_trigger1 setHintstring("^1Hold &&1 At Your Own Risk");
 damaging_trigger1 SetCursorHint("HINT_NOICON");

 while(1)
 {
  // Wait for player to hit it
  damaging_trigger1 waittill("trigger", player);
    player PlayLocalSound( "demo2" );   // Change this to any sound alias you want

  // Kill the player
  player doDamage( player.health + 666, player.origin );
 }
}




not sure how I change code above ^ so that you have to shoot the object instead of holding f for the trigger to kill you.

already tried changing ("trigger", player) to ("damage", player) and also just ("damage")

when I link it with damage it tells me the "player" is an uninitialized local variable.

I'm assuming I need to change something on the line where you kill the player as well?


ModmeBot:

Reply By: mathfag
why don't you just add a damage trigger to the spot? It won't trigger until you do the waittill("damage")


ModmeBot:

Reply By: KillJoyYT
yes I've already tried this.. doesn't kill me when I shoot the trig_dmg


ModmeBot:

Reply By: mathfag

KillJoyYT
yes I've already tried this.. doesn't kill me when I shoot the trig_dmg

Because you wrote ("damage", player) which is wrong as hell

I haven't tested this but it went through the linker and should work:
function down_player_func()
{
trig_dmg = GetEnt("damage_trig","targetname");
trig_use = GetEnt("use_trig","targetname");

trig_use SetHintString("Swiggity swooty");
trig_use SetCursorHint("HINT_NOICON");

trig_use waittill("trigger", player);

while(1)
	{
	trig_dmg waittill("damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel, mod, hit_location);	
	//you just need the attacker variable, you can delete everything after it but not before
	
	if(attacker != player) //if you want the same player to hit F and shoot keep this otherwise comment BOTH lines
		continue;

	attacker DoDamage(attacker.health+666,attacker.origin);

	//break; //if you want it to be a 1 time thing you can just skip the while(1) entirely 
	}
}


ModmeBot:

Reply By: KillJoyYT
ok so that dmg would be 250 but what would the attacker variable be??


ModmeBot:

Reply By: mathfag

KillJoyYT
ok so that dmg would be 250 but what would the attacker variable be??

The player that shoots the trigger...


ModmeBot:

Reply By: KillJoyYT
not running through the linker.... what am I doing wrong here?



function down_player_func1()
{
trig_dmg = GetEnt("damage_trig","targetname");
trig_use = GetEnt("use_trig","targetname");

trig_use SetHintString("Swiggity swooty");
trig_use SetCursorHint("HINT_NOICON");

trig_use waittill("trigger", player);

	{
	trig_dmg waittill("damage", player);
	
	if(attacker != player) //if you want the same player to hit F and shoot keep this otherwise comment BOTH lines
		continue;

	attacker DoDamage(attacker.health+666,attacker.origin);
	}
}





trig_dmg waittill ("damage", 250, player);

didn't link either


ModmeBot:

Reply By: mathfag

KillJoyYT
not running through the linker.... what am I doing wrong here? function down_player_func1() { trig_dmg = GetEnt("damage_trig","targetname"); trig_use = GetEnt("use_trig","targetname"); trig_use SetHintString("Swiggity swooty"); trig_use SetCursorHint("HINT_NOICON"); trig_use waittill("trigger", player); { trig_dmg waittill("damage", player); if(attacker != player) //if you want the same player to hit F and shoot keep this otherwise comment BOTH lines continue; attacker DoDamage(attacker.health+666,attacker.origin); } } trig_dmg waittill ("damage", 250, player); didn't link either

ffs


you can't do
waittill("damage", player);


when you damage a damage trigger it always returns this
trig_dmg waittill("damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel, mod, hit_location);	



you should have
while(1)
	{
	trig_dmg waittill("damage", amount, attacker, direction_vec, point, type, tagName, modelName, partName, weapon, dFlags, inflictor, chargeLevel, mod, hit_location);	
	if(amount >= 250 && attacker == player)
		{
		attacker DoDamage(attacker.health+666,attacker.origin);
		//break; //if you want it to be a 1 time thing you can just skip the while(1) entirely 
		}
	}