Jump to content

Instantly Disappearing Corpses and Effects


Recommended Posts

Hey guys, I'm wondering how I can make corpses instantly disappear, while having a sort of explosion as they die. I want this to happen with all NPCs and Players that die. This is going to be for my Sword Art Academy mod. Unfortunately, g_corpseRemovalTime isn't quick enough, as I need it to be instant. If at all possible, I would prefer to do this without coding, because I can't code for crap, thanks  :D

Smoo likes this
Link to comment

Hmmm, I'm guessing that would only work on a map I specifically made for the mod? I would prefer it if it worked on any and all maps, as well as all players/NPCs, but if that's not really possible, I could try giving this a shot. How would I get it to check for all players and NPCs, and how would I make the explosion? Thanks :)

 

EDIT:  One more thing: How do I run a script when the map starts? I want to run sao/kill_check.ibi, which should then run sao/killed.ibi.

Link to comment
  • 1 month later...

EDIT:  One more thing: How do I run a script when the map starts? I want to run sao/kill_check.ibi, which should then run sao/killed.ibi.

 

If it's a singleplayer map, make sure the player triggers a target_scriptrunner when he starts the map.

 

 

Hey guys, I'm wondering how I can make corpses instantly disappear, while having a sort of explosion as they die. I want this to happen with all NPCs and Players that die. This is going to be for my Sword Art Academy mod. Unfortunately, g_corpseRemovalTime isn't quick enough, as I need it to be instant. If at all possible, I would prefer to do this without coding, because I can't code for crap, thanks  :D

 

As far as I know it can't be done without coding. However, you can achieve this in a custom map if you give every NPC a custom deathscript that removes them when they die. 

 

The script should be like this:

remove ( $get( STRING, "SET_PARM1" )$ );

And every single NPC in your map should have a parm1 command whose value is the same as the NPCs targetname. To activate the script, the NPC should have a deathscript command with a value that links it to the script above. 

 

I think that should work!

Droidy365 likes this
Link to comment

You can just simply make everyone undying. It will make them to 1hp BUT it will load deathscript. I suggest two things - One thing is adding the effect to the animation.cfg  some explosion or something) and make deathscript that teleports everykilled person to the box somewhere in the map where is simple trigger_multiply that removes entity that it uses.. but it is something weird. It might work (because body cant disapear). I had a problem with scripts with kill or remove because i had to always type a name of the target entity.. i wanted overall effect - not just to one enitity only.

The second thing which i less recommend is - give them undying on and deathscript to every enemy to just remove. 


about the effect.. i remember that Szico made barrels in his moonbase lab map that used the effects on the map. He made a script that was very comlicated - after the the death of the barrel the effect of explosion was taking origins of the barrel and showed up where barrel was. It was a little buggy in SP and it wasnt working everytime. 

Droidy365 likes this
Link to comment

If it's a singleplayer map, make sure the player triggers a target_scriptrunner when he starts the map.

 

 

 

As far as I know it can't be done without coding. However, you can achieve this in a custom map if you give every NPC a custom deathscript that removes them when they die. 

 

The script should be like this:

remove ( $get( STRING, "SET_PARM1" )$ );

And every single NPC in your map should have a parm1 command whose value is the same as the NPCs targetname. To activate the script, the NPC should have a deathscript command with a value that links it to the script above. 

 

I think that should work!

Ok, I have a few questions. For starters: How do you set up the parm1 command stuff? lol

Link to comment

Ok, I have a few questions. For starters: How do you set up the parm1 command stuff? lol

Parm is as far as i know - it enables to make script much much more - universal. With one script we can parent it to the multiple entities. Or we can make script like this 

 

script that makes

 

parm1 - give a 20armor 

parm2 - this guy(s) die

parm3 - they freeze

 

later in gtkradiant

 

- select the npc_spawner and in the key type - parm1 value- firstguy and select the other npc_spawner and make another key - key type - parm2 value- secondguy

- select the scriptrunner and from what i remember - in the script runner you also need to type parm's. For this scriptrunner parm1's will be targeting enities with the name - firstguy and parm2's - secondguy

 

it is hard for me to ... emmm describe.. maybe because i feel weird and my language is weak sorry

 

EDIT: it doesnt need to be script_runner - in the npc_spawner you can add deathscript,spawnscript 

Link to comment

Actually, I turned off the Slow-Mo Camera Spin, and now it's a lot quicker - not instant, but quicker. But the question still remains - how will we get the effect to play as they die? Are either of you two good at coding? Thanks, again btw :D

 

 

EDIT: Also, on a side note: How would you make a Team Icon appear like in MP and a custom health-bar that works like cg_debughealthbars and Force Sense?

These are also for my Sword Art Academy mod lol. I have 3 Icons for 3 teams:

gfx/misc/cursor_g (TEAM_PLAYER)

gfx/misc/cursor_o (TEAM_NEUTRAL/FREE)

gfx/misc/cursor_r (TEAM_ENEMY)

Link to comment

Instead of troubling ourselves with words, I decided to just make a quick map demo that teaches you everything you need to know.

 

https://www.dropbox.com/s/v6kc1jhoon7t8mb/self_remove_demo.pk3?dl=0

 

/devmap self_remove_demo to test the map and see the results for yourself.

Open the .map file with gtkradiant to see the process.

 

Open the self_remove.icarus file to see the simple script it involves.

 

Enjoy modding!

Link to comment

That's great! That part works perfectly! Now there's a few questions left:

  • How do you do the same thing for the player?
  • How do you get the explosion effect to play where they were when they died? (effects/sao/death_sparks.efx)
  • Can this just be done within the script, or does it require coding?

Thanks again, it works great! :D

Link to comment

That's great! That part works perfectly! Now there's a few questions left:

  • How do you do the same thing for the player?
  • How do you get the explosion effect to play where they were when they died? (effects/sao/death_sparks.efx)
  • Can this just be done within the script, or does it require coding?

Thanks again, it works great! :D

 

  • I don't think you can remove the player entity since it'd probably crash the game. Maybe you could try making him invisible when he dies? You just have to give the info_player_start entity a deathscript. 
  • I have no idea how you can make an FX play wherever you are.
  • Maybe it can, but I'm not sure how. 
Droidy365 likes this
Link to comment
  • 3 weeks later...

I figured out a way to make the effect play as they die/disappear! Firstly, I added this line underneath every death animation in animevents.cfg:

	BOTH_DEATH1		 AEV_EFFECT 83 sao/death_sparks.efx *pelvis		0

Then I made it so that the death animation only had 1 frame in animations.cfg, as the effects were only playing after the death animation was finished.

Langerd and Noodle like this
Link to comment

I figured out a way to make the effect play as they die/disappear! Firstly, I added this line underneath every death animation in animevents.cfg:

 

BOTH_DEATH1		 AEV_EFFECT 83 sao/death_sparks.efx *pelvis		0
Then I made it so that the death animation only had 1 frame in animations.cfg, as the effects were only playing after the death animation was finished.

I told ya before ;) cool that it works

Droidy365 likes this
Link to comment
  • 3 months later...

I'm gonna revive this old thread: How can I make the player disappear like the NPCs?

And also...

 

EDIT: Also, on a side note: How would you make a Team Icon appear like in MP and a custom health-bar that works like cg_debughealthbars and Force Sense?

These are also for my Sword Art Academy mod lol. I have 3 Icons for 3 teams:

gfx/misc/cursor_g (TEAM_PLAYER)

gfx/misc/cursor_o (TEAM_NEUTRAL/FREE)

gfx/misc/cursor_r (TEAM_ENEMY)

 
Link to comment

Hey guys, I'm wondering how I can make corpses instantly disappear, while having a sort of explosion as they die. I want this to happen with all NPCs and Players that die. This is going to be for my Sword Art Academy mod. Unfortunately, g_corpseRemovalTime isn't quick enough, as I need it to be instant. If at all possible, I would prefer to do this without coding, because I can't code for crap, thanks  :D

 

You can do the explosion effect using code edits. Search for "DeathFX" in the code and edit it to include all classes of model or the ones you want the effect to happen on. And set the corpse removal time to 2 seconds (this will give time for the deathfx to happen). Hope this helps.

Link to comment

You can do the explosion effect using code edits. Search for "DeathFX" in the code and edit it to include all classes of model or the ones you want the effect to happen on. And set the corpse removal time to 2 seconds (this will give time for the deathfx to happen). Hope this helps.

 

Hey guys, I'm wondering how I can make corpses instantly disappear, while having a sort of explosion as they die. I want this to happen with all NPCs and Players that die. This is going to be for my Sword Art Academy mod. Unfortunately, g_corpseRemovalTime isn't quick enough, as I need it to be instant. If at all possible, I would prefer to do this without coding, because I can't code for crap, thanks  :D

However, I was thinking about doing something like this, as it would be much more convenient than constantly having to add scripts to everything. CLASS_R2D2 explodes in a similar way to what I've described, would it be possible to make every class do that? Just FYI, I'm not a coder.

Link to comment

However, I was thinking about doing something like this, as it would be much more convenient than constantly having to add scripts to everything. CLASS_R2D2 explodes in a similar way to what I've described, would it be possible to make every class do that? Just FYI, I'm not a coder.

 

 

Well as long as you know how to "Open" and "Compile" the code then your half way there.https://github.com/JACoders/OpenJK/wiki/Compilation-guide

Once you have figured this bit out just "search" for "void DeathFX( gentity_t *ent )". It is a very,very simple bit of code.
 
switch(ent->client->NPC_class)

 {

 case CLASS_MOUSE:

  VectorCopy( ent->currentOrigin, effectPos );

  effectPos[2] -= 20;

  G_PlayEffect( "env/small_explode", effectPos );

  G_SoundOnEnt( ent, CHAN_AUTO, "sound/chars/mouse/misc/death1" );

  break;

 case CLASS_PROBE:

  VectorCopy( ent->currentOrigin, effectPos );

  effectPos[2] += 50;

  G_PlayEffect( "explosions/probeexplosion1", effectPos );

  break;

 case CLASS_ATST:

  AngleVectors( ent->currentAngles, NULL, right, NULL );

  VectorMA( ent->currentOrigin, 20, right, effectPos );

  effectPos[2] += 180;

  G_PlayEffect( "explosions/droidexplosion1", effectPos );

  VectorMA( effectPos, -40, right, effectPos );

  G_PlayEffect( "explosions/droidexplosion1", effectPos );

  break;

 
 
 
All you need to do is add the classes to the different type of explosion effects you want.
 
EXAMPLE:
 
 
switch(ent->client->NPC_class)

 {

 case CLASS_ADDED CLASS NAME HERE:

 case CLASS_MOUSE:

  VectorCopy( ent->currentOrigin, effectPos );

  effectPos[2] -= 20;

  G_PlayEffect( "env/small_explode", effectPos );

  G_SoundOnEnt( ent, CHAN_AUTO, "sound/chars/mouse/misc/death1" );

  break;

 case CLASS_PROBE:

 case CLASS_ADDED CLASS NAME HERE:

  VectorCopy( ent->currentOrigin, effectPos );

  effectPos[2] += 50;

  G_PlayEffect( "explosions/probeexplosion1", effectPos );

  break;

 case CLASS_ATST:

 case CLASS_ADDED CLASS NAME HERE:

  AngleVectors( ent->currentAngles, NULL, right, NULL );

  VectorMA( ent->currentOrigin, 20, right, effectPos );

  effectPos[2] += 180;

  G_PlayEffect( "explosions/droidexplosion1", effectPos );

  VectorMA( effectPos, -40, right, effectPos );

  G_PlayEffect( "explosions/droidexplosion1", effectPos );

  break;

 
 Then just compile the code and use the newly created dlls and exe,s in your mod.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...