New Disease Effect Not Working

Post » Sun Nov 18, 2012 10:13 am

Hi,

I have created a new disease which is caught from Wolves and Werewolves, after 3 days it is meant to progress to full Lycanthropy, the problem is that after 3 days it is not changing me into a werewolf.

The code is here:
Spoiler

Scriptname SL_WerewolfDiseaseEffectScript extends ActiveMagicEffectImport DebugGlobalVariable Property Gamehour AutoGlobalVariable Property GameDaysPassed AutoQuest Property SL_WerewolfChange  AutoFloat Property WerewolfChangeTimer AutoEvent OnUpdate()Notification("You suddenly feel stronger, even more so than before you contracted the disease")(SL_WerewolfChange as SL_WerewolfChangeScript).WerewolfChange()EndEventEvent OnUpdateGameTime()If GameDaysPassed.Value >= WerewolfChangeTimer  UnRegisterForUpdateGameTime()  RegisterForSingleUpdate(10)EndIfEndEventEvent OnEffectStart(Actor Target, Actor Caster)If Target == Game.GetPlayer()  RegisterForUpdateGameTime(1)  WerewolfChangeTimer = GameDaysPassed.Value + 3  ;messagebox("You have been infected with Luminos Lycan")EndIfEndEvent

The annoying thing is that it will not activate the script on the OnUpdate event, but it will give me the notification.. I'm not sure what's going on there, as the Quest Property is defiantly filled correctly, and the code in the werewolf change function is defiantly sound as it is called in a potion's effect and it works fine there, but it does not here.

But the code for the werewolf change function is here anyway, just incase you want to look at it:
Spoiler

Scriptname SL_WerewolfChangeScript extends Quest  GlobalVariable Property PlayerIsVampire AutoGlobalVariable Property PlayerIsWerewolf AutoGlobalVariable Property IsWerewolf  AutoQuest Property PlayerVampireQuest autoKeyword Property VampireKeyword autoSPELL Property Immunity autoSPELL Property WerewolfCureDisease auto SPELL Property BeastForm  Auto  SPELL Property WerewolfImmunity AutoSPELL Property TimeToChange AutoSPELL Property timetochangeback  Auto  SPELL Property SL_AbWerewolfHuman  Auto Function WerewolfChange()Debug.MessageBox("YOU HAVE BECOME A WEREWOLF")    if (Game.GetPlayer().HasKeyword(VampireKeyword)) ;if the player has the keyword "Vampire" on themIf (PlayerIsVampire.Value =http://forums.bethsoft.com/topic/1402690-new-disease-effect-not-working/= 1) ;Another check - just to make sure, if the global variable of is on, which is only on when the player is a vampire        (PlayerVampireQuest as PlayerVampireQuestScript).VampireCure(Game.GetPlayer())EndIf    endifIf (PlayerIsWerewolf.Value == 1);Removes all Vanilla Werewolf AbilitiesGame.GetPlayer().RemoveSpell(BeastForm)Game.GetPlayer().RemoveSpell(WerewolfImmunity)EndIf    Game.GetPlayer().AddSpell(Immunity, false)PlayerIsVampire.SetValue(0)PlayerIsWerewolf.SetValue(0)IsWerewolf.SetValue(1)  ;so the game knows the player is the mod's werewolf, not anything else;adds in mod specific werewolf abilitiesWerewolfCureDisease.Cast(Game.GetPlayer()) ;cure the player of any diseases.;add in immunity to diseasegame.GetPlayer().AddSpell(WerewolfImmunity, false);add in spell so that player changes when they are meant togame.GetPlayer().AddSpell(TimeToChange, abVerbose = false)game.GetPlayer().AddSpell(TimeToChangeBack, abVerbose = false)game.GetPlayer().AddSpell(SL_AbWerewolfHuman, false)EndFunction

I even tried copying the code of the function into the OnUpdate event and it still did not work then either..

If anyone knows how to fix this I would be very grateful indeed :biggrin:

Thanks

SoulLimit
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Sun Nov 18, 2012 3:19 am

One thing I can spot is that you are trying to access global variables with the wrong syntax. You should be using GlobVarNameHere.GetValue() instead of GlobVarNameHere.Value. You might also need to typecast the global variable as an integer or float, depending on the intended use (GlobVarNameHere.GetValue() as int or GlobVarNameHere.GetValue() as float).

I'm not sure if you can access the WerewolfChange() function the way you are doing either (please correct me if I'm wrong). You might need to use Import to get access to the script containing the function and also set the function to be a global function in said script.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Sat Nov 17, 2012 9:19 pm

Okay, but as I said, the odd thing is that it works with a potion I made for instant werewolf, but I will try what you said and see if that works.

The way I am calling the WerewolfChange Function is the same way as the VampireCure function from the PlayerVampireQuest script is called, so I believe that It is valid, and also, It works with the Potion...

EDIT - this did not fix it :( Still only displays the notification and not calling the function.
User avatar
gemma
 
Posts: 3441
Joined: Tue Jul 25, 2006 7:10 am

Post » Sat Nov 17, 2012 9:33 pm

bump
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am


Return to V - Skyrim