Jump to content

Please help with script writting for my race mod


mmft93

Recommended Posts

Your syntax for the OnHit event is incorrect. There are more parameters than what you have. This is why the compiler is having an issue.

 

Correct:

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

 

You have to include all of the parameters when using an event or function even if you won't need to access them in the script otherwise it will complain when trying to compile.

Link to comment
Share on other sites

Oh ok I didn't know I had to put everything. I changed it and it finally compiled :) ! One little problem now though, my activator will cast vanilla spells no problem but when I ask it to cast custom spells it wont work is there some way around this.

 

my script if thats the problem:

 

ScriptName SacredTreeSpellCast3 extends ObjectReference

spell property myspell auto
projectile property spellprojectile auto

Event OnHit(ObjectReference akActionRef, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akProjectile == spellprojectile
ObjectReference SelfObj = Self as ObjectReference
mySpell.cast(SelfObj, SelfObj)
EndIf
EndEvent

Link to comment
Share on other sites

If it casts stock spells just fine, then there shouldn't be a problem with the script.

Make sure that you have the properties correctly assigned.

Do you know if the custom spell works outside of this scenario?

 

If the problem ends up being in the spell some where, I can't really help with that. I haven't made that many spells and there is still a lot that I do not know in that regard.

Link to comment
Share on other sites

The custom spell is the same as the vanilla spell the only deference is I made it a little bit stronger. Its the pacify spell, in vanilla Skyrim it only affects people up to level 20 so I made a custom version that affect people up to level 80. I probably accidentally changed something in the spell effect I'll double check. Thanks a ton for helping with the scripts. Just need to find out a few more things and then the next version of the mod should be exciting when released :) .

Link to comment
Share on other sites

Help?

I was trying to write a simple script that would increase spells damage based on destruction level. No fancy formulas or anything just a simple script.

 

scriptname NatureDestructionMagicIncrease extends ActiveMagicEffect

Float DamAugment

Event OnEffectStart(Actor akTarget, Actor akCaster)
state OnBeginState ()
DamAugment = akCaster.getAV("Destruction")
akTarget.DamageAV("Health", DamAugment)
endstate
EndEvent

However I'm getting a lot of errors and I have no idea why?

 

Starting 1 compile threads for 1 files...
Compiling "NatureDestructionMagicIncrease"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(3,17): required (...)+ loop did not match anything at input 'auto'
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(3,21): mismatched input '\\r\\n' expecting STATE
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(6,1): no viable alternative at input 'state'
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(6,20): required (...)+ loop did not match anything at input '('
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(7,13): mismatched input '=' expecting LPAREN
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\NatureDestructionMagicIncrease.psc(0,0): error while attempting to read script NatureDestructionMagicIncrease: Object reference not set to an instance of an object.
No output generated for NatureDestructionMagicIncrease.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on NatureDestructionMagicIncrease.psc

Link to comment
Share on other sites

Oh ok I will try to rewrite it thank you.

 

It worked

 

scriptname NatureDestructionMagicIncrease extends ActiveMagicEffect

Float DamAugment

Event OnEffectStart(Actor akTarget, Actor akCaster)
DamAugment = akCaster.getAV("Destruction")
akTarget.DamageAV("Health", DamAugment)
EndEvent

 

just took out the state part thank you your a lifesaver IsharaMeradin thank you :)

Edited by mmft93
Link to comment
Share on other sites

Ran into another wall this time I was trying to add onto one of my previous scripts. The one that allows the activator to cast a spell. I was trying to add onto it to make it delete the activator after a certain amount of time once it had been activated. I keep getting an "error did you forget loop" or something like that.

 

An example of my script:

 

ScriptName NatureActivatorTreeSpellCast extends ObjectReference

spell property myspell auto

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer() ; only the player can activate this
ObjectReference SelfObj = Self as ObjectReference
mySpell.cast(SelfObj, SelfObj)
utility wait (10)
ObjectReference delete()
EndIf
EndEvent

 

I tried defining specifically which object reference to delete but it kept telling me object already defined not needed. So I just put ObjectReference delete() and it stopped giving me that error and gave me the new one instead.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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