Jump to content
View in the app

A better way to browse. Learn more.

Obsidian Forum Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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. :)

"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?

  • Author

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.

  • Author

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! :)

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.