lofgren Posted March 4, 2016 Share Posted March 4, 2016 (edited) Again, getting no errors when compiling, and animation events work as desired, however, actor action events do not appear to function, and I fail to see why. Some animation events don't fire a Papyrus event. Are you sure these do? That is, have you seen them work in other circumstances or seen others use them, or is this the only time you've seen them tried? It may be that these events simply don't work. Edit: I see now I read that backwards. Nevermind me. Edited March 4, 2016 by lofgren Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 4, 2016 Share Posted March 4, 2016 Thank you, IsharaMeradin, but what about the second part of the question? Why does debug.SendAnimationEvent produce no effect? All right, this is strange: getting rid of the abHitBlocked condition made NPCs stagger, but only once they had around 25% of their total health removed (does this have something to do with their resistances?). Switching from StaggerStart to BleedOutStart made the script behave normal. Just what exactly is going on here? Update: Stumbled upon another problem: ScriptName ImprovedCombatParry Extends ReferenceAlias Bool DeflectWindowActive Bool ParryWindowActive Actor Property PlayerRef Auto Spell Property Stagger Auto Event OnInit() RegisterForAnimationEvent(PlayerRef, "BlockStartOut") RegisterForAnimationEvent(PlayerRef, "BlockStop") RegisterForActorAction(0) EndEvent Event OnActorAction(int actionType, Actor akActor, Form source, int slot) If akActor == PlayerRef && actionType == 0 UnregisterForUpdate() DeflectWindowActive = 1 Debug.Notification("Deflect window is active") RegisterForSingleUpdate(0.5) EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) If akSource == PlayerRef ElseIf asEventName == "BlockStartOut" ParryWindowActive = 1 RegisterForSingleUpdate(0.2) ElseIf asEventName == "BlockStop" UnregisterForUpdate() ParryWindowActive = 0 EndIf EndEvent Event OnUpdate() If ParryWindowActive ParryWindowActive = 0 ElseIf DeflectWindowActive DeflectWindowActive = 0 Debug.Notification("Deflect window is inactive") EndIf EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) If (abHitBlocked && ParryWindowActive) || DeflectWindowActive Stagger.Cast(akAggressor) EndIf EndEvent Again, getting no errors when compiling, and animation events work as desired, however, actor action events do not appear to function, and I fail to see why. OnActorAction is an SKSE event. If you are not starting the game with SKSE, the event will do nothing.Other possibilities of it not working are that your test save already contains a version of the script and the game is not recognizing the update. Try testing on a save that has not seen any aspect of the mod you are working on.Beyond that, no clue. Link to comment Share on other sites More sharing options...
Darkxenoth Posted March 4, 2016 Share Posted March 4, 2016 (edited) *Edited*Hey, could anyone take a look at this code I'm toying with and tell me if there is any reason it shouldn't work as intended? I made it after a friend asked me about making a weapon he could use from the start and throughout his playthrough regardless of level... so I was trying to make it so the weapon would hit harder as you level, going with numbers that he suggested. scriptName selfLevelingSwordScript Property Weapon darxSelfLevelingSword auto Property Int pcLvl Property Int weapDmg Property Int dmgBuff Property Int varZ Function calcWeapDmg() pcLvl = (Game.GetPlayer().GetLevel()) if(pcLvl < 5) dmgBuff = 0 elseIf(pcLvl > 5 && pcLvl <= 20) dmgBuff = (pcLvl - 5) elseIf(pcLvl > 20 && pcLvl <= 50) dmgBuff = (15 + ((pcLvl / 5) - 4)) elseIf(pcLvl > 50) if((pcLvl / 10) < 6) varZ = 5 else varZ = ((pcLvl / 10) - 1) endIf dmgBuff = (21 + ((pcLvl / 10) - varZ)) endIf weapDmg = ((darxSelfLevelingSword.GetBaseDamage()) + dmgBuff) EndFunction Event OnEquip() calcWeapDmg() darxSelfLevelingSword.SetBaseDamage(weapDmg) EndEvent If it should work and compile fine as is, great. If you have any suggestions, or know of a mod that does this already please feel free to mention them.Thanks. Edited March 5, 2016 by Darkxenoth Link to comment Share on other sites More sharing options...
Darkxenoth Posted March 5, 2016 Share Posted March 5, 2016 (edited) Hey, could anyone take a look at this code I'm toying with and tell me if there is any reason it shouldn't work as intended? I made it after a friend asked me about making a weapon he could use from the start and throughout his playthrough regardless of level... so I was trying to make it so the weapon would hit harder as you level, going with numbers that he suggested. scriptName selfLevelingSwordScript Property Weapon darxSelfLevelingSword auto Property Int pcLvl Property Int weapDmg Property Int dmgBuff Property Int varZ Function calcWeapDmg() pcLvl = (Game.GetPlayer().GetLevel()) if(pcLvl < 5) dmgBuff = 0 elseIf(pcLvl > 5 && pcLvl <= 20) dmgBuff = (pcLvl - 5) elseIf(pcLvl > 20 && pcLvl <= 50) dmgBuff = (15 + ((pcLvl / 5) - 4)) elseIf(pcLvl > 50) if((pcLvl / 10) < 6) varZ = 5 else varZ = ((pcLvl / 10) - 1) endIf dmgBuff = (21 + ((pcLvl / 10) - varZ)) endIf weapDmg = ((darxSelfLevelingSword.GetBaseDamage()) + dmgBuff) EndFunction Event OnEquip() calcWeapDmg() darxSelfLevelingSword.SetBaseDamage(weapDmg) EndEvent If it should work and compile fine as is, great. If you have any suggestions, or know of a mod that does this already please feel free to mention them.Thanks. I've tweaked it to correct a few things, and it compiles and saves without issues... but doesn't actually seem to be having any sort of effect, in-game, on the damage of the sword that I attached it to. Here's what I'm currently working with: scriptName DarkxSelfLevelingSwordScript extends ObjectReference WEAPON Property DarkxSelfLevelingSword AutoInt Property pcLvl = 0 AutoInt Property weapDmg = 0 AutoInt Property dmgBuff = 0 AutoInt Property varZ = 0 Auto Function calcWeapDmg()pcLvl = (Game.GetPlayer().GetLevel())if(pcLvl < 5)dmgBuff = 0elseIf(pcLvl > 5 && pcLvl <= 20)dmgBuff = (pcLvl - 5)elseIf(pcLvl > 20 && pcLvl <= 50)dmgBuff = (15 + ((pcLvl / 5) - 4))elseIf(pcLvl > 50)if((pcLvl / 10) < 6)varZ = 5elsevarZ = ((pcLvl / 10) - 1)endIfdmgBuff = (21 + ((pcLvl / 10) - varZ))endIfweapDmg = ((DarkxSelfLevelingSword.GetBaseDamage()) + dmgBuff)EndFunction Event OnEquip()calcWeapDmg()DarkxSelfLevelingSword.SetBaseDamage(weapDmg)EndEventIn testing it in-game I equipped the sword at lvl 1, lvl 12, and lvl 17; spawning and killing a bandit with it at the different lvls. Each time I checked the damage in my inventory it hadn't changed at all, and from what I could tell it took the same amount of attacks to kill the bandit each time. Thus I can only conclude that it isn't actually working for some reason...If anyone could advise me as to what the problem might be, that would be much appreciated.*Edit* I think I might have figured out what was going wrong... checking...*Edit 2* Well, I thought it might work if, instead of attaching the script directly to the weapon, I attached it to a magic effect that is part of an enchantment on the weapon.... but no noticeable difference came about by doing such. I'm stumped. Edited March 5, 2016 by Darkxenoth Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 5, 2016 Share Posted March 5, 2016 @Darkxenoth Just to rule it out... Are you assigning the weapon to the property that you are using to reference the weapon? If not, then Papyrus has no idea what weapon you want to modify. Link to comment Share on other sites More sharing options...
Terra Nova Posted March 5, 2016 Share Posted March 5, 2016 (edited) Nevermind. Edited March 6, 2016 by Terra Nova Link to comment Share on other sites More sharing options...
TriFighter Posted March 6, 2016 Share Posted March 6, 2016 Hello, I'm new to the Papyrus language and have a few questions. I'm currently wanting to make a channeled flames alternative spell that does frost damage to the caster each "tick" (working on a Thermomancer theme). I'm writing a script for a Magic Effect for frost self-damage that I will use in the spell. Should I use onUpdate() to apply frost damage to the caster, in order for it to happen every tick? Is there any way to apply a damaged-by-frost visual effect to the caster while channeling this spell? Link to comment Share on other sites More sharing options...
zackalope Posted March 6, 2016 Share Posted March 6, 2016 Ok. So lets say I've created a new worldspace in the CK, and i've put a bunch of trees down. The LOD's aren't showing up. What steps do I take to get the worldspace to display the lods? (I'm using the worldspace to test the lods i've created from making new billboards, and then running tes5lodgen. They show up fine in game, but the scales are somewhat wrong. I want to edit the text files that go with the billboards, and check each run how close i'm getting, but the lods aren't showing in the game when I load the esp and coc to the location.) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 6, 2016 Share Posted March 6, 2016 Hello, I'm new to the Papyrus language and have a few questions. I'm currently wanting to make a channeled flames alternative spell that does frost damage to the caster each "tick" (working on a Thermomancer theme). I'm writing a script for a Magic Effect for frost self-damage that I will use in the spell. Should I use onUpdate() to apply frost damage to the caster, in order for it to happen every tick? Is there any way to apply a damaged-by-frost visual effect to the caster while channeling this spell? If you are going to use an update loop, use one of the single registration variants so that you don't get stuck with an infinite loop bloating someone's save cause they removed the mod at the wrong time. But yeah, you can use an update loop to damage the caster. You can also use that same location to apply a visual FX, see Play. Link to comment Share on other sites More sharing options...
nonamed817 Posted March 6, 2016 Share Posted March 6, 2016 (edited) Thank you, IsharaMeradin, but what about the second part of the question? Why does debug.SendAnimationEvent produce no effect? All right, this is strange: getting rid of the abHitBlocked condition made NPCs stagger, but only once they had around 25% of their total health removed (does this have something to do with their resistances?). Switching from StaggerStart to BleedOutStart made the script behave normal. Just what exactly is going on here? Update: Stumbled upon another problem: ScriptName ImprovedCombatParry Extends ReferenceAlias Bool DeflectWindowActive Bool ParryWindowActive Actor Property PlayerRef Auto Spell Property Stagger Auto Event OnInit() RegisterForAnimationEvent(PlayerRef, "BlockStartOut") RegisterForAnimationEvent(PlayerRef, "BlockStop") RegisterForActorAction(0) EndEvent Event OnActorAction(int actionType, Actor akActor, Form source, int slot) If akActor == PlayerRef && actionType == 0 UnregisterForUpdate() DeflectWindowActive = 1 Debug.Notification("Deflect window is active") RegisterForSingleUpdate(0.5) EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) If akSource == PlayerRef ElseIf asEventName == "BlockStartOut" ParryWindowActive = 1 RegisterForSingleUpdate(0.2) ElseIf asEventName == "BlockStop" UnregisterForUpdate() ParryWindowActive = 0 EndIf EndEvent Event OnUpdate() If ParryWindowActive ParryWindowActive = 0 ElseIf DeflectWindowActive DeflectWindowActive = 0 Debug.Notification("Deflect window is inactive") EndIf EndEvent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) If (abHitBlocked && ParryWindowActive) || DeflectWindowActive Stagger.Cast(akAggressor) EndIf EndEvent Again, getting no errors when compiling, and animation events work as desired, however, actor action events do not appear to function, and I fail to see why. OnActorAction is an SKSE event. If you are not starting the game with SKSE, the event will do nothing.Other possibilities of it not working are that your test save already contains a version of the script and the game is not recognizing the update. Try testing on a save that has not seen any aspect of the mod you are working on.Beyond that, no clue.Re-installed the game thrice today. Not even previously working scripts function now. I'm done. Christ, what in the hell is wrong? The simplest damn script won't work. Scriptname aaaCombatTestScript extends ReferenceAlias Actor Property PlayerRef Auto Event OnInit() RegisterForAnimationEvent(PlayerRef, "blockStartOut") EndEvent Event OnAnimationEvent(ObjectReference akSource, String asEventName) if akSource == PlayerRef && asEventName == "blockStartOut" debug.notification("Blocking") endif EndEvent Why is it so freaking random? Why was this working on a fresh installation from a few days ago, but suddenly isn't today? This is *censored*. Edited March 6, 2016 by nonamed817 Link to comment Share on other sites More sharing options...
Recommended Posts