Finishing up this Script: What are the final touches I'm mis

Post » Sun Jun 17, 2012 2:06 pm

float DaysPassed = GameDaysPassed.GetValue()cohGetMoonPhase = (( DaysPassed + ( TimeOfDay / 24 ) - 0.5 ) % 24 )cohPhaseDay = cohGetMoonPhase / 3

A full moon is once every 30 days right ?!? So why not just do it like:

int property cohPhaseDay autoint DaysPassed = GameDaysPassed.GetValueInt()if ( DaysPassed % 30 == 0 )  cohPhaseDay = 0else  cohPhaseDay = 1endif
User avatar
brenden casey
 
Posts: 3400
Joined: Mon Sep 17, 2007 9:58 pm

Post » Sun Jun 17, 2012 2:27 pm

That's...actually really good, though I'm hopin to add an element of chance to nights on which the moon is nearly full.
User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am

Post » Mon Jun 18, 2012 1:20 am

Actually, full moons happen for three days of a 24 day cycle.
User avatar
Becky Palmer
 
Posts: 3387
Joined: Wed Oct 04, 2006 4:43 am

Post » Sun Jun 17, 2012 8:58 pm

Actually, full moons happen for three days of a 24 day cycle.

does that work the same in game ?
GameDaysPassed << what number do you get here ?
Does it start from the day you ride the carriage in the intro ?
Does the date of the intro stay static for every new game like 16th of Month Year ??
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Sun Jun 17, 2012 10:13 pm

Time to go test it then, though I've still got to get the werewolf transformation done.
User avatar
Becky Palmer
 
Posts: 3387
Joined: Wed Oct 04, 2006 4:43 am

Post » Mon Jun 18, 2012 4:42 am

That's...actually really good, though I'm hopin to add an element of chance to nights on which the moon is nearly full.
then couldn't you also add like...

if ( DaysPassed % 30 == 1 ) or if ( DaysPassed % 30 == 29 ) etc.

On a related note, does Papyrus have a select case syntax?
User avatar
Monique Cameron
 
Posts: 3430
Joined: Fri Jun 23, 2006 6:30 am

Post » Mon Jun 18, 2012 4:13 am

then couldn't you also add like...

if ( DaysPassed % 30 == 1 ) or if ( DaysPassed % 30 == 29 ) etc.

On a related note, does Papyrus have a select case syntax?

it would be better to make a random generated int randomDayTransformation range from 0 to 2

if ( DaysPassed % 24 <= randomDayTransformation ) || ( DaysPassed % 24 > 23-randomDayTransformation ) etc.
User avatar
Donald Richards
 
Posts: 3378
Joined: Sat Jun 30, 2007 3:59 am

Post » Sun Jun 17, 2012 10:12 pm

Hmm...I have no idea why this isn't working. As I understand it, that script I wrote should cast beast form on a werewolf PC every night between the hours of 8 PM and 6 AM, and the transformation should last until 6 AM, at which point the beastformtimer variable should drop to one, causing the transformation to end...

Is it possible that the script isn't even running? If so, how would I get it to "run"?
User avatar
benjamin corsini
 
Posts: 3411
Joined: Tue Jul 31, 2007 11:32 pm

Post » Mon Jun 18, 2012 12:52 am

Hmm...I have no idea why this isn't working. As I understand it, that script I wrote should cast beast form on a werewolf PC every night between the hours of 8 PM and 6 AM, and the transformation should last until 6 AM, at which point the beastformtimer variable should drop to one, causing the transformation to end...

Is it possible that the script isn't even running? If so, how would I get it to "run"?

Can you post the whole new code here.
User avatar
Katharine Newton
 
Posts: 3318
Joined: Tue Jun 13, 2006 12:33 pm

Post » Sun Jun 17, 2012 7:59 pm

Here. I just made a minute change, specifically using GameHour for the global variable instead of what I was using before, I haven't tested it yet, though I'm not all that confident.

scriptname cohTransformTiming extends Quest{Controls the Timing for transformation.};calling properties, spells, globals, and importing the maths.        import Math    float property cohGetMoonPhase auto    float property cohPhaseDay auto    bool property cohCanTransform auto    bool property cohbmvar auto    bool property NotFirstChange auto    Spell property WerewolfChangeEffect auto    GlobalVariable Property GameHour auto    GlobalVariable Property GameDaysPassed auto    GlobalVariable Property PlayerIsWerewolf auto    GlobalVariable Property PlayerWerewolfShiftbacktime auto    MagicEffect Property Werewolf auto    ; The script should run once every in game minute in this state, otherwise the flavor texts could be desychronized.Event OnUpdateGameTime(); Determining Moon Phase Below...Not yet implimented.    int timeOfDay = GameHour.GetValueint()    int DaysPassed = GameDaysPassed.GetValueint()    cohGetMoonPhase = 0; Ignore PhaseDay, not functioning in this iteration of the script.;/List of moon phases returned by cohGetMoonPhase.0 = full moon1 = 3/4 waning2 = half waning3 = 1/4 waning4 = new moon5 = 1/4 waxing6 = half waxing7 = 3/4 waxing/;;Not sure what cohPhaseDay should return, though one is an adequete placeholder.    If TimeOfDay >= 20 || TimeOfDay < 6    cohCanTransform == true    elseif TimeOfDay < 20 || TimeOfDay >= 6    cohCanTransform == falseendif; Hell, it's morphing time!            if ( PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true ) && NotFirstChange == true && game.getplayer().HasMagicEffect(Werewolf) == 0    PlayerWerewolfShiftbacktime.SetValue(10000)    WerewolfChangeEffect.Cast(Game.GetPlayer(), Game.GetPlayer())    Utility.WaitGameTime ( 0.05 )    Debug.Notification ("Generic Flavor Text")        elseif PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true && NotFirstChange == false && game.getplayer().HasMagicEffect(Werewolf) == 0    PlayerWerewolfShiftbacktime.SetValue(10000)    WerewolfChangeEffect.Cast(Game.GetPlayer(), Game.GetPlayer())    Utility.WaitGameTime ( 0.05 )    Debug.MessageBox ("First Post Transform Flavor Text")    elseif PlayerIsWerewolf.GetValue() == 1 && game.getplayer().HasMagicEffect(Werewolf) == 1 && cohCanTransform == false    PlayerWerewolfShiftbacktime.SetValue(1)endifEndEvent
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Sun Jun 17, 2012 5:20 pm

Btw, I'm starting to think I haven't activated the script correctly; I made a papyrus fragment targeting the script that consists of

RegisterForUpdateGameTime(1.0)
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Sun Jun 17, 2012 1:09 pm

This will be cleaner that your previous code. If it is not night time you can not transform.

If TimeOfDay > 20 || TimeOfDay < 6	cohCanTransform == trueelse	cohCanTransform == falseendif

Furthemore boolen in psc scripts is by default FALSE so your code below wont work as intended

if ( PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true ) && NotFirstChange == true && game.getplayer().HasMagicEffect(Werewolf) == 0

Change the variable NotFirstChange to isFirstChange then

if ( PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true ) && isFirstChange == false && game.getplayer().HasMagicEffect(Werewolf) == 0

http://www.creationkit.com/OnUpdate_-_Form
http://www.creationkit.com/OnUpdateGameTime_-_Form
User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Sun Jun 17, 2012 5:40 pm

Ah thank. Regarding the boolean, I think I actually put the flavor texts in the right order, but for some reason switched around the true false logic in my mind...

Should I put a while loop in the code? I didn't tick run once on the quest menus though, so I don't see how that would be a problem.

btw, why make it > instead of >= , maybe its just me being neurotic, but I prefer werewolves to change at 8 PM sharp and any times beyond that point rather than 8:01 PM and any times beyond that point...
User avatar
Alkira rose Nankivell
 
Posts: 3417
Joined: Tue Feb 27, 2007 10:56 pm

Post » Sun Jun 17, 2012 10:26 pm

I guess you need a quest triger or a function to start the update first. From the wiki:

Function SomeFunction()					    RegisterForUpdateGameTime(0.5) ; Before we can use onUpdateGameTime() we must register.endFunction

btw, why make it > instead of >= , maybe its just me being neurotic, but I prefer werewolves to change at 8 PM sharp and any times beyond that point rather than 8:01 PM and any times beyond that point...

Wanted to leave an hour time so it gets dark :biggrin: TimeOfDay is int so the game dosnt recognize if its 8:00 or 8:01 for a > it needs to be 9:00 or more for it too run :smile: So if you like 8 pm sharp then >= is ok

Should I put a while loop in the code? I didn't tick run once on the quest menus though, so I don't see how that would be a problem.

The OnUpdateGameTime is already like a loop as long as the quest script is running but we dont have the script running a quest in the first place so that might be the reason it dosnt work.


Notes
Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
This event is not relayed to any aliases or magic effects attached to the form.
OnUpdateGameTime may come in much later then you expect if the player is sleeping, waiting, fast traveling, or serving jail time. The event will only be sent once, after the sleep/wait/travel/serve period is over, so you should be prepared to handle hours passing between updates.
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Mon Jun 18, 2012 2:57 am

I'm under the impression that the moon comes out around 8 in Skyrim, though I'd have to check. Regarding the quest trigger, I put that in a papyrus fragment associated with the quest this script is attached to, a Bethesda employee recommended I do that.

PS, I switched it over to OnUpdate instead of game time, since I'm hoping to interrupt waiting and sleeping at some point, there has to be some way to do that.
User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm

Post » Mon Jun 18, 2012 4:01 am

Well it might be an idea to put
RegisterForUpdateGameTime(0.1)
in the if clause when the warewolf transformation ends and a close Register when player changes into a warewolf
UnregisterForUpdateGameTime()
Then you only need the
RegisterForSingleUpdateGameTime(0.1)
in your quest trigger.
User avatar
Bryanna Vacchiano
 
Posts: 3425
Joined: Wed Jan 31, 2007 9:54 pm

Post » Sun Jun 17, 2012 11:16 pm

Uhhhhhhhh...

Okay, does this go in the script or the papyrus fragment, and where would I put these updates? According to the Beth guy, there's no reason to register an event for update within the event itself; it doesn't work because it needs to be triggered to start.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Sun Jun 17, 2012 7:29 pm

Uhhhhhhhh...

Okay, does this go in the script or the papyrus fragment, and where would I put these updates? According to the Beth guy, there's no reason to register an event for update within the event itself; it doesn't work because it needs to be triggered to start.

Well you need one registerForUpdate in the quest trigger like a quest to become a werewolf. Then it would be a good practice to unregister when you transform into a warewolf and register for a periodic update when your back to human form.
Nevermind, yeah no need for it in the event body itself.

Some code correction

if  PlayerIsWerewolf.GetValue() == 1 && cohCanTransform == true && game.getplayer().HasMagicEffect(Werewolf) == 0  PlayerWerewolfShiftbacktime.SetValue(10000)  WerewolfChangeEffect.Cast(Game.GetPlayer(), Game.GetPlayer())  Utility.WaitGameTime ( 0.05 )  Debug.Notification ("Generic Flavor Text")else  PlayerWerewolfShiftbacktime.SetValue(1)  game.getplayer().DispelSpell(WerewolfChangeEffect)endif
User avatar
Tamika Jett
 
Posts: 3301
Joined: Wed Jun 06, 2007 3:44 am

Post » Sun Jun 17, 2012 7:38 pm

Actually, I heard that you can create an onupdate loop within the body of an event if said event is externally triggered by doing the folowing...



Function StartChain()  RegisterForSingleUpdate(1) ; Give us a single update in one secondendFunction Event OnUpdate()  bool bkeepUpdating = true  ; Do stuff here, and update the bkeepUpdating variable depending on whether you want another update or not  if bkeepUpdating    RegisterForSingleUpdate(1)  endIfendEvent

Should the triggering script fragment be Single Update or multiple updates?

User avatar
neil slattery
 
Posts: 3358
Joined: Wed May 16, 2007 4:57 am

Post » Sun Jun 17, 2012 7:22 pm

Actually, I heard that you can create an onupdate loop within the body of an event if said event is externally triggered by doing the folowing...



Function StartChain()  RegisterForSingleUpdate(1) ; Give us a single update in one secondendFunctionEvent OnUpdate()  bool bkeepUpdating = true  ; Do stuff here, and update the bkeepUpdating variable depending on whether you want another update or not  if bkeepUpdating	RegisterForSingleUpdate(1)  endIfendEvent

Should the triggering script fragment be Single Update or multiple updates?


You should use RegisterForUpdate(60) in the trigger or else it will run only once and stop.
User avatar
Trey Johnson
 
Posts: 3295
Joined: Thu Oct 11, 2007 7:00 pm

Post » Sun Jun 17, 2012 5:33 pm

Just tried that. As typical, it didn't work =(.

This is so frustrating, absolutely nothing I'm doing works, either the script isn't being run, somethings wrong that the compiler didn't pick up on, or the scripts not looping like it should...
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Sun Jun 17, 2012 4:45 pm

Just tried that. As typical, it didn't work =(.

This is so frustrating, absolutely nothing I'm doing works, either the script isn't being run, somethings wrong that the compiler didn't pick up on, or the scripts not looping like it should...

http://www.creationkit.com/Trace_-_Debug

try using debug options in your code in different stages, in the script and in the trigger itself.
Debug.Trace("")

Place one before the OnUpdate event and one after it. This way you will know if the script executed and if the event triggered too.
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am

Post » Mon Jun 18, 2012 1:21 am

Ah...Great idea!

Where does it dump the debug stuff by the way?
User avatar
Anna S
 
Posts: 3408
Joined: Thu Apr 19, 2007 2:13 am

Post » Sun Jun 17, 2012 7:15 pm

In the debug log and in the debuger window itself.
You can use debug.notifications too so you see a notification in game.
User avatar
Adam Baumgartner
 
Posts: 3344
Joined: Wed May 30, 2007 12:12 pm

Post » Mon Jun 18, 2012 4:41 am

come to think of it, there is a notification that should pop when the werewolf transformation occurs. Obviously its not even getting there for whatever reason.



Aaaand...The script isn't even initializing, unless I'm not looking in the right place for the notifications...
User avatar
Kari Depp
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:19 pm

PreviousNext

Return to V - Skyrim

cron