Aller au contenu

Photo

Which to use: on damaged or on death, for a death vfx


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
Very simple. I want the death of a creature to cause a tint based on the damage type of the slaying hit.

Fire damage would result in a blackened corpse, cold frozen, etc. I know how to do all that.

But before I go barking up the wrong tree, can damage type only be detected properly in the on damaged? At last check the on death script didnt seem like it would work for some reason.

It's going to be essentially (if it can be done on death, which is ideal)

get damage type  from last_attacker

begin case "damage type"

fire: doburntVFX;
cold: dofrozenVFX;

end case


If it cant I imagine it becomes more complex as I have to check if the blow killed them in the on damaged script. Although I guess I could simply start tinting them when they are near death, say less than 20%. Could be cool.

However... I want to try and implement Infinity's "exploding bag of body parts" when a creature takes a crushing final hit, so I still need to know about the death, and if it can be done on death.

#2
Darin

Darin
  • Members
  • 282 messages
You should be able to get the damage type with GetDamageDealtByType(DAMAGE_TYPE_FIRE) or whatever in the Death script, but be careful of the "-1" thing http://www.nwnlexico...mageDealtByType

If this fails, you can use the OnDamage to set a local variable on the creature that you call in the death script...

so in "on damage" you'd have:

if(GetDamageDealtByType(DAMAGE_TYPE_FIRE)!=-1)
{
SetLocalString(OBJECT_SELF,"sVFX","{fire effect name}");
}
else if...
...
else
SetLocalString(OBJECT_SELF,"sVFX","");

Then in the death script:

string sEffect = GetLocalString(OBJECT_SELF,"sVFX");
if(!(sEffect==""))
{
ApplyEffect...
}

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
You'd also have to check whether *no* elemental damage occured in the OnHit, in order to clear out the elemental damage variable. Otherwise the target could be killed by ordinary weapon damage, but an energy variable left over from a few hits ago could fool the OnDeath script.

Also; how to handle multiple damage types at the same time? Give some preference over others perhaps?

Another approach could be to have separate variables for all the damage types you want to affect the corpse, and store a running tally on the creature. Then the OnDeath script could see which damage type did the most damage during combat, so even if you did kill something with ordinary weapon damage, it could still leave an energy-affected corpse.

Modifié par DannJ, 03 juin 2013 - 11:18 .


#4
Darin

Darin
  • Members
  • 282 messages
The above: SetLocalString(OBJECT_SELF,"sVFX",""); would clear it if the last hit was not elemental, unless for some reason there is a " " named vfx/sef

#5
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
So the bottom line is, I can NOT do this from the on death, or we just don't think I can? I can figure a way from the on damaged but it would be simpler and cleaner if it still works once the creature is in dying mode which it didnt seem to do when I tested.

#6
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
Nevermind that I see what's going on now. It does work from the death scipt slot.

Basically after killing a beast with a +1 fire/cold/acid weapon, the result of getting the damage by type in the death scrip was:

fire: 1
cold: 1
elec: -1
acid: 1

So basically its only the damage dealt by the killing blow alone. Thats perfect for my pusposes. Although more rare in my campaigns than the OC there will be ocassions where more than one damage type lands... so I will want to randomize to break any ties.

Work is in progress. Thanks.

#7
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
Okay it's been a while but can I not create a visual effect with OBJECT_TYPE_PLACEABLE

CreateObject(OBJECT_TYPE_PLACEABLE, "fx_mapburst", locHere, FALSE, "deadbag")

Seems to show nothing, the effect name is right and i dont see a placed effect constant...

#8
Dann-J

Dann-J
  • Members
  • 3 161 messages
Is the visual effect supposed to stick around forever? If not, then ApplyEffectAtLocation() might be better than spawning a placeable effect from a blueprint (the latter of which will only work if you've actually created a placeable effect blueprint that references the SEF first).

Modifié par DannJ, 04 juin 2013 - 10:45 .


#9
Darin

Darin
  • Members
  • 282 messages
 You could try this...
  • string sEffect = "";
  • int nFire = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
  •    if(nFire==-1)
  •       nFire=0;
  •    if(nFire>=1)
  •        sEffect="sp_fire_hit.sef" //or whatever
  •    int nAcid = GetDamageDealtByType(DAMAGE_TYPE_ACID);
  •    if(nAcid==-1)
  •       nAcid = 0;
  •    else if(nAcid>>nFire)
  •       sEffect="sp_acid_hit.sef" //or whatever
This way, it's not about ties/randomization, but whatever did the most damage...if all tied, then this would be fire (saying >= buts the last one first on ties)