Kerberus14 Posted December 29, 2014 Share Posted December 29, 2014 scriptname Barrier extends ObjectReference Actor Property PlayerRef auto float playerbarrier float currenthealth Event OnCombatStateChanged(Actor akTarget, int aeCombatState) currenthealth = PlayerRef.GetActorValue("Health") if aeCombatState==1 playerbarrier=PlayerRef.GetBaseActorValue("Health")/100*50 debug.messagebox(playerbarrier) else playerbarrier=0 endif endevent Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) if playerbarrier>0 && PlayerRef.GetActorValue("Health") < currenthealth debug.messagebox(playerbarrier) PlayerRef.RestoreActorValue("Health",currenthealth-PlayerRef.GetActorValue("Health")) playerbarrier= playerbarrier - (currenthealth - PlayerRef.GetActorValue("Health")) endif endevent This script does not run at all. Link to comment Share on other sites More sharing options...
Asterra Posted December 29, 2014 Share Posted December 29, 2014 Alright, different question. I'm trying to take advantage of Skyrim's blood impact effects. What they do natively is find a surface to plop down big ugly blood textures, while simultaneously causing a spurting effect at wherever the texture lands. I have already made a slight mod to the impact effect's mesh so that the direction it spurts remains consistent (originally it has a kind of variability to it). The problem here is that I need the blood to spurt from, you know, a body, but the impact effect is not designed to land on a body. So this causes two problems: First, the direction of the spurt is dictated by basically the ground, so it's always up. Second, the origin of the spurt is, again, the ground, which basically makes it unusable. I'm not really after trying to get the texture to land on the body; I already know that this cannot be done with an impact effect, and that there are other ways of achieving it. But I am very much wanting the blood spurt to occur where I specifically want it to on the body - not from the ground. What should I be doing to achieve this? Link to comment Share on other sites More sharing options...
Terra Nova Posted December 29, 2014 Share Posted December 29, 2014 (edited) snip This script does not run at all. OnCombatStateChanged doesn't work for the player, and it doesn't work for ObjectReferences that is not an NPC. OnHit is sent when an ObjectReference is hit by something. Edited December 29, 2014 by Terra Nova Link to comment Share on other sites More sharing options...
Kerberus14 Posted December 29, 2014 Share Posted December 29, 2014 The objectReference is the Player. So I'm stuck to only using OnHit? :< Link to comment Share on other sites More sharing options...
Terra Nova Posted December 29, 2014 Share Posted December 29, 2014 (edited) Yes. Little warning about OnHit. It is processed every time something is hit. Not just what you have it scripted to look for. If the player is hit by many things at once, this could cause some problems. Perhaps you could use a STATE to have OnHit run once if you don't need it more then once. Edited December 29, 2014 by Terra Nova Link to comment Share on other sites More sharing options...
Kerberus14 Posted December 29, 2014 Share Posted December 29, 2014 I'm trying to implement a second health bar.. I want that bar to take damage before the health bar does.. if onhit does not work properly either, then I have no other events to use.. lol Link to comment Share on other sites More sharing options...
Terra Nova Posted December 29, 2014 Share Posted December 29, 2014 Don't misunderstand. OnHit works as intended. But your script basically will do all of that checking for every kind of attack. BUT if you script it to run code ONLY if the player is hit by a spell, then that code will run, AND if they are hit by something else, the Event is still sent, but the code for the spell check is not ran. I hope I explained that well enough. Link to comment Share on other sites More sharing options...
Kerberus14 Posted December 29, 2014 Share Posted December 29, 2014 (edited) Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked ) count=count+1 if PlayerRef.GetRace()!=NordRaceVampire || PlayerRef.GetRace()!=ArgonianRaceVampire || PlayerRef.GetRace()!=BretonRaceVampire || PlayerRef.GetRace()!=DarkElfRaceVampire || PlayerRef.GetRace()!=HighElfRaceVampire || PlayerRef.GetRace()!=ImperialRaceVampire || PlayerRef.GetRace()!=KhajitRaceVampire || PlayerRef.GetRace()!=RedguardRaceVampire || PlayerRef.GetRace()!=WoodElfRaceVampire|| PlayerRef.GetRace()!=OrcRaceVampire || PlayerRef.GetRace()!= ElderRaceVampire if count == 5 PlayerRef.RestoreActorValue("Health",PlayerRef.GetBaseActorValue("Health")/100*10) count=0 endif endif endeventThis event keeps happening EVEN if I change race to a vampire and it really ticks me off, I can't figure out WHY it does that, the script is attached directly to the player.The condition is clear too, logical to me, if you are that race then that IF should NOT happen, YET IT STILL DOES. Edited December 29, 2014 by Kerberus14 Link to comment Share on other sites More sharing options...
Asterra Posted December 29, 2014 Share Posted December 29, 2014 Is there a way to tell when an animation finishes? Example: Player.DrawWeapon(). I want to hold off doing anything else until the drawing animation completes. (In this case, the game understandably believes the weapon is drawn the moment the animation starts.) Since the timing of this can be variable, I cannot simply wait an arbitrary X seconds. One of my last several questions will get an answer. :p Link to comment Share on other sites More sharing options...
lofgren Posted December 29, 2014 Share Posted December 29, 2014 Alright, I need to pin this one down once and for all. My mod causes certain visual effects on NPCs around the player. I achieve this through the use of a spell & effect. I have made note of the fact that when the player changes locations, any NPC they happen to have left behind (even if it was for just a split second, such as a follower) loses the spell, triggering the OnEffectFinish. There has to be a well-known method of dealing with this. After all, spells can't just disappear from followers just because the player is entering a cave or whatever. For the time being, I am just having the spell re-apply itself whenever this happens. Again, there really has to be a better way. Note!: I will not use aliases for this. This effect has to be able to be applied to any and every NPC, transparently, without having to set up a dozen+ aliases and juggle those. If your cloak parameter spell has a concentration delivery type it should be reapplied every second. Is that not fast enough for you? Using cloak spells is pretty much the primary method for dealing with the situation you describe, but the effect will still be removed from followers if they leave the player's aura. It will just get reapplied instantly when they reenter it. Link to comment Share on other sites More sharing options...
Recommended Posts