Jump to content

First time creating a script/mod... need some help


carnageX333

Recommended Posts

I'll have to look into these. I was just trying to a simple mod, but it seems like it's becoming not as simple as I thought lol.

 

I guess there are a lot of scripts involved, but a few if statements and a couple lines being commented out will go a long way (i.e. no real scripting needed to be input). Understanding these scripts will allow you to have a lot more control over the vampire/werewolf systems.

Link to comment
Share on other sites

 

 

@carnageX333: what trace messages do you get from my revised script? Is the OnSpellCast event firing?

It might simply be that RevertVLForm is the wrong spell to check for.

I'm not getting any traces from the OnSpellCast (not even the "Entered spell cast event." trace).

 

 

OnSpellCast() is a function from ObjectReference script. Rather than putting your script on the "player" actor alias, try putting it on the playerREF alias.

 

- in your Quest-Alias tab, choose "Specific Reference". In the "Cell" field select "(any)". Wait a sec and "PlayerRef ('Player')" should appear in the Ref field. CLICK ON IT. Then click OK.

You should now see "Ref: 'PlayerRef' (00000014) to NPC_ 'Player' (00000007)" as the reference.

 

Then try the script on this alias and see if OnSpellCast will now fire. If it doesn't, then I give up :P

Edited by steve40
Link to comment
Share on other sites

 

 

 

 

@carnageX333: what trace messages do you get from my revised script? Is the OnSpellCast event firing?

It might simply be that RevertVLForm is the wrong spell to check for.

I'm not getting any traces from the OnSpellCast (not even the "Entered spell cast event." trace).

OnSpellCast() is a function from ObjectReference script. Rather than putting your script on the "player" actor alias, try putting it on the playerREF alias.

 

- in your Quest-Alias tab, choose "Specific Reference". In the "Cell" field select "(any)". Wait a sec and "PlayerRef ('Player')" should appear in the Ref field. CLICK ON IT. Then click OK.

You should now see "Ref: 'PlayerRef' (00000014) to NPC_ 'Player' (00000007)" as the reference.

 

Then try the script on this alias and see if OnSpellCast will now fire. If it doesn't, then I give up :P

 

Alright, I'll try that. So should I have my script extend ObjectReference then rather than ReferenceAlias, or just keep it to ReferenceAlias? Would that mess up the "OnPlayerLoadGame" event?

 

Thanks for the tips though, I'll check it out!

 

Why are you making things so complicated? You could just remove the spell effects from AbVampire04b and VampireSunDamage04b, or add conditions to the that prevent them from being applied.

 

I'm wanting to retain the effects while I'm in Vampire Lord form (makes sense for me to how I want it.. I'm in Vampire form so might as well have the effects apply), but not while in human form.

And to be frank, I didn't really think of editing the spells themselves lol.

 

I suppose I could check into that, and add a condition to not apply the spell if I'm going from VL > human form. Thanks for the idea, I'll look into that if what steve suggested doens't work. Would I just make a script that does the checks, go into CK, and edit the spells and hook the script onto them? Or is there a different way to do it?

 

 

 

Edit: Ok, I changed to the PlayerRef like you said steve, and the event fires now! It wasn't working at first, but I just added an additional wait in the script. It was firing too soon, and removing the spells too early, because the Revert Form adds them back as well (was looking into the files that mathern mentioned, and I saw that they were being re-added in that script).

 

So I just added a wait for 6 seconds (because that's about how long the animation takes to start/finish), and it worked perfectly.

 

Here's the final version of the script:

 

 

 
Scriptname RemoveVampireWeaknesses extends ReferenceAlias
 
Spell property WeaknessToFire auto 
Spell property WeaknessToSun auto 
Spell property RevertVLForm auto
 
Event OnPlayerLoadGame() 
Debug.Trace("RemoveVampireWeaknesses: Loaded game...spells should now be removed")
 
if GetActorRef().HasSpell(WeaknessToFire)
GetActorRef().RemoveSpell(WeaknessToFire)
endIf
 
if GetActorRef().HasSpell(WeaknessToSun)
GetActorRef().RemoveSpell(WeaknessToSun)
endIf
EndEvent
 
AUTO STATE WAITING
Event OnSpellCast(Form akSpell)
Debug.Trace("RemoveVampireWeaknesses: Entered spell cast event.")
Spell spellCast = akSpell as Spell
 
if spellCast != none && spellCast == RevertVLForm
utility.wait(6) ;Wait for 6 seconds for Revert to finish its stuff 
 
Debug.Trace("RemoveVampireWeaknesses: Revert form was cast... spells should be removed?")
 
GoToState("DONE") ; prevent further calls while we're in the While loop
 
while GetActorRef().HasSpell(WeaknessToFire) || GetActorRef().HasSpell(WeaknessToSun)
if GetActorRef().HasSpell(WeaknessToFire)
GetActorRef().RemoveSpell(WeaknessToFire)
endIf
if GetActorRef().HasSpell(WeaknessToSun)
GetActorRef().RemoveSpell(WeaknessToSun)
endIf
 
utility.wait(0.02) ; latent function, gives other threads a chance to jump the queue
 
endWhile
Debug.Trace("Weakness to Fire and Weakness to Sun successfully removed!")
endIf
 
GoToState("WAITING") ; re-enable the OnSpellcast event
endEvent
ENDSTATE
 
STATE DONE
ENDSTATE

 

May do some more changing in the script to include adding the werewolf effects/VL effects if the player does not already have them. This way it's more of a standalone-mod rather than depending on the effects of another mod.

 

Thanks a lot everybody, I really do appreciate it!

Edited by carnageX333
Link to comment
Share on other sites

  • Recently Browsing   0 members

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