Aller au contenu

[solved] Apply debuffs?


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

#1
Guest_dewkl_*

Guest_dewkl_*
  • Guests
edit: EFFECT_TYPE_DEATH_HEX was what I was looking for.

My function is:
ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, oFriend, 10.0, GetHero(), 11100);

I'm trying to apply the spell Death Hex on oFriend. The spell gives this debuff, which I need; The target suffers a hex of lethal bad luck. Every normal hit it suffers becomes a critical hit.

Modifié par dewkl, 11 juin 2010 - 02:51 .


#2
Guest_dewkl_*

Guest_dewkl_*
  • Guests
Something unrelated I'd thought I'd just post here instead of make yet another thread. I see various scripts write something to a log. How do you see this log? Does it automatically show in console or do you have to activate something? Would be very helpful if I could use this while debugging. Unless it's written to some external (text) file I can't have open simultaneously.

Modifié par dewkl, 06 juin 2010 - 04:26 .


#3
Phaenan

Phaenan
  • Members
  • 315 messages
If you mean the PrintToLog() function, then the logging output is appened to the Engine.log.
You'll find more info on how to enable that here :
- http://social.biowar...dex.php/Logging
You may also want to have a look at the logging configuration, as a lot of things are logged by default. :o

Modifié par Phaenan, 06 juin 2010 - 04:35 .


#4
TimelordDC

TimelordDC
  • Members
  • 923 messages

dewkl wrote...

How do you properly apply debuffs to a creature, what constructor do you use? 

My function is:
ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, oFriend, 10.0, GetHero(), 11100);

I'm trying to apply the spell Death Hex on oFriend. The spell gives this debuff, which I need; The target suffers a hex of lethal bad luck. Every normal hit it suffers becomes a critical hit.


The effect itself does nothing other than place an effect on the creature. Usually, this effect is tied to an ability so they can't be stacked and may have a vfx.
The actual code that does the normal hit to critical hit usually works like this (you will have to decide where to put it depending on your requirements):
if (attack result is a hit)
   { if (has death hex effect)
        { flag as critical hit  }
    calculate damage using above flag
    apply damage effect to creature }

About the logs, you can ignore the Log_Trace calls. Those aren't supported for the released toolset. Only PrintToLog works.

   

#5
Guest_dewkl_*

Guest_dewkl_*
  • Guests
I'll try PrintToLog.

As for the effect question; What can I use to apply the ability (actually giving the target the debuff and everything tied with it) to the target? CommandUseAbility with target as self? Anything less dependent on the caster? I feel manually implementing the hit-to-crit code would be cumbersome, as I would have to do it on every creature I want to have this effect.

Modifié par dewkl, 07 juin 2010 - 09:31 .


#6
Guest_dewkl_*

Guest_dewkl_*
  • Guests

TimelordDC wrote...
The effect itself does nothing other than place an effect on the creature.

But isn't this effect what I need to apply? Isn't the effect tied to a modifier that creates the response I'm trying to get? From what I could see, the effect: EFFECT_TYPE_DEATH_HEX can be found here (link) in combat_h.nss. Right now I have a temporary solution which works well, but I'd like to understand how this works. 

#7
TimelordDC

TimelordDC
  • Members
  • 923 messages
Yes, the code in combat_h is what I mentioned in my previous post (in pseudo code). I didn't realize it was part of a generic function in combat_h.



Since it is part of a generic function, your code should actually work and apply the effect and combat_h should be picking up that effect. Couple of things to try -

1. do a GetHasEffects call after applying the effect to see if the target actually has the effect.

2. The effect will persist only for 10 seconds; is the target being hit before that time expires?




#8
Guest_dewkl_*

Guest_dewkl_*
  • Guests
I got it working properly now. I was testing this on another module earlier, so I must have missed something when it didn't work there. 

Modifié par dewkl, 11 juin 2010 - 08:34 .