Beerdude26
Party Escort Bot
- Joined
- Oct 20, 2004
- Messages
- 10,350
- Reaction score
- 1
Right, what I want to do is trigger a script (.cfg file) to run once the player dies. (This is in HL2DM)
Keep in mind that I can only use console commands, no lua stuff or any C++ coding.
I've thought of two possible ways:
Add an output to the player using OnDeath:
Syntax
ent_fire [entity](ex. npc_antlion) AddOutput "[action](ex. OnDeath) [entity](ex. !self),[command](ex. exec),[command value](ex. death)(the .cfg is not necessary)"
So I would put:
ent_fire !self AddOutput "OnDeath !Self,exec,death"
(The death.cfg is present and isn't empty, btw)
Right?
Anyway, that didn't work, so I thought I'd do it like this:
ent_fire !self AddOutput "OnDamaged !Self,exec,death"
(When attacked by a monster you would automattically die, seeing as the exec kills you)
Anyway that doesn't work either, so I'm a bit at a loss here
Maybe I should use a FireUser1-4 input or an OnUser1-4 output?
The Gmod Wiki is down right now, and that has a list of all the "On..." actions. I'll take the ones that are on the Valve Wiki
-OnDeath (Fired when this NPC is killed.)
-OnDamaged (Fired when this NPC takes damage.)
-OnHalfHealth (Maybe kill after this? The console is quick enough for the user not to spot this)
-OnHearWorld (Fired when this NPC hears a sound (other than combat or the player).)
-OnHearPlayer (Fired when this NPC hears the player.)
-OnHearCombat (Fired when this NPC hears combat sounds.)
-OnFoundEnemy <string> (Fired when this NPC establishes line of sight to its enemy (outputs entity).)
-OnLostEnemyLOS (Fired when this NPC loses line of sight to its enemy.)
-OnLostEnemy (Fired when this NPC loses its enemy. Usually due to the enemy being killed/removed, or because this NPC has selected a newer, more dangerous enemy.)
-OnFoundPlayer <string> (Fired when this NPC establishes line of sight to its enemy, and that enemy is a player (outputs player entity).)
-OnLostPlayerLOS (Fired when this NPC loses line of sight to its enemy, and that enemy is a player.)
-OnLostPlayer (Fired when this NPC loses its enemy, and that enemy was a player. Usually due to the enemy being killed/removed, or because this NPC has selected a newer, more dangerous enemy.)
-OnDamagedByPlayer (Fired when this NPC is hurt by a player.)
-OnDamagedByPlayerSquad (Fired when this NPC is hurt by a player OR by one of the player's squadmates.)
-OnDenyCommanderUse (Fired when this NPC has refused to join the player's squad.)
-OnWake (Fired when this NPC comes out of a sleep state.)
Keep in mind that I can only use console commands, no lua stuff or any C++ coding.
I've thought of two possible ways:
Add an output to the player using OnDeath:
Syntax
ent_fire [entity](ex. npc_antlion) AddOutput "[action](ex. OnDeath) [entity](ex. !self),[command](ex. exec),[command value](ex. death)(the .cfg is not necessary)"
So I would put:
ent_fire !self AddOutput "OnDeath !Self,exec,death"
(The death.cfg is present and isn't empty, btw)
Right?
Anyway, that didn't work, so I thought I'd do it like this:
ent_fire !self AddOutput "OnDamaged !Self,exec,death"
(When attacked by a monster you would automattically die, seeing as the exec kills you)
Anyway that doesn't work either, so I'm a bit at a loss here
Maybe I should use a FireUser1-4 input or an OnUser1-4 output?
The Gmod Wiki is down right now, and that has a list of all the "On..." actions. I'll take the ones that are on the Valve Wiki
-OnDeath (Fired when this NPC is killed.)
-OnDamaged (Fired when this NPC takes damage.)
-OnHalfHealth (Maybe kill after this? The console is quick enough for the user not to spot this)
-OnHearWorld (Fired when this NPC hears a sound (other than combat or the player).)
-OnHearPlayer (Fired when this NPC hears the player.)
-OnHearCombat (Fired when this NPC hears combat sounds.)
-OnFoundEnemy <string> (Fired when this NPC establishes line of sight to its enemy (outputs entity).)
-OnLostEnemyLOS (Fired when this NPC loses line of sight to its enemy.)
-OnLostEnemy (Fired when this NPC loses its enemy. Usually due to the enemy being killed/removed, or because this NPC has selected a newer, more dangerous enemy.)
-OnFoundPlayer <string> (Fired when this NPC establishes line of sight to its enemy, and that enemy is a player (outputs player entity).)
-OnLostPlayerLOS (Fired when this NPC loses line of sight to its enemy, and that enemy is a player.)
-OnLostPlayer (Fired when this NPC loses its enemy, and that enemy was a player. Usually due to the enemy being killed/removed, or because this NPC has selected a newer, more dangerous enemy.)
-OnDamagedByPlayer (Fired when this NPC is hurt by a player.)
-OnDamagedByPlayerSquad (Fired when this NPC is hurt by a player OR by one of the player's squadmates.)
-OnDenyCommanderUse (Fired when this NPC has refused to join the player's squad.)
-OnWake (Fired when this NPC comes out of a sleep state.)