Aller au contenu

Photo

Resistance check from potion


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

#1
Kesaru

Kesaru
  • Members
  • 130 messages
I'm trying to change lyrium potions so that the character suffers penalties after using one unless they pass a mental resistance check, but I'm doing something wrong with the code. I keep getting the error message:
E: 13:40:13 - item_singletarget_pr.nss - item_singletarget_pr.nss(59): Declaration does not match parameters (while compiling var_constants_h.nss)

Referring to this line:
if (ResistanceCheck(stEvent.oCaster, stEvent.oTarget, 10.0f, RESISTANCE_MENTAL) == FALSE)

It's probably an issue with the targets, but I have no idea how they should look.
It'd be great if the error messages were not so vague and useless...

-Edit- It seems I cannot have the opposing check be a static value rather than an attribute with the targets the way they are. It works if I make the player run a check against their own spellpower rather than a static 10. Any ideas? I need the opposing check to be based on the quality of the potion rather than any of the player's own stats, so I was going to set a higher static number to each potion quality.

Modifié par Kesaru, 31 juillet 2010 - 06:05 .


#2
Phaenan

Phaenan
  • Members
  • 315 messages

Kesaru wrote...
-Edit- It seems I cannot have the opposing check be a static value rather than an attribute with the targets the way they are

You need to feed ResistanceCheck() integer values for the two last parameters, that's why the float value (10.0f) isn't liked much.

Modifié par Phaenan, 31 juillet 2010 - 06:09 .


#3
Kesaru

Kesaru
  • Members
  • 130 messages

Phaenan wrote...

Kesaru wrote...
-Edit- It seems I cannot have the opposing check be a static value rather than an attribute with the targets the way they are

You need to feed ResistanceCheck() integer values for the two last parameters, that's why the float value (10.0f) isn't liked much.

I'm not sure what that means. :unsure:

#4
Phaenan

Phaenan
  • Members
  • 315 messages
Hmm... Basically integers (= int) are natural numbers, 1, 2, 3, yada. Floats, well, are real numbers, 1.2, 2.1, 3.3, yada.
If you check the ResistanceCheck() function syntax via the toolset help window, you get that :

int ResistanceCheck (
          object oAttacker,
          object oDefender,
          int nAttackingAttribute,
          int nDefendingResistance
)

So the last two parameters of the function - nAttackingAttribute and nDefendingResistance - should be natural numbers and can't have decimals. So in your case, simply replacing the "10.0f" by "10" would work just fine.

Modifié par Phaenan, 31 juillet 2010 - 06:36 .


#5
Kesaru

Kesaru
  • Members
  • 130 messages
Cool, thank you. It worked.

#6
Kesaru

Kesaru
  • Members
  • 130 messages
I have another question about this script.
I understand how to prevent the effect from stacking with itself multiple times, that's simple.
But how would I prevent the effect from different qualities of potions, which are basically like entirely different spells, from stacking?

Modifié par Kesaru, 31 juillet 2010 - 08:52 .


#7
FergusM

FergusM
  • Members
  • 460 messages
I presume you are using ApplyEffectOnObject at some point to put the debuff on the user. The last parameter for this function is int nAbilityId. I believe you can then call RemoveStackingEffects and it will get rid of double ups.

#8
Kesaru

Kesaru
  • Members
  • 130 messages
The problem though is that different quality potions have different ability IDs. Are you saying it's possible to set that ID to whichever ability I want rather than the processing one, so those effects all have the same ID?

#9
Phaenan

Phaenan
  • Members
  • 315 messages
Yep. You can pretty much use whatever ID you want, that's merely a filter for the other effects related functions.