Jump to content

Welcome to Obsidian Forum Community
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

Modding Question to Devs: Scripts

Modding Question Scripts

  • Please log in to reply
14 replies to this topic

#1
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

I'm wondering if the Scripts fields can be used to directly add a command to the game, like we do using the console or if that function is disabled cuz no-one ability have this field compiled.

 

My purpose is add an ability/status effect that add disposition points, so surfing inside the game docs i found that about script

 

disposition.png

 

could i add that to an ability? And which is the correct syntax?  Because reading the docs i'm a little confused about ChangeStrenghtComponent . Which is the parameter to refer about it? Average, Major?

Cuz i wanna add just few points not a whole disposition rank.

Thnks in advance

 

Void DispositionAddPoints(Guid, Guid)

 

DispositionComponent

 

ChangeStrengthComponent

 

EDIT

 

I found the StrenghtComponent, but an answer about scripts  in ability components is always welcome :)

 

 

EDIT 2

 

Something like that? Could it works?

                "Scripts": [{
        "$type": "OEIFormats.FlowCharts.ScriptCallData, OEIFormats",
         "Data": {
             "FullName": "Void DispositionAddPoints(Guid, Guid)",
             "Parameters": ["c7d9588c-bc62-4c0c-a2e3-76a970e7b7d4", "54772c0d-cf3f-4589-8cab-9f3601d575c2"],
             "UnrealCall": "",
             "FunctionHash": 0,
             "ParameterHash": 0
            }


Edited by kilay, 20 July 2018 - 09:28 AM.


#2
BMac

BMac

    Programmer

  • Developers
  • 410 posts
  • Lords of the Eastern Reach Backer

It doesn't look like we currently provide a way on abilities, attacks, or status effects to execute a script call.  Your script call looks correct, though.


  • kilay likes this

#3
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

It doesn't look like we currently provide a way on abilities, attacks, or status effects to execute a script call.  Your script call looks correct, though.

 

Thnks for reply.

So from what i've seen  disposition points  can be changed only via convos or scripted interactions, right?

If the answer is affermative , can i call a scripted interaction to trigger this disposition change (like soulbound weapons)?


Edited by kilay, 20 July 2018 - 10:32 AM.


#4
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

Or if it isn't doable, is there  some other way to add disposition points using an item ?



#5
BMac

BMac

    Programmer

  • Developers
  • 410 posts
  • Lords of the Eastern Reach Backer

You can call the script from anywhere that has a "ScriptsOnly" or "ConditionalAndScripts" property in the documentation (search the Components and Structures pages).  Soulbound items can directly fire scripts when they level up - you wouldn't even need a scripted interaction.


  • kilay likes this

#6
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

You can call the script from anywhere that has a "ScriptsOnly" or "ConditionalAndScripts" property in the documentation (search the Components and Structures pages).  Soulbound items can directly fire scripts when they level up - you wouldn't even need a scripted interaction.

 

I would just say thnks, cuz i figured out the problem, i made my first soulbound weapon and it add disposition points when levels...

Many thnks again


Edited by kilay, 21 July 2018 - 10:14 AM.


#7
SiliconMage

SiliconMage

    (2) Evoker

  • Members
  • 59 posts
  • Deadfire Silver Backer
  • Fig Backer

I know you said that you cannot apply scripts from status effects or attacks, BMac, but I stumbled upon this in the documentation:

 

Attached File  Capture.PNG   5.56KB   0 downloads

 

Does this mean that we can NOW launch scripts from attacks?

 

 



#8
BMac

BMac

    Programmer

  • Developers
  • 410 posts
  • Lords of the Eastern Reach Backer
No, that component can only trigger scripts on the events available in the DataScriptEvent enum (which would only be OnInspected for an Attack).
  • SiliconMage likes this

#9
SiliconMage

SiliconMage

    (2) Evoker

  • Members
  • 59 posts
  • Deadfire Silver Backer
  • Fig Backer

No, that component can only trigger scripts on the events available in the DataScriptEvent enum (which would only be OnInspected for an Attack).

 

So would this be a valid declaration of the DataScriptEventComponent for an attack?

{
		"$type": "Game.GameData.AttackMeleeGameData, Assembly-CSharp",
		"DebugName": "Benediction_of_Restoration_Melee",
		"ID": "b0dc0e1a-0b99-4a7a-5a3c-59486bb60243",
		"Components": [{
			"$type": "Game.GameData.AttackBaseComponent, Assembly-CSharp",
			"KeywordsIDs": ["d5e4e9b4-9565-4654-9e2e-2d68d8847c20"],
			"AttackDistance": 5,
			"MinAttackDistance": 0,
			"AttackVariationID": "7439b86f-785c-4551-8851-95b375a02792",
			"UseParentEquippableHand": "false",
			"CastSpeedID": "e4c738a7-4d3f-407f-b035-cc76191fe26b",
			"RecoveryTimeID": "2065a64b-0d53-48b8-9cfd-600992c389fd",
			"ImpactDelay": 0,
			"ForcedTarget": "None",
			"AffectedTargetType": "Friendly",
			"AffectedTargetConditional": {
				"Conditional": {
					"Operator": 0,
					"Components": []
				}
			},
			"AffectedTargetDeathState": "Alive",
			"HostilityOverride": "Default",
			"PushDistance": 0,
			"FaceTarget": "true",
			"AccuracyBonus": 0,
			"PenetrationRating": 0,
			"DamageData": {
				"DamageType": "None",
				"AlternateDamageType": "None",
				"Minimum": 0,
				"Maximum": 0,
				"DamageProcs": []
			},
			"Require****Object": "true",
			"StatusEffectKeywordsIDs": ["d5e4e9b4-9565-4654-9e2e-2d68d8847c20"],
			"StatusEffectsIDs": [],
			"RandomizeStatusEffect": "false",
			"CanGraze": "false",
			"CanCrit": "true",
			"DefendedBy": "None",
			"AfflictionsDefendedBy": "None",
			"AfflictionApplicationModifier": "None",
			"SubstituteHitVisualEffect": "",
			"VisualEffects": [{
				"VisualEffect": "prefabs/effects/abilities/cast/fx_cast_priest_hand.prefab",
				"AttachPoint": "LeftWeapon",
				"AttachObject": "Caster",
				"AttachMode": "Attach",
				"MeshType": "None",
				"Event": "OnAnimEvent",
				"AnimEventID": 2,
				"Loop": "true",
				"Scale": "false"
			},
			{
				"VisualEffect": "prefabs/effects/abilities/cast/fx_cast_priest_hand.prefab",
				"AttachPoint": "RightWeapon",
				"AttachObject": "Caster",
				"AttachMode": "Attach",
				"MeshType": "None",
				"Event": "OnAnimEvent",
				"AnimEventID": 2,
				"Loop": "true",
				"Scale": "false"
			},
			{
				"VisualEffect": "prefabs/effects/abilities/cast/fx_cast_priest_finish.prefab",
				"AttachPoint": "RightWeapon",
				"AttachObject": "Caster",
				"AttachMode": "Attach",
				"MeshType": "None",
				"Event": "OnLaunch",
				"AnimEventID": 0,
				"Loop": "false",
				"Scale": "false"
			},
			{
				"VisualEffect": "prefabs/effects/abilities/cast/fx_cast_priest_finish.prefab",
				"AttachPoint": "LeftWeapon",
				"AttachObject": "Caster",
				"AttachMode": "Attach",
				"MeshType": "None",
				"Event": "OnLaunch",
				"AnimEventID": 0,
				"Loop": "false",
				"Scale": "false"
			}],
			"AttackOnImpactID": "00000000-0000-0000-0000-000000000000",
			"ExtraAttackID": "00000000-0000-0000-0000-000000000000",
			"LaunchBone": "LeftWeapon",
			"HitBone": "Chest",
			"OnHitShakeDuration": "None",
			"OnHitShakeStrength": "None",
			"NoiseLevelID": "82bc1ce9-3a81-41ca-a61a-cc1f73a53de7",
			"AllReactNoise": "false",
			"InterruptsOn": "None",
			"InterruptType": "Normal",
			"TargetAngle": 0,
			"ApplyOnceOnly": "false",
			"PathsToTarget": "true",
			"HideFromCombatLog": "false",
			"AdditionalAttackOnTooltip": "false",
			"DoesNotApplyDamage": "false",
			"TreatAsWeapon": "false",
			"BounceData": {
				"Bounces": 0,
				"Multiplier": 0.5,
				"Range": 10,
				"InRangeOrder": "false",
				"NoRepeatTargets": "false",
				"AlwaysBounceAtEnemies": "false",
				"Delay": 0,
				"NeverBounce": "false"
			}
		},
		{
			"$type": "Game.GameData.AttackMeleeComponent, Assembly-CSharp",
			"EngagementRadius": 1,
			"IsUnarmed": "false"
		},
		{
			"$type": "Game.GameData.DataScriptEventComponent, Assembly-CSharp",
			"Scripts": [{
				"Event": "OnInspected",
				"Script": {
					"Conditional": {
						"Operator": 0,
						"Components": []
					},
					"Scripts": [{
						"Data": {
							"FullName": "Void RemoveAllInjuries(Guid)",
							"Parameters": ["1a26e100-0000-0000-0000-000000000000"],
							"UnrealCall": "",
							"FunctionHash": 0,
							"ParameterHash": 0
						},
						"Conditional": {
							"Operator": 0,
							"Components": []
						}
					}]
				}
			}]
		}]
	}

  • kilay likes this

#10
BMac

BMac

    Programmer

  • Developers
  • 410 posts
  • Lords of the Eastern Reach Backer
Yep, that looks correct from my cursory inspection.
  • SiliconMage and kilay like this

#11
SiliconMage

SiliconMage

    (2) Evoker

  • Members
  • 59 posts
  • Deadfire Silver Backer
  • Fig Backer

Yep, that looks correct from my cursory inspection.


Cool, thanks! I'm having trouble getting any script to fire when the attack launches, but I'm hoping it's more an issue with the attack than with the script call.

#12
BMac

BMac

    Programmer

  • Developers
  • 410 posts
  • Lords of the Eastern Reach Backer
I think I accidentally misled you. That particular event (OnInspected) doesn't fire when the attack is launched. It fires when the attack is opened in the inspection window. DataScriptEvent doesn't currently provide an event for when the attack is launched.
  • SiliconMage likes this

#13
_The_Narrator_

_The_Narrator_

    (0) Nub

  • Initiates
  • 2 posts

You can call scripts, if and when you can apply StatusEffect to a character with a quick slot. First make a dummy item. It can be completely empty (it still needs an ItemComponent) and add a DataScriptEventComponent with OnItemCollected event to it. Attach the scripts you want to call here. Make two StatusEffectGameData one with BonusQuickSlots ("BaseValue": 1, "DurationType": "Instant") and another with SummonConsumable ("DurationType": "Instant", "ItemValueID": "Dummy item Guid"). Make sure you always apply them one after the other, first the BonusQuickSlots then SummonConsumable. Once the summoning is completed (in an instant) both the BonusQuickSlots and the SummonConsumable will be removed, but the script on the dummy item will be called.

 

It works, because the SummonConsumable calls a function that triggers the OnItemCollected event (for example the SummonWeaponPrimarySlot does not). Also the max quick item number can go over 6, the overflow is simply inaccessible, but not for the SummonConsumable status effect.

 

The BonusQuickSlots and the SummonConsumable can be applied from an attack as well. The downside: the attack has to originate from a charater with a quick slot. Make a KeywordGameData for the attack and add it to the "KeywordsIDs" of said attack. Apply a StatusEffectGameData with ApplyStatusEffectOnEvent ("AttackFilter": {"KeywordsIDs": [KeywordGameData attack Guid]}, "StatusEffectsValueIDs": [BonusQuickSlots Guid, SummonConsumable Guid], "EventValue": "OnScoringGrazeHitOrCriticalHit") to the character. Whenever the character hits with the attack, the script will be called as well.


  • BMac, mammasaura , SiliconMage and 1 other like this

#14
SiliconMage

SiliconMage

    (2) Evoker

  • Members
  • 59 posts
  • Deadfire Silver Backer
  • Fig Backer

You can call scripts, if and when you can apply StatusEffect to a character with a quick slot. First make a dummy item. It can be completely empty (it still needs an ItemComponent) and add a DataScriptEventComponent with OnItemCollected event to it. Attach the scripts you want to call here. Make two StatusEffectGameData one with BonusQuickSlots ("BaseValue": 1, "DurationType": "Instant") and another with SummonConsumable ("DurationType": "Instant", "ItemValueID": "Dummy item Guid"). Make sure you always apply them one after the other, first the BonusQuickSlots then SummonConsumable. Once the summoning is completed (in an instant) both the BonusQuickSlots and the SummonConsumable will be removed, but the script on the dummy item will be called.

 

It works, because the SummonConsumable calls a function that triggers the OnItemCollected event (for example the SummonWeaponPrimarySlot does not). Also the max quick item number can go over 6, the overflow is simply inaccessible, but not for the SummonConsumable status effect.

 

The BonusQuickSlots and the SummonConsumable can be applied from an attack as well. The downside: the attack has to originate from a charater with a quick slot. Make a KeywordGameData for the attack and add it to the "KeywordsIDs" of said attack. Apply a StatusEffectGameData with ApplyStatusEffectOnEvent ("AttackFilter": {"KeywordsIDs": [KeywordGameData attack Guid]}, "StatusEffectsValueIDs": [BonusQuickSlots Guid, SummonConsumable Guid], "EventValue": "OnScoringGrazeHitOrCriticalHit") to the character. Whenever the character hits with the attack, the script will be called as well.

 

Fantastic work-around!  Do you know if this works if the character in question has all quick slots unlocked?  


Edited by SiliconMage, 16 August 2018 - 07:05 AM.


#15
_The_Narrator_

_The_Narrator_

    (0) Nub

  • Initiates
  • 2 posts

Yes, the BonusQuickSlots can go above 6. It's a simple addition, but there are two stacking rules:

  1. If the character has BonusQuickSlots from multiple sources (for example Deep Pockets) they stack with each other.
  2. The "MaxStackQuantity" property of the StatusEffectComponent governs the stacking rule for applying the same StatusEffectGameData (same Guid) to a single character.

You can't access the extra quick slots beyond the theoretical max (six) from the UI, but the SummonConsumable can add an item to it just fine.


  • SiliconMage likes this





Also tagged with one or more of these keywords: Modding, Question, Scripts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users