fg109 Posted April 21, 2012 Author Share Posted April 21, 2012 @tunaisafish Thanks! :thumbsup: @AwesomeSkyrimDude Example: Scriptname fg109TestActorScript extends Actor {Script to auto-adjust the stats/skills of the actor carrying it} ;;;;;;;;;;;;;;;; ;; Properties ;; ;;;;;;;;;;;;;;;; String[] Property Stats Auto {Array of the stat names (Health, Magicka, Stamina)} String[] Property Skills Auto {Array of the skill names (Alchemy, Alteration, etc.)} Float[] Property StatWeights Auto {Array of the weights for the stats} Float[] Property SkillWeights Auto {Array of the weights for the skills} Float[] Property StartStats Auto {Array of the starting values for stats} Float[] Property StartSkills Auto {Array of the starting values of the skills} Int Property StatIncreasesPerLevel Auto Hidden {The total Health + Magicka + Stamina gain per level} Int Property SkillIncreasesPerLevel Auto Hidden {The total skill points gained per level} Int Property SkillMin = 1 Auto {The minumum for a skill level} Int Property SkillMax = 100 Auto {The maximum for a skill level} Float Property StatWeightsTotal Auto Hidden {The total of the stat weights} Float Property SkillWeightsTotal Auto Hidden {The total of the stat weights} Int Property Level_Current Auto Hidden {Used to track changes in the actor's level} Int Property StartLevel Auto {The actor's starting level} ;;;;;;;;;;;; ;; Events ;; ;;;;;;;;;;;; Event OnInit() Debug.Notification("OnInit running.") int index = 0 while (index < StatWeights.Length) StatWeightsTotal += StatWeights[index] index += 1 endwhile index = 0 while (index < SkillWeights.Length) SkillWeightsTotal += SkillWeights[index] index += 1 endwhile Level_Current = StartLevel RegisterForSingleUpdate(10) ;use single update loop to prevent log spam if mod removed Debug.Notification("OnInit completed.") endEvent Event OnUpdate() Debug.Notification("OnUpdate running.") if !(GetLevel() == Level_Current) Level_Current = GetLevel() UpdateActorValues() endif RegisterForSingleUpdate(10) Debug.Notification("OnUpdate completed.") endEvent ;;;;;;;;;;;;;;; ;; Functions ;; ;;;;;;;;;;;;;;; ;/ Function SetDefaultStats() ;This whole function is unnecessary, set them in the properties EndFunction /; Function UpdateActorValues() Debug.Notification("Updating Stats and Skills.") StatIncreasesPerLevel = Game.GetGameSettingInt("iAVDHMSLevelUp") SkillIncreasesPerLevel = Game.GetGameSettingInt("iAVDSkillsLevelUp") int ModLevel = Level_Current - StartLevel float NewValue = 0.0 int index = 0 while (index < Stats.Length) NewValue = StartStats[index] + ModLevel * StatWeights[index] / StatWeightsTotal * StatIncreasesPerLevel SetActorValue(Stats[index], NewValue) index += 1 endwhile index = 0 while (index < Skills.Length) NewValue = StartSkills[index] + ModLevel * SkillWeights[index] / SkillWeightsTotal * SkillIncreasesPerLevel if (NewValue < SkillMin) NewValue = SkillMin elseif (NewValue > SkillMax) NewValue = SkillMax endif SetActorValue(Skills[index], NewValue) index += 1 endwhile Debug.Notification("Stats and skills have been updated.") EndFunction @avenger404 http://www.youtube.com/watch?v=QgIUBpvWvXQ @phnx Maybe there's something weird about the conditions, and you just can't use them to create new things... Try using just one condition: GetMovementDirection == 0 So the magic effect should become active whenever the player is standing still. @Linky1 Add this script to your spells: Scriptname Example extends ActiveMagicEffect float property bloodcost = 60.0 auto Event OnEffectStart(Actor akTarget, Actor akCaster) akCaster.DamageAV("Health", bloodcost) EndEvent @scrivener07 :thumbsup: Link to comment Share on other sites More sharing options...
EnaiSiaion Posted April 21, 2012 Share Posted April 21, 2012 (edited) I'm stuck again. :( I want a different unit (my conjured minion) to do something when I cast a spell. For the sake of this example let's say I want to heal it 20 points. The problem is, either I place a MagicEffect on myself and use event OnSpellCast but then I don't know how to refer to my minion actor. Or else I place the MagicEffect on the minion instead, but then the script won't respond when I cast a spell myself, only when the minion casts a spell. :facepalm: Edited April 21, 2012 by EnaiSiaion Link to comment Share on other sites More sharing options...
fg109 Posted April 21, 2012 Author Share Posted April 21, 2012 @EnaiSiaion If you want to be able to reference your summon, I refer you to this thread. Link to comment Share on other sites More sharing options...
EnaiSiaion Posted April 21, 2012 Share Posted April 21, 2012 So their solutions are either:"Replace all summoning spells" (unacceptable)"Use the unreliable area search function and have 50% chance to grab your charmed warlock's atronach instead of yours" I almost got what I needed - a spell that causes the target minion to instantly RemoteCast a spell back at you, thereby placing a MagicEffect on you that can listen for OnSpellCast while the akCaster is the minion. This would have worked perfectly if the minion didn't cast the spell in the direction he is facing instead of at me.BEH Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 21, 2012 Share Posted April 21, 2012 (edited) I got it working how I want now basically, figured another way with no loop, just need to tweak times now to something that feels right. I am curious though, what if I only wanted this effect to apply to players that are single wielding one handed swords? I should be able to set those conditions on the perk itself right? Edit: One other question, I currently have it set up where the perk has 2 levels, at level one you can only ever stagger the enemy, at level 2 you can disarm with very good timing. I have seperate scripts running to do this, would it be better to have only 1? Cause right now I think its running both together and that seems unnecessary. Edited April 21, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
fg109 Posted April 21, 2012 Author Share Posted April 21, 2012 (edited) @EnaiSaion So are you using the random search function or did you figure out some other way to find a reference to your summon? @AwesomeSkyrimDude The conditions in the perk window are only used if you happen to be adding the perk through the skills menu. If you were using a perk entry point, you could also condition when the perk comes into effect. But there is no way to place conditions on a perk that adds an ability, so you will have to set the conditions on the ability itself. I really haven't messed around much with perks, so I don't know if they're both running. I don't think so, but I don't know for sure. Edited April 21, 2012 by fg109 Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 21, 2012 Share Posted April 21, 2012 (edited) I think they are based on the debug notification I have set up that it's outputting to me. Maybe there's something else going on though I don't know. Edit: I think I know how I'm gonna change stuff around now and everything should be good. I notice though that in your code example you said "GetEquippedItemType(0) == 7" and said that means melee weapon, is there a specific value for 1 handed swords? Edited April 21, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
fg109 Posted April 21, 2012 Author Share Posted April 21, 2012 http://www.creationkit.com/GetEquippedItemType_-_Actor I actually had "!GetEquippedItemType(0) == 7" which means not equipped with a bow. Link to comment Share on other sites More sharing options...
AwesomeSkyrimDude Posted April 21, 2012 Share Posted April 21, 2012 (edited) Ah ok thank you. Edit: (Man I edit my posts a lot, I figure its better than making new ones all the time) Ok I have it working only with one handed swords but I think its still running both scripts together, I see there is a removespell command and I was going to put that in the script for the second level of the perk to make it remove the first one but I have to have then classified as abilities to be applied by the perk, not spells, and from what I can tell there is no removeability command. Edited April 21, 2012 by AwesomeSkyrimDude Link to comment Share on other sites More sharing options...
fg109 Posted April 21, 2012 Author Share Posted April 21, 2012 Abilities are considered spells. An alternative, instead of removing abilities, is to only have 1 ability. The first rank of the perks adds the ability to the player. The second rank of the perk does nothing. The ability will have two magic effects. The first one is conditioned to run when the player has rank 1 but not rank 2 in the perk. The second runs when the player has both ranks of the perk. Link to comment Share on other sites More sharing options...
Recommended Posts