Conditions in Papyrus

Post » Tue Jun 19, 2012 9:28 pm

I've found a way to use Conditions in Papyrus.
These are the functions that you find in Conditions interfaces in the CK.
RE: http://www.creationkit.com/Category:Conditions and http://www.creationkit.com/Category:Console_Commands

Basically, you get them across to Papyrus via Abilities:

(It is unusual that we can ForceFirstPerson () and ForceThirdPerson () with Papyrus, but we can't determine which camera mode is active.)
In this example, I'll Debug the value of the Condition, IsPC1stPerson:
  • I create a Scripted Magic Effect for each condition you wish to trigger.
  • I attach this Script to it:
    Spoiler
    Event OnEffectStart(Actor akTarget, Actor akCaster)    Debug.Notification ("IsPC1stPerson = True")    Debug.Trace ("IsPC1stPerson = True")EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)    Debug.Notification ("IsPC1stPerson = False")    Debug.Trace ("IsPC1stPerson = False")EndEvent
  • I create an Ability and attach that Scripted Magic Effect.
  • I Conditionalise that Magic Effect on the Ability with IsPC1stPerson.

In the game, everytime the camera mode changes between 1st and 3rd person, I see the appropriate Debug.Notification ().

I've also tested this with IsPCSleeping.
Because Events still execute on Scripts of deactivated mods (re: http://www.gamesas.com/topic/1348833-old-versions-of-mods-conflicting-with-newer-ones),
I'll be using this method to trigger sleep start and sleep stop events.

You'll need only one Ability.
But you'll need a Scripted Magic Effect for each Condition you wish to keep track of.

Also, I can imagine that not ALL conditions would work.
But I can also guess that a lot of them would.

EDIT:
You'll need to give this Ability to the Player, by the way.
And to do this the safest way is to create a Quest, add the Player as an Alias, and add the Ablity as an Alias Spell.
User avatar
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Tue Jun 19, 2012 9:55 pm

Could you give another example, like with "isBlocking" (thats the type of condition you mean right?). I don't think I fully understand, but this seems like a great find!
User avatar
His Bella
 
Posts: 3428
Joined: Wed Apr 25, 2007 5:57 am

Post » Tue Jun 19, 2012 10:21 pm

With IsBlocking, I do everything in my example but Conditionalise the Magic Effect on the Ability to be active with IsBlocking.

So in the Spell UI:
  • I make it an Ablity.
  • I add the Scripted Magic Effect to it.
  • In the Effect Item Conditions, I set it it to IsBlocking == 1

Oh by the way, you need to attach the Ability to the Player.
So you'll need to create a Quest, add the Player as an Alias, then create the Ability spell as a Spell Alias.

What happens is that the Ability spell is always active.
But the Magic Effect it is attached to (in this example the Scripted Magic Effect) comes in and goes out of effect depending on its Conditions.
User avatar
how solid
 
Posts: 3434
Joined: Mon Apr 23, 2007 5:27 am

Post » Tue Jun 19, 2012 1:42 pm

I added this to the Wiki's Discussion page: http://www.creationkit.com/Category_talk:Conditions
User avatar
Mr. Ray
 
Posts: 3459
Joined: Sun Jul 29, 2007 8:08 am

Post » Tue Jun 19, 2012 7:26 pm

Thanks for adding that to the wiki, kuertee. As I mentioned on that same talk page, this information could do more good if it were accessible from the [http://www.creationkit.com/Category:Solutions. You could do this by putting it an entirely new page and making it a member of that category by adding this to the page's content:
[[Category:Solutions]]

Cipscis
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Tue Jun 19, 2012 6:02 pm

I have been doing something like this in my combat mod to check for blocking and attacking and such. But there is an issue with this as well.

For example, I have been working on a ducking feature for days now that uses a condition to check when you are "crouching" (when you have put your actor in to sneak) to tell the game you have ducked under an attack. And to therefor play the slow motion magic effect.

However, it can take up to a full second after you crouch before the slow motions effect triggers that tells the player the actor is in a state that cannot be hit.

This sluggish behavior is going to kill a lot of how the my game mechanics SHOULD be (as I did them in my Oblivion design).

Any feature now in any mod that requires precise timing will be almost impossible to get it to work reliably. For many mods like a house mod or a armor mod or even Thirst or hunger"needs" mods that is not big deal, but for combat that is a massive problem.

It means there will be some things from my oblivion mod that I will never be able to do in skyrim.
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Tue Jun 19, 2012 8:22 pm

Will do, Cipscis.

And Duke, yeah. I can see how the timing works in Skyrim will affect combat mods.
However, I would have thought that Magic Effects that's been set-up like this would almost be instantaenous.
Where is the delay at?
Is it at the Condition? (i.e. Does it a second to detect when you Crouch?)
Or is it at the trigger of the slow motion effect? (i.e. After dection of Crouch, does it take a second for the slow motion to effect to start?)

I've been using Utility.GetCurrentRealTime () at the start and ends of points in my code to time them.
E.g.:
Float timeStart = Utility.GetCurrentRealTime ();...stuff happens here...Float timeElapsed = Utility.GetCurrentRealTime () - timeStartDebug.Trace ("timeElapsed " + timeElapsed)
User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Tue Jun 19, 2012 7:20 pm

a very good tip, thanks for sharing ;)
User avatar
Wanda Maximoff
 
Posts: 3493
Joined: Mon Jun 12, 2006 7:05 am


Return to V - Skyrim