Having problems with some console commands

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 :p
-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.)
 
i think it's the onuser or fireuser outputs, but since all my mapping is SP don't quote me on that
 
...

You're looking at NPC outputs. Players support a different set, none of which is OnDamaged nor OnDeath. Run ent_info player and see for yourself--as I recall they only have OnUser* and OnIgnite.

Also, I'd be interested to know why everyone thinks FireUser* and OnUser* are magical voodoo inputs/outputs capable of anything and everything.
 
Raeven0 said:
...

You're looking at NPC outputs. Players support a different set, none of which is OnDamaged nor OnDeath. Run ent_info player and see for yourself--as I recall they only have OnUser* and OnIgnite.

Also, I'd be interested to know why everyone thinks FireUser* and OnUser* are magical voodoo inputs/outputs capable of anything and everything.
I see. And would it be possible if a player was killed by an antlion, thus triggering an event?
 
Assuming you are the mapper, a trigger_multiple fires OnEndTouch when a player dies inside it (but also when he exits it); any entity named game_playerdie is sent a Use input when a player dies; and antlions fire OnLostEnemy under several circumstances, one of which is the enemy (player) dying. That last one can actually be effected with ent_fire, but if antlions are spawning, you'll have trouble getting them all with an AddOutput input.

Simply from the console, without any special coding, I don't believe there is any way to detect when a certain event occurs.
 
Hmmm... Guess I'll just have to make it so that when you lose the Antlion out of sight, they'll escape into the city wreaking havoc, so the player will have to pwn the Antlion :p. I guess I'll use OnLostEnemy.

I'm planning to have five antlions (with big health) to run around a bit. So no spawning (Is that possible using console commands, actually?).

So I would type this?:
ent_fire npc_antlion AddOup "PutOnLostEnemy !Player,exec,death" ?
But I'd also be very happy with a simple 'fadeout' command ;)
 
You would use a point_clientcommand entity to execute client console commands.

give point_clientcommand
ent_setname point_clientcommand point_clientcommand
ent_fire npc_antlion AddOutput "OnLostEnemy point_clientcommand,Command,exec death,,0,-1"
 
It's not quite working :(

I've copied all three commands and pressed enter after every one in the console. Should I use the AddOutput before or after the Antlion is spawned? (I've tried both)

If you could supply some more information, I'd appreciate it greatly mate :thumbs:
 
Back
Top