PDA

View Full Version : [Request]monster_human_grunt clone that explodes on death



Maestro Fénix
19-06-2016, 09:15 AM
Pretty much self explanatory. Since monster_robogrunt sadly can't use RPGs, I need a npc done with AS that behaves like a Hgrunt, but that also explodes on death.

I only care about being able to use the RPG and the explosion (and the glow shell effect when hurt/low health). Other stuff like launching grenades, talking or melee is unneeded, so you can save your time on not doing them.

Most, if not all of the code needed to do a npc should be already done both with the monster_uberpitdrone and monster_turret_* npcs that I did before.



I don't have the time to do it by myself, that's why I'm requesting this.

Nero
21-06-2016, 02:43 PM
Can be done with entities, env_explosion with trigger_setorigin, entitycreator does something like this for the "explode on death" option when spawning mobs ^^

The low health effect might be tricky though, dunno how that's done atm

Maestro Fénix
22-06-2016, 09:39 AM
Of course it could be done within Hammer, but using trigger_setorigin to track the npcs would be expensive. For not saying that I'm already using the function "OnDamage" to trigger another stuff, so I wouldn't be able to use the "OnDeath" option.

About the low health effect, is just setting the RenderFX to 19 (Glow Shell) and playing with FX Color and FX amount on an intermittent basis.

Sniper
22-06-2016, 10:50 AM
You can update the QC file for the Grunt to trigger something in-game. When the death animation plays, you can trigger something in the level to manage the death effect.

Another option would be to write some Angelscript code that executes on startup to watch all grunts on the level with rocket launchers.

Maestro Fénix
22-06-2016, 10:53 AM
You can update the QC file for the Grunt to trigger something in-game. When the death animation plays, you can trigger something in the level to manage the death effect.

Another option would be to write some Angelscript code that executes on startup to watch all grunts on the level with rocket launchers.

I will look into the QC then. About the AS sentence, well, you can already give the rpgs to the Robogrunts. They just don't fire it, filling the console with errors as they are unable to use the ACT of the RPG animations.

Sniper
22-06-2016, 10:58 AM
I will look into the QC then. About the AS sentence, well, you can already give the rpgs to the Robogrunts. They just don't fire it, filling the console with errors as they are unable to use the ACT of the RPG animations.

We haven't yet made it a project to give Robogrunts the Rocket Launcher.
There are a few unrelated issues with Robogrunts that are also getting addressed.

I'll see if we can get the Rocket Launcher sub-model and animations added at some point.

The303
22-06-2016, 10:25 PM
You can update the QC file for the Grunt to trigger something in-game. When the death animation plays, you can trigger something in the level to manage the death effect.

I take it you are referring to QC animation "event 1003" trigger right?

Now how would you best advise on how to do it?, would you make the trigger grab an env_explosion and move it to the grunt with setorigin and activate? I'm not clear on how this would reliably be set up.

Sniper
23-06-2016, 04:23 AM
I take it you are referring to QC animation "event 1003" trigger right?

Now how would you best advise on how to do it?, would you make the trigger grab an env_explosion and move it to the grunt with setorigin and activate? I'm not clear on how this would reliably be set up.


You can use trigger_copyvalue to move the env_explosion to the !activator, and then trigger it.



*robogrunt model qc*

$sequence "diebackwards" "diebackwards" X fps 30 ACT_DIEBACKWARD 1 { event 11 6 } { event 2001 12 } { event 1003 23 "robodeath" }


^ Do this for every death animation in the model





*trigger_copyvalue*

targetname : "Name" = robodeath
netname : "Source entity" = !activator
m_iszSrcValueName : "Source key" = origin
target: "Destination entity" = env_explosion_targetname_here
m_iszDstValueName : "Destination key" = origin
message(target_destination) : "Trigger after action" = env_explosion_targetname_here



This should get the job done, though it would need to be an instantaneous explosion since it would be shared between all NPCs that have your custom model.

The303
23-06-2016, 08:29 PM
Ah cool it seems to work! Only thing I found is that if the magnitude of the env_explosion is below 125 or so it wont gib the monster, and just send em flying as seen on the second part of video. Also for fun, I realized since this is an animation event I put it on a zombies melee attack and you see on the third part:

https://www.youtube.com/watch?v=iVTDqTfc1KQ
My custom animation lacked a flat body position so thats why it is "standing" in the failed attempt

Lastly, I used event 1008 speak through mouth ( { event 1008 1 "scientist/scream05.wav" } ) sound but my first attempt said that sound wasn't precached so I had to use a custom_prechace entity. Is there a way of precaching it in the QC or is the entity solution the proper way?

Lastly yeah my setup is only single monsters right now so working with multiple of the same type would probably not work for my "explode when animation is finished". For now this is great and will be easy for say a boss or special character.

Sniper
23-06-2016, 09:15 PM
Haha! Nice job!


Normally if you use a scripted_sequence, the scripted_sequence entity will precache sounds located in sound events of both the idle and action animation. Otherwise the game code is setup to have the AI precache sounds that may be used by the NPC.

In this particular case, you're injecting a new sound to an animation that the AI code is unaware of, so custom_precache would be the proper way. You could also just precache the sound effects in MapInit() if you want to put that in angelscript.



Lastly yeah my setup is only single monsters right now so working with multiple of the same type would probably not work for my "explode when animation is finished". For now this is great and will be easy for say a boss or special character.

It should work with multiple NPCs if you have the env_explosion triggered and position updated at the same time.

The303
24-06-2016, 01:57 AM
So I did try with a room full of them with no changes and it seemed to work flawlessly with me killing multiple ones in(floating off the ground anim then explosion death). Ive yet to try serverside to see if there is any mistakes or what happens if 2 are killed simultaneously.

Ill have a better video later because I really am having too much fun with this especially with making custom anims :p

Maestro Fénix
24-06-2016, 09:13 AM
Ah wonderful. I will add that to the map then. Good job again with the video, The303, you never fail to amuse me.