Jump to content

Poison Tolerance - Not working, not sure why


spot10

Recommended Posts

I am working on a mod that tracks how many times you are poisoned and then once a required number of times happens, you get a message that your body has adapted to poison, and you are given the ImmuneToPoison perk that some animals have, so you are no longer effected by poison.

 

To track the number of times, I have added a global variable called SpotsPoisonedCounter

I added a script to the "RadScorpionPoisonEffectPlayer" Magic Effect

 

Event OnActivate(ObjectReference akActor)
SpotsPoisonedCounter.SetValue(SpotsPoisonedCounter.GetValue() + 1)
Actor PlayerREF = Game.GetPlayer()
If (SpotsPoisonedCounter.GetValue() == 20)
PlayerREF.AddPerk(ImmuneToPoison)
SpotsPoisonToleranceMessage.Show()
EndIf
EndEvent
Everything seems straightforward so far.
I load in, spawn in a radscorpion, let it sting me a number of times, then go into the console and show the value of the SpotsPoisonedCounter variable, and it's still at 0.
No idea why. Can someone lend me some knowledge on this one?
Link to comment
Share on other sites

That doesn't seem to be working either.

 

Seems that the general problem is that I just can't figure out which magic effect is actually fired when a radscorpion poisons the player with their stinger.

 

I've tried putting a simple message.show() script in various magic effects to try to figure it out, and they just don't fire.

Any help would be appreciated.

Link to comment
Share on other sites

Try


Int Property PoisonCount Auto



OnEffectStart(Actor akTarget, Actor akCaster)

If AkTarget == Game.Getplayer()

PoisonCount = PoisonCount +1





If PoisonCount > 19

Game.Getplayer().AddPerk(ImmuneToPoison)
SpotsPoisonToleranceMessage.Show()

EndIf



Endif

EndEvent

But most likely the count won't ever stack up because the magic effects are seperate from each other.

Creating a dummy quest could solve the issue.


In this example the quest has 20 quest stages, then the perk gets applied




Int Property PoisonCount Auto
Quest Property ThePoisonCountQuest Auto


OnEffectStart(Actor akTarget, Actor akCaster)

If AkTarget == Game.Getplayer()

PoisonCount = ThePoisonCountQuest.getstage() +1

ThePoisonCountQuest.setstage(PoisonCount)





If ThePoisonCountQuest.getstage() == 20
If Game.Getplayer().hasperk (ImmunetoPoison) == False
Game.Getplayer().AddPerk(ImmuneToPoison)
SpotsPoisonToleranceMessage.Show()

Endif

EndIf



Endif

EndEvent

Link to comment
Share on other sites

OnEffectStart is definitely the right event for this scenario. You never said if the debug message showed up?

 

I would check if your Properties are filled, and also change the

== 20 to >= 20 just in case 20 gets skipped in script lag or something.

So long as the properties are filled your script should work fine.

 

I would also add another debug message to show the global's value EVERY time you get poisoned, that way you can troubleshoot it better, then you can remove the message later.

Link to comment
Share on other sites

Seems that the general problem is that I just can't figure out which magic effect is actually fired when a radscorpion poisons the player with their stinger.

I think it is this one: dtPoisonEffectChanceAlways "Damage Type Poison" [MGEF:000856FA].

Edit: The magic effect has a keyword. I think that for the duration of the magic effect, the keyword is applied/added to the target. Maybe you can use that in a condition check.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...