Quick Questions, Quick Answers Thread #6

Post » Sun Nov 18, 2012 11:05 pm

Thanks again, now I finally got a change!

I ticked the Show sky in the lighting tab and FXLightRegionCaveBlueSkylight which gives a, ehm, skylight.
User avatar
Benji
 
Posts: 3447
Joined: Tue May 15, 2007 11:58 pm

Post » Mon Nov 19, 2012 1:16 am

Hey everyone -
I'm having a problem where it seems like the changes I make in CK are not showing up in Skyrim. Especially changes on npc packages, factions, etc. anything that would change the way a npc behaves.

I know there has to be a simple solution to this, something probably really obvious that I missed :) but if anyone has tips on how to make sure that the in game cells are running the new changes, I would appreciate it.

Have a good one!
User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Sun Nov 18, 2012 5:39 pm

Is there a way to handle multiple concurrent RegisterForUpdate/OnUpdate links within the same script?

i.e. could I label one registration as "update 1" and another as "update 2" and cause different things to happen in "OnUpdate 1" and "On Update 2"?
User avatar
Andrea Pratt
 
Posts: 3396
Joined: Mon Jul 31, 2006 4:49 am

Post » Sun Nov 18, 2012 8:48 pm

Is there a way to handle multiple concurrent RegisterForUpdate/OnUpdate links within the same script?

i.e. could I label one registration as "update 1" and another as "update 2" and cause different things to happen in "OnUpdate 1" and "On Update 2"?
Do they actually need to be "concurrent"? If you want different behavior out of an event or function you use states.

Perhaps a use case would clarify things.
User avatar
Tracy Byworth
 
Posts: 3403
Joined: Sun Jul 02, 2006 10:09 pm

Post » Mon Nov 19, 2012 1:33 am

Is there a way to handle multiple concurrent RegisterForUpdate/OnUpdate links within the same script?

i.e. could I label one registration as "update 1" and another as "update 2" and cause different things to happen in "OnUpdate 1" and "On Update 2"?

Why exactly?

I mean, if you want them at different intervals, you can j ust do something like:
int i = 0Event OnUpdate()  if ( i == 4 )	;Do stuff at only 1/4 of the normal intervals  endifi++;everything elseEndevent

Or if you don't necessarily want both to happen all the time, add a boolean condition for each update you want to be happening, and set them in the function you use to register for an update. Say you want to check an actor's health sometimes, but also want to check the player's position sometimes (random ideas for the example), you could have:
bool CheckPosition = falsebool CheckHealth = falseEvent OnUpdate()  if ( CheckPosition )   ;Do stuff to check position  endif  if ( Checkhealth)   ;Do stuff to check health  endif  if ( CheckPosition || CheckHealth )   RegisterForSingleUpdate(interval)  endifEndevent

Otherwise, I am not exactly sure why you would want it?

I don't think you can have two updates for the same script though. But you could also use a while loop with utility.wait() in it, if the suggestions still don't work.
User avatar
Dona BlackHeart
 
Posts: 3405
Joined: Fri Dec 22, 2006 4:05 pm

Post » Sun Nov 18, 2012 12:08 pm

Do they actually need to be "concurrent"? If you want different behavior out of an event or function you use states.

Perhaps a use case would clarify things.

I have a spell that allows the caster to store spells for later recall. The spell allows the caster to choose a slot in which to store a spell, and I'd like each slot to have its own cooldown without affecting the behavior of the other slots.

So, the player stores a spell in slot 1 and can't re-use slot 1 until tomorrow (what happens is I set a bool to 1 and register for a gametime update at midnight, at which point I set the bool back to 0).

However, the player can then store a spell in slot 2 that same day which would call a second instance of RegisterForUpdateGametime() to handle the cooldown expiration of the second slot.

I need some way of keeping the two update registrations separate from one another.
User avatar
Rhysa Hughes
 
Posts: 3438
Joined: Thu Nov 23, 2006 3:00 pm

Post » Sun Nov 18, 2012 9:47 am

I need some way of keeping the two update registrations separate from one another.
Is it only ever two slots? Why not just have two scripts?

Otherwise, move away from using the OnUpdate() event itself to set the bool, make the update time be a smaller increment, say if the cooldowns are 18 and 24 hours you can get away with 6 hours (the GCF). Or if the issue is rather, that slot one's cooldown starts at 6AM and then 2 hours later the cooldown starts for slot 2, then just check every game hour, store their cooldown lengths, and count up how many hours have passed for each slot, and then finally during the next update where the time passed is sufficient, you can reset the counter, and enable the slot again.
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Mon Nov 19, 2012 1:08 am

If I have several different ifs in an OnHit event, is it ok to put mutliple states, or is that the wrong way to do them? For example:

Event OnHitGoToState("Busy")if.....endifGoToState("")GoToState("Busy")if....endifGoToState("")EndEvent
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Sun Nov 18, 2012 5:34 pm

So, I know this isn't a strictly Creation Kit related question, but how would I go about creating new ground and inventory models for an armour piece a finished armour piece?
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Sun Nov 18, 2012 6:17 pm

....
...
An addendum to my previous post... I made an example that is slot number and cooldown interval agnostic.
Spoiler

GlobalVariable Property GameDaysPassed AutoActor Property PlayerRef AutoSpell[] Property SpellArray Auto{ Holds spellsMake sure other arrays match by index}Int[] Property UpdateIntervalArray Auto{ Array which stores the update intervals for each slotOnly really needed if cooldown differs}Float[] Property TimeToEnableArray Auto{ Array which stores the "game hours passed" time at which to enable the Spell(Fill this with as many 0.0s as there are spell slots)0.0 would mean spell slot is currently active}Function Init()    ; Call this from something    ; Quest start up maybe?    RegisterForSingleUpdateGameTime(1)EndFunctionFunction BeginCooldown(Int NthSlot){ Call this whenever the spell gets used}    int aiIndex = NthSlot - 1    float afInterval = (UpdateIntervalArray[aiIndex] as Float) / 24.0  ; Convert to float in game days    ; Remove Spell    ; or whatever it is you need to do    PlayerRef.RemoveSpell(SpellArray[aiIndex])    TimeToEnableArray[aiIndex] = GameDaysPassed.GetValue() + afInterval  ; May need some casts here...EndFunctionbool[] Function ResetCooldowns()    float afGameDaysPassed = GameDaysPassed.GetValue()    int aiIndex = 0    bool[] returnArray = new bool[8] ; or however many slots you have    While aiIndex < SpellArray.Length        float afTimeToEnable = TimeToEnableArray[aiIndex]        If (afGameDaysPassed > afTimeToEnable) && (afTimeToEnable > 0)            ; Cooldown has expired, Reset            ; or however you enable spell slots again            PlayerRef.AddSpell(SpellArray[aiIndex], false)            ; Reset TimeToEnable for this slot            TimeToEnableArray[aiIndex] = 0            returnArray[aiIndex] = True        EndIf        aiIndex += 1    EndWhile    return returnArrayEndFunctionEvent OnUpdateGameTime()    ResetCooldowns() ; Optionally can return an array of bools indicating which slots were reset    RegisterForSingleUpdateGameTime(1)EndEvent

Hopefully it makes some sense. I didn't test this, because it's obviously not very complete, so I don't even know if it compiles without some tweaks. But it should allow your "slots" to have different cooldowns of different lengths at different times, all with just the one OnUpdateGameTime(). It's just that the update runs hourly to check. So... at most the cooldown will be an in-game hour off. If you want greater accuracy with this, you can always use an in-game half-hour, etc.
User avatar
Chantelle Walker
 
Posts: 3385
Joined: Mon Oct 16, 2006 5:56 am

Post » Sun Nov 18, 2012 12:08 pm

@ishmaeltheforsaken:
When an object is registered for updates, all of its scripts will receive updates so although you could attach different scripts to the same object to have different things happen in the OnUpdate event the interval would be the same.

According to the wiki, updates from http://www.creationkit.com/RegisterForSingleUpdate_-_Form don't get relayed to aliases, and are specific to each alias:
Only the specific form, alias, or magic effect that registered will get the event - it will not be relayed to attached aliases or magic effects.

Because of this, you could have a script that has several aliases pointing to the same object, each of which has a separate script (extending http://www.creationkit.com/ReferenceAlias_Script) attached that uses a different script using RegisterForSingleUpdate inside their http://www.creationkit.com/OnUpdate_-_Form event (and an http://www.creationkit.com/OnInit event) to do this.

That's quite a complicated setup, though, and it would probably be easier to just use a separate object, depending on what you hope to do. In my WIP version of CASM, for example, I'm currently using separate quests to check for keypresses with frequent updates and to request saves with infrequent updates instead of trying to use a more complex setup like the one I've described above.

The behaviour you want is something that I've pined for myself recently. The other day I found myself saying this in a private conversation with JustinOther:
It'd be nice if it were possible to register for different types of update. Since coming back to Papyrus I'm missing being able to use function pointers. Something like RegisterForDelayedEvent(OnUpdate, 30) would be much more useful than RegisterForSingleUpdate(30). Oh well...

Perhaps this is something SKSE will one day be able to help us with?

Cipscis
User avatar
Stephanie Valentine
 
Posts: 3281
Joined: Wed Jun 28, 2006 2:09 pm

Post » Sun Nov 18, 2012 10:07 am

Is it only ever two slots? Why not just have two scripts?

Otherwise, move away from using the OnUpdate() event itself to set the bool, make the update time be a smaller increment, say if the cooldowns are 18 and 24 hours you can get away with 6 hours (the GCF). Or if the issue is rather, that slot one's cooldown starts at 6AM and then 2 hours later the cooldown starts for slot 2, then just check every game hour, store their cooldown lengths, and count up how many hours have passed for each slot, and then finally during the next update where the time passed is sufficient, you can reset the counter, and enable the slot again.

It's currently 2 slots while I'm, you know, developing and testing, but it'll be expanded as the mod become fuller-featured.

And actually, I realized right before I feel asleep for my nap that I don't need to keep the updates separate from one another at all. There's not any trouble getting each bool to set individually, and ALL those flipped flags are going to reset at the same time (midnight).

I.e., when one RegisterForUpdateGameTime() overwrites a previous one with its new timer, it's new timer is still the same amount of time that would have been remaining on the overwritten registration.

Sorry for being a dunce and not realizing that XD Thanks everyone for your responses.
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm

Post » Sun Nov 18, 2012 12:44 pm

Oh, but, another quick question:

does Spell.Cast() send an OnSpellCast event to the actor you're casting from?
User avatar
Robyn Howlett
 
Posts: 3332
Joined: Wed Aug 23, 2006 9:01 pm

Post » Sun Nov 18, 2012 2:20 pm

Oh, but, another quick question:

does Spell.Cast() send an OnSpellCast event to the actor you're casting from?
Not explicitly stated on the wiki, I think.

But:

(from here: http://www.creationkit.com/Cast_-_Spell) "If you wish to make an actor cast a spell using all the normal spellcasting behaviors, please instead use an AI package that includes the http://www.creationkit.com/Procedure_UseMagic."

So I would try to do it the "full" way, if I were you (if you can) as Cast appears to be a fudge for Magic-Rocks and so on ;)
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Sun Nov 18, 2012 9:12 pm

Not explicitly stated on the wiki, I think.

But:

(from here: http://www.creationkit.com/Cast_-_Spell) "If you wish to make an actor cast a spell using all the normal spellcasting behaviors, please instead use an AI package that includes the http://www.creationkit.com/Procedure_UseMagic."

So I would try to do it the "full" way, if I were you (if you can) as Cast appears to be a fudge for Magic-Rocks and so on :wink:

Not an option, since the caster is the player and the point is to NOT use the spellcasting animations.
User avatar
Naomi Ward
 
Posts: 3450
Joined: Fri Jul 14, 2006 8:37 pm

Post » Sun Nov 18, 2012 10:34 am

This seems like a more appropriate place for my question. How do you make Scrimitar's upgradable w/o making it craftable?
User avatar
Bigze Stacks
 
Posts: 3309
Joined: Sun May 20, 2007 5:07 pm

Post » Sun Nov 18, 2012 1:14 pm

Well done on the Active File thing. Now all your edits and additions are going to the same place (file)

Beaware, your changes may not have been going to the right place before you knew how to do that ... So things you have already done may not be in the right place (and won't be working, even though you now made the change).

If I were you - and I know it is going to be a pain - I would start your tutorials again (you can skip bits you think you know ... it's just practice, after-all).

Make a new file and make it the active file in the ck.

It's tough to get started with this toy, and this won't be the only hurdle you fall at ... but keep at it and its loads of fun (and loads of annoyance at the same time too!) :smile:
yeah I was gonna do that right after I finished the tutorials. I just didnt want to redesign an idea if I discovered new big ideas from the last 3 videos. I cant wait to get some nice content made. even if it is just for me.
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Sun Nov 18, 2012 8:36 pm

Not an option, since the caster is the player and the point is to NOT use the spellcasting animations.

Well, as Cast does not play the animation I guess you'll have to give it a whirl and see if it does pass the event to the receiver

(I think I bet it won't, as it's a fudge which doesn't animate the caster ... but you never know with the CK)



Is there a way to use the Package route, but disable the casting-animation (by nerfing the animation selection in the Spell in the CK)?? I don't know that either, I never tried ...
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Sun Nov 18, 2012 10:05 am

Is there a method to get what arrows/quiver reference is equipped? Looked at GetWornForm but quivers don't take up slot mask.
User avatar
yessenia hermosillo
 
Posts: 3545
Joined: Sat Aug 18, 2007 1:31 pm

Post » Sun Nov 18, 2012 3:06 pm

If I have several different ifs in an OnHit event, is it ok to put mutliple states, or is that the wrong way to do them? For example:

Spoiler

Event OnHitGoToState("Busy")if.....endifGoToState("")GoToState("Busy")if....endifGoToState("")EndEvent

Anybody know? Don't want to release a broken script you see :) the if checks all work fine in-game, but does that script look ok?

Cheers guys.
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Sun Nov 18, 2012 4:27 pm

It's perfectly fine to call http://www.creationkit.com/GotoState_-_All_Scripts multiple times and for different states within the same function. The version of a function that is used is determined only be the script's current state when the function begins. Remember, too, that events are a type of function.

Generally, though, it's best to send the script into your "Busy" state at the start of your function, and return it to the default state at the end, instead of sending it back and forth multiple times. In this case, it seems you may as well remove the middle 2 calls to GoToState, unless for some reason you need to trigger the http://www.creationkit.com/OnBeginState and/or [src="http://www.creationkit.com/OnEndState%5B/url%5D events at that time.

Also, calling GoToState and passing an empty string, like you've done, is an effective way of returning your script to the "empty state", which is used as a default if none of the script's states are set as the script's "auto" state.

Cipscis
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Sun Nov 18, 2012 12:40 pm

Anyone know a way to stop a bard from taking requests for a while?

I'm trying to write a romance scene with a bard as the object of the player's affections, and having her take requests is a bit of a mood breaker.

I wouldn't mind the player asking her to sing, but I'd prefer to control the timing a little better. And I'd prefer not to add an entry in the BardSongs dialogue tree, if only because the relationship is a bit complicated and I don't want to be that intrusive with a vanilla asset.

[edit]

Saw the answer immediately after I posted: BardNoRequestFaction. Leaving the post here in case it helps someone else.
User avatar
Ana Torrecilla Cabeza
 
Posts: 3427
Joined: Wed Jun 28, 2006 6:15 pm

Post » Sun Nov 18, 2012 4:09 pm

Each if statement is just another set of conditions for weapon types, so I'll stick the states at the beginning and end of the OnHit event :) thanks mate.
User avatar
Katie Samuel
 
Posts: 3384
Joined: Tue Oct 10, 2006 5:20 am

Post » Sun Nov 18, 2012 8:47 pm

With OnHit you can check what weapon type the source is etc. how can you check what spell type it is? Like a fire spell, or destruction school spell?

Cheers :)
User avatar
Kelli Wolfe
 
Posts: 3440
Joined: Thu Aug 23, 2007 7:09 am

Post » Sun Nov 18, 2012 10:49 pm

Spells generally have keywords associated with them that determine things like whether or not they should be considered a fire spell. For school, there's the http://www.creationkit.com/GetAssociatedSkill_-_MagicEffect (I expect you'll also need SKSE's http://www.creationkit.com/GetNumEffects and http://www.creationkit.com/GetNthEffectMagicEffect).

Cipscis
User avatar
D IV
 
Posts: 3406
Joined: Fri Nov 24, 2006 1:32 am

PreviousNext

Return to V - Skyrim