Jump to content

I know Oblivion Scripting But Not Skyrim Scripting


LegoManIAm94

Recommended Posts

Try these...

It was easier to correct than try to explain. Ask specific questions about a change if you don't understand what it is doing.

 

 

Scriptname WEATHERCONTROLQSCRIPT extends Quest
 
GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimClear Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
 
Event OnReset()
   if WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()
      if WEATHERVAR.GetValueInt() == 1
         if PlayerRef.GetWorldSpace() == MarkarthWorld
            SkyrimClear.SetActive()
         else
            SkyrimClear.SetActive()
         endif
      endif
   else
      if WEATHERVAR.GetValueInt() == 1
         if Weather.GetCurrentWeather() == 0
            if PlayerRef.GetWorldSpace() == MarkarthWorld
               SkyrimClear.ForceActive()
            else
               SkyrimClear.SetActive()
            endif
         endif
      endif
   endif
endevent
 

 

 

Scriptname WEATHERCONTROLSCRIPT extends ObjectReference
 
GlobalVariable Property WEATHERVAR auto
Message Property WEATHERMENU Auto
Message Property WEATHERMENUChanging Auto
 
Event OnEquipped(Actor akActor)
   If (akActor == Game.GetPlayer())
      if Weather.GetCurrentWeatherTransition() < 1.0
         WEATHERCHANGING()
      elseif Weather.GetCurrentWeatherTransition() == 1.0
         WEATHEROPTIONS()
      Endif
   Endif
EndEvent
 
Function WEATHERCHANGING()
   int ibutton = WEATHERMENUChanging.Show()
   If iButton == 0
      GotoState(WEATHEROPTIONS)
   Endif
EndFunction
 
Function WEATHEROPTIONS()
   int ibutton = WEATHERMENU.Show()
      If iButton == 0
         WEATHERVAR.SetValue(1)
      ElseIf iButton == 1
         WEATHERVAR.SetValue(2)
      ElseIf iButton == 2
         WEATHERVAR.SetValue(3)
      ElseIf iButton == 3
         WEATHERVAR.SetValue(4)
      ElseIf iButton == 4
         WEATHERVAR.SetValue(5)
      ElseIf iButton == 5
         WEATHERVAR.SetValue(6)
      ElseIf iButton == 6
         WEATHERVAR.SetValue(0)
      Endif
EndFunction

I'm fairly certain about the top one but I'll leave room for error on the second one.

 

The first script compiled but the second one only had one error

 

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\WEATHERCONTROLQSCRIPT.psc(20,40): cannot compare a weather to a int (cast missing or types unrelated)

Link to comment
Share on other sites

 

 

if Weather.GetCurrentWeather() == 0

That is the problem line. The first part returns a weather and you are trying to compare it to an integer. I missed it, but mainly because I've not worked with weather before. :P

 

Something to try

Scriptname WEATHERCONTROLQSCRIPT extends Quest
 
GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimClear Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
Weather Property WeatherToClear Auto 

Event OnReset()
   if WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()
      if WEATHERVAR.GetValueInt() == 1
         if PlayerRef.GetWorldSpace() == MarkarthWorld
            SkyrimClear.SetActive()
         else
            SkyrimClear.SetActive()
         endif
      endif
   else
      if WEATHERVAR.GetValueInt() == 1
         Weather SomeWeather = Weather.GetCurrentWeather
         Debug.Notification("Current Weather: " +SomeWeather)
         if Weather.GetCurrentWeather() == WeatherToClear
            if PlayerRef.GetWorldSpace() == MarkarthWorld
              SkyrimClear.ForceActive()
            else
               SkyrimClear.SetActive()
            endif
         endif
      endif
   endif
endevent

I added a weather property which you can fill with the type of weather you want replaced with your SkyrimClear. Not sure if that is what you want, but comparisons have to be of the same type. The other thing you could do is simply compare the current weather against your SkyrimClear weather with a negative check ( != ). That might be the easiest but may clear some weather that you do not want.

Link to comment
Share on other sites

I don't understand why you are calling "SkyrimClear.SetActive()" twice here:

 

         if PlayerRef.GetWorldSpace() == MarkarthWorld
            SkyrimClear.SetActive()
         else
            SkyrimClear.SetActive()
         endif

It's pretty pointless. I assume the first "SetActive()" is meant to be "ForceActive()"??? In which case, two of the code blocks become identical, so they can be condensed into one code block:

 

 

 

Scriptname WEATHERCONTROLQSCRIPT extends Quest

GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimClear auto
Actor Property PlayerREF auto
WorldSpace Property MarkarthWorld auto

Event OnReset()
	if ((WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()) && (WEATHERVAR.GetvalueInt() == 1)) || ((WEATHERVAR.GetValueInt() == 1) && (Weather.GetCurrentWeather().GetClassification() == 0))
		if PlayerREF.GetWorldSpace() == MarkarthWorld
			SkyrimClear.ForceActive()
		else
			SkyrimClear.SetActive()
		endif
	endif
endevent

 

 

Second script:

 

 

 

Scriptname WEATHERCONTROLSCRIPT extends ObjectReference

GlobalVariable Property WEATHERVAR auto
Message Property WEATHERMENU Auto
Message Property WEATHERMENUChanging Auto

Event OnEquipped(Actor akActor)
	If akActor == Game.GetPlayer()
		if Weather.GetCurrentWeatherTransition() == 1.0
			GotoState("WEATHEROPTIONS")
		else
			GotoState("WEATHERCHANGING")
		Endif
	Endif
EndEvent

STATE WEATHERCHANGING
Event OnBeginState()
	int ibutton = WEATHERMENUChanging.Show()
	If iButton == 0
		GotoState("WEATHEROPTIONS")
	Endif
EndEvent
ENDSTATE

STATE WEATHEROPTIONS
Event OnBeginState()
	int ibutton = WEATHERMENU.Show()
	If iButton == 0
		WEATHERVAR.SetValueInt(1)
	ElseIf iButton == 1
		WEATHERVAR.SetValueInt(2)
	ElseIf iButton == 2
		WEATHERVAR.SetValueInt(3)
	ElseIf iButton == 3
		WEATHERVAR.SetValueInt(4)
	ElseIf iButton == 4
		WEATHERVAR.SetValueInt(5)
	ElseIf iButton == 5
		WEATHERVAR.SetValueInt(6)
	ElseIf iButton == 6
		WEATHERVAR.SetValueInt(0)
	Endif
EndEvent
ENDSTATE

 

Edited by steve40
Link to comment
Share on other sites

 

Scriptname WEATHERCONTROLQSCRIPT extends Quest

GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimStormRain Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
WorldSpace Property WhiterunWorld Auto

Event OnReset()
if WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()
if WEATHERVAR.GetValueInt() == 1
if PlayerRef.GetWorldSpace() == MarkarthWorld
SkyrimStormRain.SetActive()
elseif PlayerRef.GetWorldSpace() == WhiterunWorld
SkyrimStormRain.SetActive()
endif
endif
else
if WEATHERVAR.GetValueInt() == 1
Weather.GetCurrentWeather().GetClassification() == 0
if Weather.GetCurrentWeather() == SkyrimStormRain == 0
if PlayerRef.GetWorldSpace() == MarkarthWorld
SkyrimStormRain.ForceActive()
elseif PlayerRef.GetWorldSpace() == WhiterunWorld
SkyrimStormRain.ForceActive()
endif
endif
endif
endif
endevent

 

 

I added the changes that you posted above and made a few edits and it does compile but the script wont seem to work in game. The quest is start game enabled and will run more than once. The quest script is supposed to detect if WeatherNewVar ever does not equal WeatherVar and if so the weather will change by setactive. Also it detects if your in a certain worldspace and if the weather it not equal to clear or rain it will force it to be clear or rain. The other script that is Object based it was a piece of armor that you equip and when you do the message menu should appear and you select a button and it set the WeatherVar to 1, 2. etc.

Link to comment
Share on other sites

Scriptname WEATHERCONTROLQSCRIPT extends Quest

GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimStormRain Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
WorldSpace Property WhiterunWorld Auto

Event OnReset()
WorldSpace mySpace = PlayerRef.GetWorldSpace()
if (WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()) && (WEATHERVAR.GetValueInt() == 1)
if (mySpace == MarkarthWorld || mySpace == WhiterunWorld)
SkyrimStormRain.SetActive()
endif
elseIf (WEATHERVAR.GetValueInt() == 1) && (Weather.GetCurrentWeather().GetClassification() == 0)
if (mySpace == MarkarthWorld || mySpace == WhiterunWorld)
SkyrimStormRain.ForceActive()
endif
endif
endevent
EDIT: this was wrong syntax: "if Weather.GetCurrentWeather() == SkyrimStormRain == 0", but it also doesn't make sense to check for this type of weather when you are also checking it the weather is fine (GetClassification() == 0). Edited by steve40
Link to comment
Share on other sites

Scriptname WEATHERCONTROLQSCRIPT extends Quest

GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimStormRain Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
WorldSpace Property WhiterunWorld Auto

Event OnReset()
	WorldSpace mySpace = PlayerRef.GetWorldSpace()
	if (WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()) && (WEATHERVAR.GetValueInt() == 1)
		if (mySpace == MarkarthWorld || mySpace == WhiterunWorld)
			SkyrimStormRain.SetActive()
		endif
	elseIf (WEATHERVAR.GetValueInt() == 1) && (Weather.GetCurrentWeather().GetClassification() == 0)
		if (mySpace == MarkarthWorld || mySpace == WhiterunWorld)
			SkyrimStormRain.ForceActive()
		endif
	endif
endevent
EDIT: this was wrong syntax: "if Weather.GetCurrentWeather() == SkyrimStormRain == 0", but it also doesn't make sense to check for this type of weather when you are also checking it the weather is fine (GetClassification() == 0).

 

So GetClassification is a simplier version of checking the weather but GetCurrentWeather actually checks the exact weather ID. I want to check the exact weather ID. In Oblivion I would use "if ( GetIsCurrentWeather thunderstorm == 0 )" but in skyrim I don't know what to type in the script.

Edited by LegoManIAm94
Link to comment
Share on other sites

If (Weather.GetCurrentWeather() == SkyrimStormRain)

 

for a positive test

 

or

 

If (Weather.GetCurrentWeather() != SkyrimStormRain)

 

for a negative test

Edited by steve40
Link to comment
Share on other sites

  • 2 weeks later...

I been working on it for awhile. Took a break and I still cant get it to work. Here is what I have so far. Plugin and scripts.

 

Scriptname WEATHERCONTROLSCRIPT extends ObjectReference
GlobalVariable Property WEATHERVAR auto
Message Property WEATHERMENU Auto
Message Property WEATHERMENUChanging Auto
Event OnEquipped(Actor akActor)
If (akActor == Game.GetPlayer())
if Weather.GetCurrentWeatherTransition() < 1.0
WEATHERCHANGING()
elseif Weather.GetCurrentWeatherTransition() == 1.0
WEATHEROPTIONS()
Endif
Endif
EndEvent
Function WEATHERCHANGING()
int ibutton = WEATHERMENUChanging.Show()
If iButton == 0
WEATHEROPTIONS()
Endif
EndFunction
Function WEATHEROPTIONS()
int ibutton = WEATHERMENU.Show()
If iButton == 0
WEATHERVAR.SetValue(1)
ElseIf iButton == 1
WEATHERVAR.SetValue(0)
Endif
EndFunction

Scriptname WEATHERCONTROLQSCRIPT extends Quest
GlobalVariable Property WEATHERVAR auto
GlobalVariable Property WEATHERVARNEW auto
Weather Property SkyrimStormRain Auto
Weather Property SkyrimStormSnow Auto
Actor Property PlayerRef Auto
WorldSpace Property MarkarthWorld Auto
WorldSpace Property WindhelmWorld Auto
Event OnReset()
if WEATHERVAR.Getvalue() != WEATHERVARNEW.Getvalue()
WEATHERVARNEW == WEATHERVAR
if WEATHERVAR.GetValueInt() == 1
if PlayerRef.GetWorldSpace() == MarkarthWorld
SkyrimStormRain.SetActive()
elseif PlayerRef.GetWorldSpace() == WindhelmWorld
SkyrimStormSnow.SetActive()
endif
endif
else
if WEATHERVAR.GetValueInt() == 1
if (Weather.GetCurrentWeather() == SkyrimStormRain)
if PlayerRef.GetWorldSpace() == WindhelmWorld
SkyrimStormRain.ForceActive()
endif
elseif (Weather.GetCurrentWeather() == SkyrimStormSnow)
if PlayerRef.GetWorldSpace() == MarkarthWorld
SkyrimStormSnow.ForceActive()
endif
endif
endif
endif
endevent

 

Edited by LegoManIAm94
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...