Aller au contenu

Photo

Item property: Instant kill


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

#1
illion_

illion_
  • Members
  • 21 messages
Hello,

I would like to create a dagger which has the item property of instant kill.
I have checked some posts but I havent found any posts describing how to create your own custom properties.

Name dagger properties:
25% chance to instantly kill the target with a backstab from stealth

I have played the game alot but I cant recall if there is a death animation for killing an enemy from behind?
If there is such an animation I would like to throw that in there aswell.

Now how would you do that? and how would you add the special property described above?

I know from NWN toolset how to add special feats and have a good understanding of the toolkit already, just wondering where you add feats in DAO and if there is kill command you could add with a percentile chance.

Would be great if you could get space for a function where I could hack away if the feat triggered or just everytime I hit and I can do the percentile thing myself.

Update:
I found the death effect - effect eEffect = Effect(EFFECT_TYPE_DEATH);
How do I create my own item property?

/illion

Modifié par illion_, 15 février 2010 - 07:18 .


#2
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
i suggest you find someone who will port in a scythe and use that to debug the instant kill, release that, then make your dagger thingy

#3
CID-78

CID-78
  • Members
  • 1 124 messages
in theory: (I haven't done it)

add a new line to itemprp.2da and compile it.



expand itemproperty core with the new itemproperty code.

#4
illion_

illion_
  • Members
  • 21 messages
Thanks CID-78. I did this and now I instantly kill enemies, thats great and I also added a stealth check.



Now the question is how can I check if the attack is a backstab?

#5
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
ehhh, there is a backstab flag set i believe that you can check for

#6
illion_

illion_
  • Members
  • 21 messages
Yeah that would be my guess too but how can I reach it inside the condition script, just got the event to play with in here?

It seems like AttackResult is what I am supposed to be looking for but I have got no idea where to get it.

Also how can I stop the effect from triggering if I am not in Stealth and backstabbing?

This condition script is triggering when the dagger hits, that must mean that the stealth status is already gone, any way to solve this?

IsModalAbilityActive(oAttacker, ABILITY_SKILL_STEALTH_1) - wont work

Modifié par illion_, 15 février 2010 - 09:36 .


#7
Baracuda6977

Baracuda6977
  • Members
  • 353 messages
you could make the dagger do 0 dmg and have its effect do the damage in an if statement that only runs if the stealth flag and backstab flags are true... i think

#8
illion_

illion_
  • Members
  • 21 messages
Ok so to clarify, what I want to do is to catch the event after the attack has been calculated and before the damage is done. By doing that I should be able to check the stealth/backstab status and modify the damage.

Is this possible?

Modifié par illion_, 15 février 2010 - 10:16 .


#9
CID-78

CID-78
  • Members
  • 1 124 messages
why doesn't you do the vector math in the itemproperty onhit code. it's cleaner and a the function that does this should already be in there somewhere.

#10
illion_

illion_
  • Members
  • 21 messages

CID-78 wrote...

why doesn't you do the vector math in the itemproperty onhit code. it's cleaner and a the function that does this should already be in there somewhere.


Sorry I dont understand what you are referring to?

What I have done is to hijack the APPLY _EFFECT event and listen to my custom assassinate event and then run my own assassinate effect. It works with stealth and backstab checks now. But I dont wanna stop there, next thing is to somehow keep stealth if the effect triggers and remove the actual damage text.

1. Remain in stealth if effect triggers.
2. Remove the damage number from the attack if effect triggers.

#11
CID-78

CID-78
  • Members
  • 1 124 messages
oh you want to prevent the normal dagger damage. not sure if you can do that, it simply to late when item properties get applied. you must hook it before the onhit. i haven't looked if that part is in the core or if it's one of the hardcoded part of the engine.

Modifié par CID-78, 16 février 2010 - 10:03 .


#12
illion_

illion_
  • Members
  • 21 messages
Ok so thats what you mean, yeah of course, here is the code:

int Effects_HandleApplyEffectAssassinate(effect eEffect)
{
    object oAttacker = GetEffectCreator(eEffect);
    object oWeapon;

    int nHand = Combat_GetAttackHand(oAttacker);

    if (nHand == HAND_MAIN)
    {
        oWeapon = GetItemInEquipSlot(INVENTORY_SLOT_MAIN);
    }
    else if (nHand == HAND_OFFHAND)
    {
        oWeapon = GetItemInEquipSlot(INVENTORY_SLOT_OFFHAND);
    }
    float fFlanking = Combat_GetFlankingBonus(oAttacker, OBJECT_SELF);
    
    if(IsModalAbilityActive(oAttacker, ABILITY_SKILL_STEALTH_1) && Combat_CheckBackstab(oAttacker, OBJECT_SELF, oWeapon,fFlanking)){
        DisplayFloatyMessage(OBJECT_SELF, "ASSASSINATED", FLOATY_CRITICAL_HIT, 14654488, 3.0);
        ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT,EffectDeath(),OBJECT_SELF);
    }

    return   TRUE;
}

Modifié par illion_, 16 février 2010 - 10:07 .


#13
CID-78

CID-78
  • Members
  • 1 124 messages
I looked around sounds like you should expand "Combat_HandleCommandAttack() in combat_h" or a sub function in that tree to override normal damage.

#14
illion_

illion_
  • Members
  • 21 messages
You can control the damage by the function "Combat_Damage_GetAttackDamage" in combat_damage_h but as I dont really care about the damage it might make more sense to disable the DamageFloatMessage displaying the damage but thats where I am stuck now.

#15
CID-78

CID-78
  • Members
  • 1 124 messages
if you set the damage to 0. or remove the damage effect completely. that should remove the floating text.

#16
illion_

illion_
  • Members
  • 21 messages
Yeah but I dont know and I actually dont think its possible to connect the onHit effect and the regular attack. Im thinking about skipping the onHit effect and changing the 4th tier assassin talent to Assassination and change the combat_h file.



Now Ive also solved the stealth issue, but I end up with 2 changed core files. It seems pretty inconvienient hence all the other mods out there.