[Q] Ok now I really dont get it :S

Post » Mon Jun 18, 2012 4:33 pm

So I have been beasting away at this little script for ages and I know I am almost done, but for some reason it just wont quite work!

Essentaily I have created an ability which calls a scripted effect, below is the script.

Scriptname ProcEffect extends activemagiceffectactor property selfRef auto hiddenfloat property HPthreshold = 0.90 auto{Below this HP we have a chance of the special effects. }float property effectChance = 0.80 auto{effect may happen when HP is below this level. }spell  property FortifyEffect autoEVENT OnEffectStart(Actor Target, Actor Caster)selfRef = casterendEVENTEVENT onHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if (selfRef.getActorValuePercentage("Health") < HPthreshold) && \   !(selfRef.isDead())	float dice = utility.RandomFloat(0,1)		   if dice <= effectChance				debug.messagebox("test"+selfRef)  FortifyEffect.cast(selfRef,selfRef)	endifendifendEVENT


This script appears to work, with the debug text being displayed on hit under the corect circumstances. On hit it outputs "test" (might have missed a 0 or two).

yet no spell is cast :( (I have tried linking the fortifyeffect to all manner of spells from summon familiar to altar of zenithar but no spell is ever cast)

The only thing I can think is that the actor being fed back is not the player, because the ability isnt really cast (its constant effect).

Anyone have any input on this? It really has me stumped!
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Mon Jun 18, 2012 3:40 am

crap on second thought, teh actor must be right, because that is being used to determin when to fire the debug text :S So I am 100% unsure as to why no spell seems to fire.
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Mon Jun 18, 2012 6:07 pm

I am in no way a script expert; but, after reading your script I wonder, shouldn't the ID or name of the spell it self be referenced somewhere in it?
User avatar
Anthony Santillan
 
Posts: 3461
Joined: Sun Jul 01, 2007 6:42 am

Post » Mon Jun 18, 2012 6:22 pm

nope, this reference is done by editing the proprties values within the editor.
This is shown for the message boxes in this tutorial. (only differnece is I have linked my fortify spell to one in game.
http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Introduction_to_Properties
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm

Post » Mon Jun 18, 2012 9:01 am

Ah, sorry then, ignore me xD
User avatar
Mr. Allen
 
Posts: 3327
Joined: Fri Oct 05, 2007 8:36 am

Post » Mon Jun 18, 2012 6:10 am

You did notice the notes on the "Cast" Function in the wiki did you? The Spell must be castable by the source, meaning it must have enough magica and possible other prerequisites. Also the cast function casts the spell without playing any visible effects and animations.

Just wanting to make sure it isn't just you not noticing that the spell was cast.

Because to me the script looks perfectly fine. Besides you should make sure that the akSource is also not the player himself or you might end up in a loop of endlessly casting that spell until magicka's all used up.
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Mon Jun 18, 2012 3:33 pm

cool, well i picked an effect which has no cost at all, and I am checking the magic "active effects" and such when the debug text fires, but nothnig is there.

Got work in a sec, but I will check out the akSource when I come home. I havea feeling that whatever I am doing wrong, its editor side :( but tehre doesnt seem to be much info on the spell side of things on the wiki :(
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Mon Jun 18, 2012 5:35 pm

Well before you do, I was too tired last night. Of course you will want to check akAggressor for not being the player as akSource would refer to a weapon and not an actor.
User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Mon Jun 18, 2012 4:05 am

Hmm this I must check, I used the dragonpriest ultra mask as a template for this script, so perhaps that is where I am going wrong? This is how I have the entire spell set up...

Constant effect ability > Magic Effect(script) > Spell > Effect.

Part of me thinks that theeffect containnig the script is wrong, but if the debug text is firing correctly, it cant be the case!

The origonal set up of teh dragonpriest mask gers along the lines of

Enchantment constant effect > magic effect (script) > lots of spells depending on dice roll > effects
User avatar
~Sylvia~
 
Posts: 3474
Joined: Thu Dec 28, 2006 5:19 am

Post » Mon Jun 18, 2012 6:31 am

Nope using a constant effect ability and attaching the script to it's effect is the correct approach here. I cannot exactly tell you why that spell isn't cast. It should totally work the way you did it. Ever tried to run the script with the debug.messagebox call moved to after the spell was cast? Only other thing I could imagine is in fact that without that check I described before, you already entered an infinite loop that prevents the effect of the spell from being applied to the player.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Mon Jun 18, 2012 8:01 am

hmm potentially, I have noted the odd crash when I exit the game (pretty rare though, seen twice). Ill have to do the check when I get home.
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Mon Jun 18, 2012 5:38 pm

Ok so I have done those checks!
akAggressor returns objectreference<(0005CEEF)>
akSource returns WEAPON<(0001359D)>

It kind of looks right, but hoping that its not, and that this will be an easy fix! I placed the debud line after the spell cast and it still worked.

(on a side note, how does setting property values in the editor compare to the values in script? does one overwrite the other? Im seeing my percentage values not worknig as they should but this isnt such a big problem right now!)
User avatar
Laura Tempel
 
Posts: 3484
Joined: Wed Oct 04, 2006 4:53 pm

Post » Mon Jun 18, 2012 12:56 pm

Values set in the editor are the default values those properties get upon game startup. If you change the value using the set function in a script that changes remains permanent and unless the property is defined as a constant it's new value is even stored in a savegame.
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Mon Jun 18, 2012 2:37 pm

right! that I did not expect, and the post save alteration would explain why my tweaks havent made difference!

Got any input with regards to the akAggressor/ akSource?
User avatar
lolli
 
Posts: 3485
Joined: Mon Jan 01, 2007 10:42 am

Post » Mon Jun 18, 2012 12:19 pm

Figured it out :D Ironically, it was to do with the 2ndary problem! I had initialy had the property as a default value on the first attempt, and this "value" persisted over the save I was using, meaning all other attempts afterwards with actual spells assigned didnt update properly!

I hope that my derp mistake can bea lesson to others with problems!

:D
(and thanks jason, REALLY appreciate the help, may your modding be fruitfull!)
User avatar
Melanie Steinberg
 
Posts: 3365
Joined: Fri Apr 20, 2007 11:25 pm


Return to V - Skyrim