Michael Schaffer Posted August 10, 2021 Posted August 10, 2021 Hey I'm working on a mod that gives actor experience when you defeat a ship in battle. Specifically a boarding victory. I've setup a new global switch and I have the ModScriptHook working just fine for when the switch gets flipped it adds experience and turns the switch back off. All I need now is a way to flip that switch after winning a ship boarding battle. I've tried a bunch of things and I must be getting the syntax wrong somewhere. Could You help me with the formatting of the code? Here's what I got for the part that's wrong. Obviously, like I said, it's wrong somewhere and this doesn't work, maybe you know why or what I'm doing wrong? { "$type": "Game.GameData.ShipCaptainGameData, Assembly-CSharp", "DebugName": "CPT_Generic_Merchant_01", "ID": "e6c62655-041d-40eb-9d15-69330d21aad7", "Components": [ { "$type": "Game.GameData.ShipCaptainComponent, Assembly-CSharp", "ShipID": "ad1e31fa-15c9-4a7a-b62d-af4d059ba489", "TraitID": "abd4a293-6f64-4fac-9f65-a90f64c18942", "Conditionals": { "Operator": 0, "Components": [ { "$type": "OEIFormats.FlowCharts.ConditionalCall, OEIFormats", "Data": { "FullName": "Boolean IsGlobalValue(String, Operator, Int32)", "Parameters": [ "DG_Global_Ship_Sunk", "EqualTo", "0" ], "Scripts": [ { "Data": { "FullName": "Void SetGlobalValue(String, Int32)", "Parameters": [ "DG_Global_Ship_Sunk", "1" ] }, "Conditional": { "Operator": 0, "Components": [] } } ] }, "Not": false, "Operator": 0 } ] } } ] }, Thanks for your time. 1
Noqn Posted August 10, 2021 Posted August 10, 2021 "Scripts" is not a valid parameter (see the ScriptCallData structure) and should be removed. I think I see what you want to do, sadly the "Conditionals" property of the ShipCaptainComponent is a ConditionalExpression, and there's no way to call Scripts from here. Maybe you could run a ScriptHook which checks for IsInCombatEncounter (which conveniently is used exclusively for Ship Duels), and if so set DG_Global_Ship_Sunk to true? 1
Michael Schaffer Posted August 10, 2021 Author Posted August 10, 2021 Thank you Noqn, I've been trying to use this method actually and here's where I get stuck. I think the ScriptHook only checks once on the transition of maps. Maybe this issue I'm having is it's running this check before it enters combat? Let me show you my code and you can help me see what I'm doing wrong. { "GameDataObjects": [ { "$type": "Game.GameData.ModScriptHookGameData, Assembly-CSharp", "DebugName": "ShipBattlesGiveActorExp_ScriptHook", "ID": "6ca3b6f5-76e8-4566-b037-4d1eb994589b", "Components": [ { "$type": "Game.GameData.ModScriptHookComponent, Assembly-CSharp", "RunOnlyOnce": "false", "SucceedOnlyOnce": "false", "Script": { "Conditional": { "Operator": 0, "Components": [ { "$type": "OEIFormats.FlowCharts.ConditionalCall, OEIFormats", "Data": { "FullName": "Boolean IsInCombatEncounter()", "Parameters": [ ] }, "Not": false, "Operator": 0 } ] }, "Scripts": [ { "Data": { "FullName": "Void AddExperience(Int32)", "Parameters": [ "DG_Ship_Battle_Exp_Reward" ] }, "Conditional": { "Operator": 0, "Components": [] } } ] } } ] } ] } I'm looking into using IsRandomEncounterMap(), but for some reason when I try to Eval IsRandomEncounterMap it's out of scope. Thanks again for reading.
Michael Schaffer Posted August 11, 2021 Author Posted August 11, 2021 Thank you for the help, I've finished and released the mod on Steam Workshop. I decided to use Boolean isPreviousScene(Guid) and a couple of ModScriptHookComponents using a custom Global var to act as a switch to stop the save/load gain exp bug I had. Here's a link where you can find it. It's use is self-explanatory. Ship Battles Give Actor Experience Mod on Steam for Pillars of Eternity 2: Deadfire. If you do decide to try it out, please let me know if you encounter any bugs or issues. Especially if you found a map I missed. (I only added 9 MapData Guids, so I'm sure I missed some). Once again thanks for you time! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now