Jump to content

Why won't this script work?


Recommended Posts

I've put this script on a door that teleports from an interior cell to the outside world. It compiles and saves but weather isn't changed.

 

 

Actor Property PlayerREF Auto
Weather Property MyWeather Auto

Event OnOpen(ObjectReference akActionRef)
if akActionRef == PlayerRef
MyWeather.ForceActive()
endif
EndEvent

Thanks for any help.

 

Link to comment
Share on other sites

I've put this script on a door that teleports from an interior cell to the outside world. It compiles and saves but weather isn't changed.

 

 

Actor Property PlayerREF Auto

Weather Property MyWeather Auto

 

Event OnOpen(ObjectReference akActionRef)

if akActionRef == PlayerRef

MyWeather.ForceActive()

endif

EndEvent

 

Thanks for any help.

 

Motivation of this script not working might be 2

 

- The function "OnOpen" fires when the door has finshed the animation, not when you changed the cell, the weather might change but you changed it in the interior cell.

- If you know the location of the 2 cells use this function instead wich will fire when the location is actually changed https://www.creationkit.com/index.php?title=OnLocationChange_-_Actor

 

Let me know if it works

Link to comment
Share on other sites

Nope - got nothing. here's what I scripted...

 

 

Weather Property MyWeather Auto

Event OnLocationChange(Location akOldLoc, Location akNewLoc)
if (Game.GetPlayer().GetCurrentLocation() == akOldLoc)
Debug.Trace("We have left the player's location!")
MyWeather.ForceActive()

endIf
endEvent

 

Link to comment
Share on other sites

An easy way to do this is, to create a trigger box around the exterior door's teleport marker that will have a script on it that "OnCellAttach" or "OnCellLoad" will execute the fanction. Or the script could also be put in the exterior door (exterior cell).

Edited by maxarturo
Link to comment
Share on other sites

@maxarturo - Yep that works. Force or Set? If I 'Force' the weather will it change back to the world climate eventually? What's the difference between 'Force' and 'Set'?

Will this Force the weather for good?

 

 

MyWeather.ForceActive(1)

 

 

If so, how do I override it?

 

Hit a snag. Int. cell has 2 doors. 1 to 'Back Yard' an area walled off but still outside and the Main Exit door to the world in general. If player goes to the back yard to be nosey, as is expected, the script acts as it should. But then when player eventually decides to leave the house altogether, back through the house then out the main door and through another trigger box running same script, the weather doesn't always 'apply'. Going back in and out eventually gets the weather to 'conform'.

Another thing I am still baffled by is if I COC into a cell 2 cells away from The House and walk around, as expected the triggers never... triggered and script never ran. But as I approach the house, literally 1 cell away from The House's cell the weather (storm and rain) abruptly kicks in. No idea why.

Link to comment
Share on other sites

If i remember correctly, "set" is use for occasions like yours, loading a cell then the script will use the script's "set" weather ignoring the pre fixed cell's weather set up.

The "force" is used when you are already in the exterior cell with a shine weather then you enter a trigger box that will "force" the weather to change to a rainy one.


I've noticed this COC issue with OnCellAttach in the past, never realy found an answer to this, so i assumed that is a script function - game engine related problem. For things like this (for testing) i always COC to the previous cell and use the "load door" that conects the two cells, and the "OnCellAttach" will always fire.

Link to comment
Share on other sites

Nope - got nothing. here's what I scripted...

 

 

Weather Property MyWeather Auto

 

Event OnLocationChange(Location akOldLoc, Location akNewLoc)

if (Game.GetPlayer().GetCurrentLocation() == akOldLoc)

Debug.Trace("We have left the player's location!")

MyWeather.ForceActive()

 

endIf

endEvent

 

 

Did you simply blindly copy a script hoping to work?

 

Your script is the example of the function and it fires still in the old location (the debug message fired while opening the door, or after you switched the location?). Try this.

 

Event OnLocationChange(Location akOldLoc, Location akNewLoc)

if (Game.GetPlayer().GetCurrentLocation() == akNewLoc)

Debug.Trace("We entered in the new location")

MyWeather.ForceActive()

endIf

endEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

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