Jump to content
  1. DOWNLOAD MODS

    Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

    LEARN MODDING

    Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

    JOIN THE ALLIANCE

    Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Sign in to follow this  
NotThatOneGuy

[SKY] Location Keywords not identifiable in CK script TESV:SSE

Recommended Posts

I have an ability on the player with a magic effect that does nothing except carry a script. The script is intended to detect when a location change occurs (vanilla detects this without registering for any events), then determine a bit about what location was entered based on the keywords attached. I'd like my mod to execute commands only if it is a city/town that I'm entering.

The script looks like:

Scriptname checkLoc Extends ActiveMagicEffect

Keyword Property LocTypeTown Auto
Keyword Property LocTypeCity Auto
Keyword Property LocTypeHabitationHasInn Auto
Keyword Property LocTypeDwelling Auto

Event OnLocationChange(Location akOldLoc, Location akNewLoc)
	Utility.Wait(1)
	If akNewLoc.HasKeyword(LocTypeTown)
		Debug.MessageBox("Town entered")
	ElseIf akNewLoc.HasKeyword(LocTypeCity)
		Debug.MessageBox("City entered")
	ElseIf akNewLoc.HasKeyword(LocTypeHabitationHasInn)
		Debug.MessageBox("Habitation with Inn entered")
	ElseIf akNewLoc.HasKeyword(LocTypeDwelling)
		Debug.MessageBox("Dwelling entered")
	Else
		Debug.MessageBox("New Loc "+ akNewLoc+ " does not fit any keywords")
	EndIf
EndEvent

All properties have been fitted inside the CK where the script is attached to the magic effect. The Utility.Wait(1) was just thrown in there to see if the game needed a little time to get its facts straight (it didn't help).

Testing this on the WhiterunLocation (Form ID: 00018A56), it gives me the last messagebox that says nothing fits (When actually LocTypeCity and LocTypeHabitationHasInn both apply). I also ran to Riverwood to see if it'd identify the town, but it also said nothing fits. Even going in houses/interiors that should be dwellings also say nothing fits.

Is there a special way to detect keywords on locations or does HasKeyword not work on locations? Maybe there is another, easier, way to detect whether we've just entered a town or city?  I also tried referencing the PlayerRef property, fitting the PlayerRef property in CK, and calling PlayerRef.GetCurrentLocation() to test for the keywords, but that failed to even call a location. It always returned "None".

Its odd, because the HasKeyword CK webpage includes an example that detects the keyword on a location:

https://www.creationkit.com/index.php?title=HasKeyword_-_Form

Any help would be appreciated. I'm stumped.

Edited by NotThatOneGuy
Clarifying expected script output

Share this post


Link to post
Share on other sites

After checking SSEEdit for any overwriting to the keywords (I was testing it with other mods installed), I found that nothing was affecting the location keywords. However, when I started a new game, despiting changing absolutely nothing, it curiously started working.

I know some mods require a new save or updated cell in order to work. Any idea if that is what happened here, or should I just chalk it up as a quirk of Bethesda games?

Either way its good that its now working, but if there's something to learn from its initial failure, that'd be helpful for the future. I suppose I could suck it up and uninstall all my mods before testing a new mod also.

Edit: After some testing, it seems that new games with the mod, new games without the mod, and previous saves that have never seen the mod before all work correctly when the mod is activated. The only saves that don't are saves that used the mod in a previous version. I'm thinking something about the previous versions of the script are left behind as I update it and cause it to not operate with updates I give the script. I'm not sure if this happens with all script updates or just keyword related ones, but apparently I'll need to watch out for old scripts not operating on their updated versions from now on.

Edited by NotThatOneGuy
Update

Share this post


Link to post
Share on other sites
On 1/20/2018 at 8:01 PM, NotThatOneGuy said:

Edit: After some testing, it seems that new games with the mod, new games without the mod, and previous saves that have never seen the mod before all work correctly when the mod is activated. The only saves that don't are saves that used the mod in a previous version. I'm thinking something about the previous versions of the script are left behind as I update it and cause it to not operate with updates I give the script. I'm not sure if this happens with all script updates or just keyword related ones, but apparently I'll need to watch out for old scripts not operating on their updated versions from now on.

This is one the key tenets of modding especially anything regarding scripts and/or quests, that you absolutely must use a completely clean save i.e. one that has never seen your mod before in any previous incarnations or you will get this occurring.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×