Author Topic: Assassin death attack duration?  (Read 363 times)

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
Assassin death attack duration?
« on: October 05, 2013, 10:07:15 pm »


               Just curious. Any way to change this? Looks like it lasts 1 turn (minute) per assassin level...
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Assassin death attack duration?
« Reply #1 on: October 17, 2013, 04:35:44 pm »


               I checked the Feat.2da ... looks like its hardcoded.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Assassin death attack duration?
« Reply #2 on: October 18, 2013, 04:31:31 am »


               I missed this thread. There is a way how to do that. I will first explain the vanilla way without any NWNX plugins.

1) scripted OnDamaged event for players. To do this you have to maintain two things: skin for a players and add OnHitCastSpell itemproperty with unique power or custom spell to each equipped armor

then you can check for paralysis effect after player was hit:

I removed my personal stuff from the following script so you don't have to plough through trash code with custom functions. (Yes Funky I refer to you!) Only the relevant code is pasted, but I have it maintained on a new spell. If you would want to avoid making new spell you have to modify the x2_s3_onhitcast to execute script with this code, this method is however unreliable as more armors might trigger onhitcast so you would also have to add a variable on armors when equipped in order to filter armors that should trigger OnDamaged and armors that shouldn't.

So this is it:

void main();

void GetDamagedFinishedEvent()
{
DelayCommand(0.1,DeleteLocalInt(OBJECT_SELF,"GetLastOnDamagedEventType()"));//run third
DelayCommand(0.1,main());//second run
DelayCommand(0.1,SetLocalInt(OBJECT_SELF,"GetLastOnDamagedEventType()",DAMAGED_EVENTTYPE_DAMAGED_FINISHED));//runs befoe first delay
}

void ByPassDamage()
{
int old_val = GetPlotFlag(OBJECT_SELF);
 if(!old_val)
 {
 SetPlotFlag(OBJECT_SELF,TRUE);
 DelayCommand(0.2,SetPlotFlag(OBJECT_SELF,FALSE));
 }
}

int GetLastOnDamagedEventType()
{
int ret = GetLocalInt(OBJECT_SELF,"GetLastOnDamagedEventType()");
 if(!ret)//started
 {
 GetDamagedFinishedEvent(); //nemazat, nefungoval by pak finished
 }
return ret;
}

object GetDamageStartedLastDamager()
{
 if(GetLocalInt(OBJECT_SELF,"DAMAGED_BY_SPELL"))
 {
 return GetLastSpellCaster();
 }
return GetSpellTargetObject();
}

void main()
{//OBJECT_SELF = player hit or going to be hit yet
int type = GetLastOnDamagedEventType();
object oDamager,oPC = OBJECT_SELF;
 if(type == DAMAGED_EVENTTYPE_DAMAGED_STARTED)//OBJECT_SELF wasnt hit yet
 {
 oDamager = GetDamageStartedLastDamager();
 }
 else//OBJECT_SELF was just hit
 {
 int nDamage = GetTotalDamageDealt();
 oDamager = GetLastDamager(); //GetSpellTargetObject() works too but in some case needn't
  if(GetLevelByClass(CLASS_TYPE_ASSASSIN,oDamager))
  {
  effect e = GetFirstEffect(oPC);
   while(GetIsEffectValid(e))
   {
    if(GetEffectType(e) == EFFECT_TYPE_PARALYZE && GetEffectSpellId(e) == -1 && GetEffectCreator(e) == oDamager)
    {
    RemoveEffect(oPC,e);
    //ApplyEffectToObject(DURATION_TYPE_TEMPORARY,e,oPC,RoundsToSeconds(GetLevelByClass(CLASS_TYPE_ASSASSIN,oDamager))); <= doesnt work for some reason
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectParalyze(),oPC,RoundsToSeconds(GetLevelByClass(CLASS_TYPE_ASSASSIN,oDamager)));
    break;
    }
   e = GetNextEffect(oPC);
   }
  }
 }
}

My script is still missing few things, first the paralyse is dispelable, second there is no visual effect linked to paralyse - you have to add it yourself if you need it. Also its limited to assassin class, so if you added death attack to the creatures without this class, you have to modify this to check death attack feats and ensure minimal duration or 1round.

Also keep in mind that adding the original visual effect causes the sound of that visual effect trigger again, that is twice in same fashion which doesn't look/sound very well. Other way around this would be to DelayCommand on Removing the original paralyze effect, however in this case again, player wont see the paralyze effect blink before expiration, it will disappear immediately which might not be exactly great solution.

To workaround this perfectly, you would have to make new death attack feats which would be placeholders only (and ensure that all creatures, players will get these new feats, which include modifying player character files by Leto if you already have some assassin players in there) and in OnDamage rescript the entire paralysis from scratch, thats the best way to do as you have full controll over this and you can also modify when it happens (eg. only when attacker attacks behind target etc.) how high is DC and so on. Also you have to grant characters sneak attack, Im doing that by bonus feats which also fixes the issue with improved sneak doesn't work on death attack.

Of course this is solving players only, you will probably want to shorten paralysis from player applied to a creature in this case you will have to modify nw_c2_default6 script and use the same method for removing and readding the engine paralysis.

Same can be done with crippling strike.

Thats probably the only vanilla way, since you can't really use OnHitCast on weapon since player/creature might attack unarmed, unless you would added a creature weapon to the PC which I haven't done yet myself so can't really advice.



With NWNX there is more choices, but none of them are public afaik. There is yet no OnDamage event via nwnx but can be added quite easily.
Also with NWNX you could modify the death attack entirely - I already thought about this for my CP Client Patch plugin but abadoned yet because majority of the user would't see this as a fix rather than balance change. But it should be easy to do again.
               
               

               


                     Modifié par ShaDoOoW, 18 octobre 2013 - 03:34 .
                     
                  


            

Legacy_Lazarus Magni

  • Hero Member
  • *****
  • Posts: 1837
  • Karma: +0/-0
Assassin death attack duration?
« Reply #3 on: October 18, 2013, 05:12:33 pm »


               Unfortunately using a skin is not an option for us, since part of our security system strips them (to prevent players from logging in with crit immune, and what have you.)

Thank you guys very much for the responses though. I will keep my fingers crossed for NWNX.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Assassin death attack duration?
« Reply #4 on: October 18, 2013, 06:06:21 pm »


               

Lazarus Magni wrote...

Unfortunately using a skin is not an option for us, since part of our security system strips them (to prevent players from logging in with crit immune, and what have you.)


Hint: Thats a good idea to do for a new characters, but after that its safe to add it again as player can bring own items only with new char.