AwesomeSkyrimDude Posted April 20, 2012 Share Posted April 20, 2012 Script is compiling without errors now but not taking effect in game, this may have nothing to with the actual script though so maybe this isn't the right place for it. Right now I have the script applied to a magic effect that's related to a perk, I think the problem is somewhere in there, like how its being called or something. Link to comment Share on other sites More sharing options...
avenger404 Posted April 20, 2012 Share Posted April 20, 2012 (edited) Ooone more question. (still getting grief over your last advice. It still doesn't think the faction is defined. Will try again tomorrow to make absolutely sure...) Is there any way you can script the exact damage of the spell? Aka: the damage = creature/player's current max health -1? So the damage would change for one spell dependant on who the boss was targeting? EDIT: Gonna just try from scratch - this is getting really annoying. Thanks for your help thusfar. Will follow everything to the letter and see if it works, but the above question still stands, because I'd like to know if this is possible? Edited April 20, 2012 by avenger404 Link to comment Share on other sites More sharing options...
fg109 Posted April 20, 2012 Author Share Posted April 20, 2012 (edited) @ChampionOfHircine Just do exactly what I did in the video. @cooltrickle You misplaced the RemoveSpell function. @Phnx There is no such thing as an OnGameStart event... I don't have fore's idles, so I don't know whether or not what I tell you will work. The game already plays idles when the player isn't moving. Why not add fore's idles to the possible idles it can play? Go to: GamePlay -> Animations... -> Actors\Characters\Behaviors\0_Master.hkx -> ActionIdle -> NPCIdleRoot -> NonCombatIdles and add the idles to the IdlePlayerRoot. If that doesn't work, then I guess you can try scripting. Instead of using a quest script, I would use a magic effect script. This is because you can put conditions on a magic effect to determine when it will run, so you can copy all the conditions that were on the IdlePlayerRoot. So use this for the magic effect script: Scriptname PlayRandomIdle extends ActiveMagicEffect Idle Property MyFNISspellc1 Auto Idle Property MyFNISspellc2 Auto Event OnEffectStart(Actor akTarget, Actor akCaster) int RandomPercent = Utility.RandomInt(0, 99) if (RandomPercent < 50) akTarget.PlayIdle(MyFNISspellc1) else akTarget.PlayIdle(MyFNISspellc2) endif EndEvent and add the magic effect to an ability, and the ability to the player. @AwesomeSkyrimDude Sorry, didn't know you intended to use the script for an ability. So change the script so that it extends "ActiveMagicEffect" instead of "ReferenceAlias", and "OnEffectStart(Actor akTarget, Actor akCaster)" instead of "OnInit()" and "akTarget" instead of "GetActorReference()". @avenger404 You can script the damage of a spell like that, but then remember not to give the spell any magnitude, or at least don't have it as a value modifier with assoc. item health. This is because the script is applied on top of anything done by the effect itself, so having any actual effects on the spell might kill the actor. Scriptname Example extends ActiveMagicEffect Event OnEffectStart(Actor akTarget, Actor akCaster) float Damage = akTarget.GetActorValue("Health") - 1 akTarget.DamageActorValue("Health", Damage) EndEvent Edited April 20, 2012 by fg109 Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 20, 2012 Share Posted April 20, 2012 (edited) @fg109 I probably should have mentioned it at the start. Anyhow I now get these messages: "(5,13)no viable alternative at input '(' (5,28): required (...)+ loop did not match anything at input ',' (5,44): required (...)+ loop did not match anything at input ')'" Edit:Fixed those errors, get none now but still doesn't seem to be taking effect in game. Edited April 20, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
Leeira Posted April 20, 2012 Share Posted April 20, 2012 (edited) I try to check if an Item has a keyword: State running Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if (akBaseItem.HasKeyword(WeapTypeSword) ) endIf EndEvent EndState But it says "type mismatch on parameter 1 (did you forget a cast?)" The problem might be the following, I get a Form but need a Function if I understand rightly:Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)bool Function HasKeyword(Keyword akKeyword) nativeSo how do I get the Form to a Function? Edit: Ok, I got it solved myself, so no help is needed (for now). I had to use a Property for the Keyword "WeapTypeSword". Edited April 20, 2012 by Leeira Link to comment Share on other sites More sharing options...
Veritas22 Posted April 20, 2012 Share Posted April 20, 2012 Thank you so much fg! Your script worked like a charm. Kudos! Link to comment Share on other sites More sharing options...
avenger404 Posted April 20, 2012 Share Posted April 20, 2012 For the spell, script has no errors, but I'm guessing I'll need properties for the script to take effect; any thoughts there? Currently the spell does only the damage of whatever <mag> I set to it, and the script doesn't take effect. Link to comment Share on other sites More sharing options...
fg109 Posted April 20, 2012 Author Share Posted April 20, 2012 @AwesomeSkyrimDude Try adding some debug messages to the script in order to figure out what's happening: Scriptname Example extends ActiveMagicEffect Bool Blocking Float BlockStartTime Event OnEffectStart(Actor akTarget, Actor akCaster) Debug.Notification("Custom ability has become active.") RegisterForAnimationEvent(akTarget, "BlockStart") RegisterForAnimationEvent(akTarget, "BlockStop") EndEvent Event OnAnimationEvent(ObjectReference akSource, String asEventName) if (asEventName == "BlockStart") Debug.Notification("Player has started blocking.") BlockStartTime = Utility.GetCurrentRealTime() Blocking = True elseif (asEventName == "BlockStop") Debug.Notification("Player has stopped blocking.") Blocking = False endif EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) if (akSource as Weapon) && !((akAggressor as Actor).GetEquippedItemType(0) == 7) Debug.Notification("Player was hit by a melee weapon.") if (Blocking) float BlockTime = Utility.GetCurrentRealTime() - BlockStartTime ;time in menu is counted if (BlockTime < 0.25) Debug.Notification("Attempting to disarm assailant.") (akAggressor as Actor).UnequipItem(akSource) (akAggressor as Actor).DropObject(akSource) elseif (BlockTime < 1.0) Debug.Notification("Attempting to stagger assailant.") Debug.SendAnimationEvent(akAggressor, "StaggerStart") else Debug.Notification("No effect because player was blocking for over 1 second.") endif endif endif EndEvent @avenger404 The script I gave you doesn't require and properties. I have no problems making a spell work with it. Are you sure you did everything correctly? Maybe try changing the effect archetype to script and see if that helps. Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 20, 2012 Share Posted April 20, 2012 @fg I have already done that and the debug messages never display so the script is not activating apparently. This could be a problem outside the script itself right? Link to comment Share on other sites More sharing options...
fg109 Posted April 20, 2012 Author Share Posted April 20, 2012 @AwesomeSkyrimDude Yes, it could do with how you're applying it. The way it is now, it's meant to be attached to the magic effect of an ability (so constant effect, targeting self). Do you have that correct? If you do and it's still not working, forget about the perk for now and just add the ability to the player directly to check if it works. Link to comment Share on other sites More sharing options...
Recommended Posts