Thanks a lot for the hard work on this! It has been immensely useful.
I am having an issue with the StarMapMenu_ExecuteRoute event. My assumption has been that this fires when the player has selected a destination and holds down "X" to make the jump. Am I misunderstanding when this fires?
It seems that the handler registration is succeeding, but I'm not seeing the event fire. I'm also using the "OnPlayerPlotRoute" event, and that one works fine.
Function DoLoadGame() LogDebug("DoLoadGame")
; Native events from CassiopeiaPapyrusExtender need to be registered on every load. If !RegisterForNativeEvent("MyScript", "OnPlayerPlotRoute", None) LogDebug("Failed to register for OnPlayerPlotRoute") ElseIf !RegisterForNativeEvent("MyScript", "StarMapMenu_ExecuteRoute", None) LogDebug("Failed to register for StarMapMenu_ExecuteRoute") Else LogDebug("Registered for OnPlayerPlotRoute and StarMapMenu_ExecuteRoute") EndIf EndFunction Function OnPlayerPlotRoute(...) Global ; This works Debug.Notification("OnPlayerPlotRoute") EndFunction
Function StarMapMenu_ExecuteRoute() ; I never see this. Debug.Notification("StarMapMenu_ExecuteRoute") EndFunction
It should work. Are you sure you didn't forget the Global flag in the script? You can try sending this event with the Invoke() UI function, the function that sends it is SendExecuteEvent() in GalaxyStarMapMenu, see GalaxyStarMapMenu.swf.
This might be a lot of requests and idk how many of them are feasible but there's several things I've been trying to do.
I'm trying to work around the perk systems to expand perk functionality. Would it be possible to make a GetPerkRank() function, GetPerkDescription(), and GetPerkRankDescription() functions so I can compare the player's perk rank and get the perk description and rank descriptions to display respectively?
This second suggestion is something I've been sitting on for a while. I've wanted to work on making a more dynamic economy mod and there's no events for buying/selling items or ways to change the value of items. Would it be possible to make buy/sell events and a ModValue() function for objects?
You mean the animation or the actor's combat state? Take a look at the vanilla Conditions in SF1Edit >> Animations. There might be some attack animations with fitting conditions.
I don't know if requests are taken here, but I was wondering if player vertical velocity and/or jump height could be added to this. Thanks for this regardless, and I hope things go well for you.
Added these to the upcoming (still in beta) update:
; # calculates this actor's jump height ( i.e. how high this actor can jump ) Float Function CalculateJumpHeight(Actor akActor) native global ; ; # returns the velocity of this reference on the specified axis ( x, y, z ) Float Function GetVelocity(ObjectReference akReference, String asAxis) native global
I am trying to get ObjectReferences from PackIn contents. The PackIn triggers the Placement event, so I have that ObjectReference as a starting point.
It seems like I can only get the refs for a few objects. Pretty much only ACTIvators and CONTainers. I can do this because they have linkedRefs and/or Keywords I can use to get the ObjectReference.
But I want to get objects types that are STATic Forms.
How can I get object references for these Statics, they do not have Keywords or LinkedRefs I can use. Thanks.
It is a vanilla limitation. I'll see if I can expand CreateReferencesAtCoordinates() to return all Pack-In objects in an ObjectReference[]. Returning all references of an already placed Pack-In probably wouldn't be reliable because it is not guaranteed all of them can be found (i.e. if the Pack-In is placed outside of the loaded area, most of its object references would be immediatelly unavailable unless they are persistent).
Okay great. It'll be appreciated thank you. I do wonder if I could set the Persistent flag via script, or if GetPositionZ() could tell me anything about it's post placement foundation height. GetPositionZ() does return a value I could maybe use, but I would also need the ground elevation on that spot to get the difference. Or, if I can get an ObjectReference for a STATic on that sits on ground level then it's position or bounds should tell me what I need to know about the adjustable height foundation.
Were you able to get any function to return all Pack-In objects in an ObjectReference[]?? I don't see any changes to CreateReferencesAtCoordinates() in 2.9. I think for this use case, the object references for these pack-ins will all be inside the loaded area, since they are outpost objects. So probably reliable.
Sorry, I haven't checked out Pack-In placed refs yet. There's a vanilla script RQ_PlaceObjectScript where BGS needed to find a workaround to find placed refs from a Pack-In. You can take a look at their function.
Yeah, I saw that before ; PlaceAtMe doesn't return anything when placing Packins, so find it this way placedRef = interactionTargetRefs[i].FindAllReferencesOfType(PrefabPackinPivotDummy, 1)[0]
But when I tried usingFindAllReferencesOfType it does not return anything unless I know know the references already. So not really useful.
Not yet, the issue is when the Pack-In is placed outside of the loaded area, its references are unreachable. I suspect this is why FindAllReferencesOfType() can't find them either. I wouldn't want to mess with the vanilla function (I'm not even sure overwriting it is enough) so I'll probably need to write a custom PlaceAtMe(), iterate the Pack-In's cell, place the refs accordingly then fill them into a Papyrus array to keep them in the memory. Unfortunately, various Pack-In related data is still missing to write a function like this.
Is it possible to write a function that only works for packins placed "inside" the loaded area? I don't need to persistently reach these references. Just the one time, when manually placed by the player right in front of them.
You need to create the Pack-In as Instanced Static so that one Pack-In form will be created by the vanilla code instead of separate refereneces found inside its linked Pack-In Cell. I think you can then find the placed Pack-In ref with FindAllReferencesOfType(PackInBase), assuming it was placed in the loaded area.
If the refs in the Pack-In are linked then you can try GetAllRefsLinkedToMe() but the refs still need to be loaded in the memory.
; # returns all forms in this form list in a form array Form[] Function GetFormListAllForms(FormList akFormList) native global The array is not filled. However, if I use the vanilla function GetArray(), the array is filled correctly.
I am using an empty formlist that I fill in the script. Does the function perhaps not work with runtime-filled formlists?
And what is the difference between GetFormListAllForms and the vanilla function GetArray?
would it be possible to integrate the text input function of Starware Search Engine - SFSE into Cassiopeia? So when you call it, the text input window opens and you get the text back as a return value. This would open up great possibilities.
Hi LarrannKiar, did you ever fix this bug? Unfortunately, the hotkeys LShift-Numpad1-8 no longer work since Cassiopeia Papyrus Extender V2.4+. Because for the mod NPC and Player Outfit Changer (https://www.nexusmods.com/starfield/mods/12372) it requires the hotkeys to be able to access the different slots for the outfits. Thanks.
this code does not work since 2.4: if aiKeyCode == 97 && !bPressed && IsKeyDown(160)(right shift does not work either)
Left Alt and left CTRL works: Ctrl:if aiKeyCode == 97 && !bPressed && IsKeyDown(162)or Left Altif aiKeyCode == 97 && !bPressed && IsKeyDown(164)
Num lock is also swapped.
Num lock on (numbers are displayed in the console)Does not work !!! If aiKeyCode == 101; Num Pad 5 If IsKeyDown(101); Left Shoft Debug.Notification(“Left Shift + NumPad 5”) EndIf EndIf
Num lock off (no numbers in the console).Works !!!If aiKeyCode == 101; Num Pad 5 If IsKeyDown(101); Left Shoft Debug.Notification(“Left Shift + NumPad 5”) EndIf EndIf By the way,@LarannKiar do you even read your PMs? I wrote to you weeks ago and the PM hasn't been opened yet. In the meantime the PM is obsolete. You've probably overlooked it and have a lot to do. I'd just like to know which is the best communication channel to you if something technical comes up.
Cassiopeia especially since v2.4 receives (reads) the native game input events, as the game sends them. Unfortunately, this isn't suitable for getting raw keyboard input (e.g. to detect key combinations with control keys to be used for precise text input). Text input is based on AS3 ingame so I'd probably need to create a new input manager for this.
I think you can get it to work though but you'd need to examine how the game sends the events (i.e. when you press and hold Left Shift, then press Num Pad 5, then release NumPad 5, the game sends the event for Left Shift even though it's still pressed..). Call EnableLogging(true) to enable logging for Cassiopeia, all input events will be logged. Write the script accordingly for the logged events. (It's much easier if you don't need the control keys).
The fastest way is to leave a feedback on the mod page.
with Shift no 'pressed = 0' is sent when the number key is released.The key also reacts very badly (with Num Lock on), i.e. I have to press it several times if I want to press the Num key if i use this code. if aiKeyCode == 97 && IsKeyDown(160)
It is therefore unusable.
If I use Alt or CTRL with pressed = 0 the condition is ALWAYS and IMMEDIATELY true. In other words, the key reacts immediately.With Alt or Ctrl key a 'pressed = 0' is properly sent when releasing the Num key.Unfortunately I need the Control keys + Numpad keys, (2x8 keys). And it should work like this: Ctrl keys = 1 -> Numpad 1 -> Numpad = 0 -> Trigger
I thought it was a bug, because up to 2.3 a 'pressed = 0' was also sent correctly for Shift + Numpad and from 2.4 only for Alt and CTRL.
I had already switched to Alt, but had inquiries about the Shift key, so I would like to have the key combination again with Shift+NumPad and Ctrl+Numpad. Nothing can be done, thanks anyway.
Then it stays with Alt+Numpad and Ctrl+Numpad. These two key combinations work perfectly. But please don't tinker with them again. :-)
189 comments
I am having an issue with the StarMapMenu_ExecuteRoute event. My assumption has been that this fires when the player has selected a destination and holds down "X" to make the jump. Am I misunderstanding when this fires?
It seems that the handler registration is succeeding, but I'm not seeing the event fire. I'm also using the "OnPlayerPlotRoute" event, and that one works fine.
Function DoLoadGame()
LogDebug("DoLoadGame")
; Native events from CassiopeiaPapyrusExtender need to be registered on every load.
If !RegisterForNativeEvent("MyScript", "OnPlayerPlotRoute", None)
LogDebug("Failed to register for OnPlayerPlotRoute")
ElseIf !RegisterForNativeEvent("MyScript", "StarMapMenu_ExecuteRoute", None)
LogDebug("Failed to register for StarMapMenu_ExecuteRoute")
Else
LogDebug("Registered for OnPlayerPlotRoute and StarMapMenu_ExecuteRoute")
EndIf
EndFunction
Function OnPlayerPlotRoute(...) Global
; This works
Debug.Notification("OnPlayerPlotRoute")
EndFunction
Function StarMapMenu_ExecuteRoute()
; I never see this.
Debug.Notification("StarMapMenu_ExecuteRoute")
EndFunction
Thanks again!
I forgot to set the Global flag. Thanks for the second set of eyes.
Now I'm off to figure out what other totally obvious things can go right over my head.
I'm trying to work around the perk systems to expand perk functionality. Would it be possible to make a GetPerkRank() function, GetPerkDescription(), and GetPerkRankDescription() functions so I can compare the player's perk rank and get the perk description and rank descriptions to display respectively?
This second suggestion is something I've been sitting on for a while. I've wanted to work on making a more dynamic economy mod and there's no events for buying/selling items or ways to change the value of items. Would it be possible to make buy/sell events and a ModValue() function for objects?
; # calculates this actor's jump height ( i.e. how high this actor can jump )
Float Function CalculateJumpHeight(Actor akActor) native global
;
; # returns the velocity of this reference on the specified axis ( x, y, z )
Float Function GetVelocity(ObjectReference akReference, String asAxis) native global
It seems like I can only get the refs for a few objects. Pretty much only ACTIvators and CONTainers. I can do this because they have linkedRefs and/or Keywords I can use to get the ObjectReference.
But I want to get objects types that are STATic Forms.
How can I get object references for these Statics, they do not have Keywords or LinkedRefs I can use.
Thanks.
I do wonder if I could set the Persistent flag via script, or if GetPositionZ() could tell me anything about it's post placement foundation height. GetPositionZ() does return a value I could maybe use, but I would also need the ground elevation on that spot to get the difference. Or, if I can get an ObjectReference for a STATic on that sits on ground level then it's position or bounds should tell me what I need to know about the adjustable height foundation.
; form type as int
Int iFormType = CassiopeiaPapyrusExtender.GetFormTypeAsInt(akReference.GetBaseObject())
; form type as string
String sFormType = CassiopeiaPapyrusExtender.GetFormTypeAsString(akReference.GetBaseObject())
Were you able to get any function to return all Pack-In objects in an ObjectReference[]??
I don't see any changes to CreateReferencesAtCoordinates() in 2.9. I think for this use case, the object references for these pack-ins will all be inside the loaded area, since they are outpost objects. So probably reliable.
; PlaceAtMe doesn't return anything when placing Packins, so find it this way
placedRef = interactionTargetRefs[i].FindAllReferencesOfType(PrefabPackinPivotDummy, 1)[0]
But when I tried using
FindAllReferencesOfType
it does not return anything unless I know know the references already. So not really useful.GetAllRefsLinkedToMe
be helpful for what I'm trying to do?If the refs in the Pack-In are linked then you can try GetAllRefsLinkedToMe() but the refs still need to be loaded in the memory.
quick question,
; # returns all forms in this form list in a form array
Form[] Function GetFormListAllForms(FormList akFormList) native global
The array is not filled. However, if I use the vanilla function GetArray(),
the array is filled correctly.
I am using an empty formlist that I fill in the script. Does the function perhaps not work with runtime-filled formlists?
And what is the difference between GetFormListAllForms and the vanilla function GetArray?
does anyone happen to know how I can find the name/displayname of the outpost I'm currently in, or where the name is stored?
GetWorkshopName() works perfectly. Thank you very much. :-)
would it be possible to integrate the text input function of Starware Search Engine - SFSE into Cassiopeia? So when you call it, the text input window opens and you get the text back as a return value. This would open up great possibilities.
Verified it with this code:
Function Register() Global
RegisterForNativeEvent("CassiopeiaTest", "BSInputEvent")
EndFunction
Function BSInputEvent(Int aiKeyCode, String asControlName, String asFriendlyName, bool bPressed, Float afHeldTime) global
If aiKeyCode == 0x65; Num Pad 5
If IsKeyDown(0xA0); Left Shoft
Debug.Notification("Left Shift + NumPad 5")
EndIf
EndIf
EndFunction
It's a bug with bpressed.
this code does not work since 2.4:
if aiKeyCode == 97 && !bPressed && IsKeyDown(160)
(right shift does not work either)Left Alt and left CTRL works:
Ctrl:
if aiKeyCode == 97 && !bPressed && IsKeyDown(162)
or Left Altif aiKeyCode == 97 && !bPressed && IsKeyDown(164)
Num lock is also swapped.
Num lock on (numbers are displayed in the console)Does not work !!!
If aiKeyCode == 101; Num Pad 5
If IsKeyDown(101); Left Shoft
Debug.Notification(“Left Shift + NumPad 5”)
EndIf
EndIf
Num lock off (no numbers in the console).Works !!!
If aiKeyCode == 101; Num Pad 5
If IsKeyDown(101); Left Shoft
Debug.Notification(“Left Shift + NumPad 5”)
EndIf
EndIf
By the way,@LarannKiar do you even read your PMs? I wrote to you weeks ago and the PM hasn't been opened yet. In the meantime the PM is obsolete. You've probably overlooked it and have a lot to do. I'd just like to know which is the best communication channel to you if something technical comes up.
I think you can get it to work though but you'd need to examine how the game sends the events (i.e. when you press and hold Left Shift, then press Num Pad 5, then release NumPad 5, the game sends the event for Left Shift even though it's still pressed..). Call EnableLogging(true) to enable logging for Cassiopeia, all input events will be logged. Write the script accordingly for the logged events. (It's much easier if you don't need the control keys).
The fastest way is to leave a feedback on the mod page.
with Shift no 'pressed = 0' is sent when the number key is released.The key also reacts very badly (with Num Lock on), i.e. I have to press it several times if I want to press the Num key if i use this code.
if aiKeyCode == 97 && IsKeyDown(160)
It is therefore unusable.
If I use Alt or CTRL with pressed = 0 the condition is ALWAYS and IMMEDIATELY true.
In other words, the key reacts immediately.With Alt or Ctrl key a 'pressed = 0' is properly sent when releasing the Num key.Unfortunately I need the Control keys + Numpad keys, (2x8 keys).
And it should work like this: Ctrl keys = 1 -> Numpad 1 -> Numpad = 0 -> Trigger
I thought it was a bug, because up to 2.3 a 'pressed = 0' was also sent correctly for Shift + Numpad and from 2.4 only for Alt and CTRL.
I had already switched to Alt, but had inquiries about the Shift key, so I would like to have the key combination again with Shift+NumPad and Ctrl+Numpad. Nothing can be done, thanks anyway.
Then it stays with Alt+Numpad and Ctrl+Numpad. These two key combinations work perfectly. But please don't tinker with them again. :-)