[Papyrus] [Help] 3 issues with event triggersobject checks.

Post » Sun Jun 24, 2012 6:15 am

Hey people! You may have seen a few of my topics floating around requesting help, some have been fruitful, others not so! Anyways, I have a couple of issues left before I start alpha testing and need some assistance with them. In light of a great post by Cipscis, I am going to try and reinforce this example!

So a little about my project: I am creating replacement racial powers which proc automatically on certain conditions. I am generally using the below layout for my replacements.

Ability (constant on self) > Scripted Proc Effect > Created Spell > Original Power effect* + Dummy cooldown effect.
*I may need to change wood elf one a bit to an AoE.

Below is a brief outline of each race

Argonian: Trigger the Hist healing effect on hit when hp is below a threshold.
Orc: Trigger the Berserk effect on hit when hp is below a threshold.
Nord: Trigger the Battle Cry effect on hit when hp is below a threshold. ***
Dunmer: Trigger the Ancestors Wrath effect on hit when hp is below a threshold.
Redguard: Trigger Adrenaline rush effect on hit when hp is below a threshold (I wanted to make it on a power attack by the Redgaurd, but I couldn’t get this to work).
Altmer: Trigger the magicka regen on a spell cast when magicka is below a threshold.
Breton: Trigger the dragonskin effect when hit by a harmful spell.***
Imperial: Trigger Calm effect when hit by a human NPC***
Bosmer: Trigger Command effect when hit by a beast.***
Kajiit: I didnt make any changes, NightEye counting as a minor power and I have no idea if I can script it to proc in dark areas only!

So the *** represent races I have problems with.

1. The Nord Problem: This isnt so much an issue with the ability (I think) becuase it seems to be proccing a lot when I am hitting the nords in Helgen, but for some reason, it isn't showing up on a player Nord. On teh off chance that the script is the problem, it is below.

Spoiler
Scriptname modNordProcEffect extends activemagiceffectactor property selfRef auto hiddenfloat property HPthreshold = 0.70 auto{Below this HP we have a chance of the special effects. }float property effectChance = 0.20 auto{Chance effect may happen. }spell property BattleCry automagicEffect property CryPresent 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.HasMagicEffect(CryPresent)) && \   !(selfRef.isDead())	float dice = utility.RandomFloat(0,1)		if dice <= effectChance		BattleCry.cast(selfRef,selfRef)		endifendifendEVENT

2. The Imperial Problem (and wood elf too I guess).
I haven't spent too much time on this, but I have tried the below script, but it wont compile can anyone think of a way how I can have a scripted effect that will result in a spell cast when struck by a beast/human NPC?

Spoiler
actor property selfRef auto hiddenfloat property effectChance = 0.70 autospell property FortifyEffect automagicEffect property FortifyPresent autoEVENT OnEffectStart(Actor Target, Actor Caster)		selfRef = caster	endEVENTEVENT onHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if (akAggressor.HasKeyword(ActorTypeNPC)) && \!(selfRef.HasMagicEffect(FortifyPresent)) && \   !(selfRef.isDead())	float dice = utility.RandomFloat(0,1)	 if dice <= effectChance		FortifyEffect.cast(selfRef,selfRef)		endifendifendEVENT

3. The Breton Problem:
I have barely thought about this, but I am considering using a onMagicEffectApply event, but it doesnt appear to allow for any checks to define an attack as a harmful spell or not (I could be wrong though).

Can anyone provide some feedback? (this post took me an hour to write, so please dont let it sink to page 8 in 2 minutes!!)
User avatar
Austin Suggs
 
Posts: 3358
Joined: Sun Oct 07, 2007 5:35 pm

Post » Sun Jun 24, 2012 7:44 am

Hi thesniperdevil :)

In the first script you posted, you've defined an http://www.creationkit.com/OnHit_-_ObjectReference event in a script that extends http://www.creationkit.com/ActiveMagicEffect_Script, but that event is only called by the game for http://www.creationkit.com/ObjectReference_Script. Although your script will compile, the event will never be called natively.

The same is true for the http://www.creationkit.com/OnMagicEffectApply_-_ObjectReference event - it won't stop your script that extends ActiveMagicEffect from compiling, but the game will never call it. The only events that will be called natively for scripts extending ActiveMagicEffect are listed http://www.creationkit.com/ActiveMagicEffect_Script#Events.

I can't see what might be causing your second script not to compile. What error is given by the compiler when you attempt to compile it?

Cipscis
User avatar
Kaley X
 
Posts: 3372
Joined: Wed Jul 05, 2006 5:46 pm

Post » Sun Jun 24, 2012 6:46 am

Cipscis,

Now I thought that the OnHit event wouldn't work either, but it does. I have sucessfully used that script for the argonian, orc and dark elf powers- the spells correctly proc when I am hit (at least in melee which is as far as I ahve tested the pre-alpha). I have also sucessfully utilised the onspellcast, which also does not extend the Active magic effect. (Take a look at the dragonpriest mask ultra script, its what I copied.)

The second script gives me an error informing me that I need to define my keyword "ActorTypeNPC" as a varaible. Which is odd, would I need to quote mark it, like I did "health" in the first script?
User avatar
Dean Ashcroft
 
Posts: 3566
Joined: Wed Jul 25, 2007 1:20 am

Post » Sun Jun 24, 2012 7:53 am

Yeah, it turns out I'd missed a nice bit of information about http://www.creationkit.com/ActiveMagicEffect_Script - they get sent events from the http://www.creationkit.com/Actor_Script on which they're running, which means events like http://www.creationkit.com/OnHit_-_ObjectReference will work after all.

If you're trying to use the editorID of your keyword without defining a property, that won't work. Take a look at this for information on that - http://www.cipscis.com/skyrim/tutorials/editorids.aspx

Cipscis
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Sun Jun 24, 2012 9:34 am

ok, I think I get the editor ID thing. I am at work at the moment so I won't be able to try stuff out, a few further questions?

1. the property for OnMAgicEffectApply "akEffect", is tehre any way how I could check this in an IF statement to see if it is a harmful/aggresive spell ?

2. I still have no idea why my nord ability wont apply to the player Nord, but seems to apply to AI nord. Is there any special Nord related stuff going on behind the scenes because they are the native race of the game setting?
User avatar
Matthew Aaron Evans
 
Posts: 3361
Joined: Wed Jul 25, 2007 2:59 am

Post » Sun Jun 24, 2012 1:55 am

Ok, so the Editor ID / keyword thing as royally confused me :/ Ill havea look through someof their scripts until I get a reply here to help me :(

From what I can tell my issues boil down to two things.

1. I do not know how to get information about the guy attacking me.
Spoiler
Scriptname ModBosmerProc extends activemagiceffectactor property selfRef auto hiddenEVENT OnEffectStart(Actor Target, Actor Caster)selfRef = casterendEVENTEVENT Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)if the guy attacking is of a race whos keyword contains "actortypeanimal"  (or "actortypeNPC" for imperial power)do stuffendifendEvent

2. I do not know how to get the flag information about a spell effect being cast at me.

Spoiler
 Scriptname ModBretonDragonProc extends activemagiceffectactor property selfRef auto hiddenEVENT OnEffectStart(Actor Target, Actor Caster)selfRef = casterendEVENTEVENT onMagicEffectApply(ObjectReference akAggressor, MagicEffect akEffect)if magiceffect is flagged as hostile    Do somethingendifendEvent 

quite frustrating!
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am


Return to V - Skyrim