HOW-TO: Use quest conditions and functions

There are a lot of conditions and functions that can be used in quest graphs. Here’s what they mean.

This documentation should help you understand their functions. Please keep in mind that this are not all of the conditions and functions available in REDkit.


Conditions

Conditions are used in a variety of quest blocks, for example the pause block. These are not all of the conditions available in REDkit.

1. CQuestActorCondition

CQCActorScriptedCondition

W3QuestCond_HasModifier

Set to TRUE if given actor or player has selected buff/debuff attached.

W3QuestCond_HasWeaponDrawn

Set to TRUE if given actor has any weapon drawn.

W3QuestCond_Health

Set to TRUE if actor's 'health' percentage level meets required condition. Checks actor's Vitality or Essence, depending on which one is used by actor. If Actor has both Vitality and Essence returns FALSE as this situation is considered a bug and should not happen ever.

W3QuestCond_IsInState

Set to TRUE if given actor is in given 'state'. Note that this is not a state in the script/code sense.

W3QuestCond_IsInVehicle

Set to TRUE if actor is on given vehicle.

W3QuestCond_IsTargetOf

attackerTag - tag of attacker actor
Set to TRUE if actor is current target of attacker.

2. CQuestFightCondition

Checks fight condition for Actor/GameplayEntity with given tag (if it works for GameplayEntity it will also work for Actor, NPC and Player):

QFM_Killed - valid for Actors, set when actor was killed,
QFM_Stunned - valid for Actors, set when actor Staggers for the duration of the stagger + 1 sec,
QFM_Hit_By_Aard - valid for GameplayEntity, set for 1 sec after the object was hit by Aard,
QFM_Hit_By_Igni - valid for GameplayEntity, set for 1 sec after the object was hit by Igni,
QFM_Hit_By_Yrden - valid for GameplayEntity, set for 1 sec after the object was hit by Yrden. The isInteractionActivator field (under CGameplayEntity properties) must be set,
QFM_Hit - valid for Entities, set for 1 sec when the character was hit by some attack (melee, ranged, spell)

3. CQuestScriptedCondition

W3QuestCond_ActorIsDespawned

Set to TRUE when given all actors with given tag have been despawned. Currently, due to tech limitations this condition cannot be placed under CQuestActorCondition

W3QuestCond_BookHasBeenRead

Set to TRUE when given book has been read by the player.

W3QuestCond_Container

Checks if all containers of given tag meet the requirement of being empty or non-empty.

W3QuestCond_EntityComponentEnabled

Set to TRUE if given component of GameplayEntity given by tag is enabled.

W3QuestCond_EntityComponentExists

Set to TRUE if GameplayEntity given by tag has given component.

W3QuestCond_IsItemEquipped

Set to TRUE if given item is equipped by the player.

W3QuestCond_IsItemQuantityMet

Searches for inventory of entity given by tag. If no entity is found takes the player's inventory. Checks if the quantity of items is met first by item name, then by item category, then by tag.

W3QuestCond_IsItemUsed

Checks if given item has been used from within player's inventory (3 sec fact).

W3QuestCond_OilApplied

Set to TRUE when chosen oil has been applied to given sword type.

W3QuestCond_UsedFocus

Set to TRUE when player is in focus mode (combat or non-combat).

W3QuestCond_UsedMedallion

Set to TRUE when player activates the medallion.

W3QuestCond_WasMeditating

hours: amount of hours spent meditating/hour until meditation occurs
dayPart : EDayPart_Dawn/Noon/Dusk/Midnight/Undefined

If dayPart is chosen then player has to meditate to given day part (dawn, noon, dusk, midnight). Preferably use this rarther than fixed hour (e.g. 6:00 for dawn) because at different parts, the day starts at a different hour.

meditateToHour : True/False

Set to TRUE if player has been meditating (triggered when player leaves the meditation / preparation UI panel for good).

If meditateToHour is set then player has to meditate until it is the given hour (e.g. meditate until it's 14:00), otherwise she/he has to meditate for given amount of hours (e.g. meditate for 14 hours).

Total meditation time is used until player leaves the panel. So if the pause is set to wait for 8 hours then the player might meditate for 4 hours, followed by a second meditation of 2 hours, followed by potion preparation, followed by a third meditation of 2 hours. In such case the sum of meditation time 4+2+2=8 is enough to trigger the condition.
The condition is triggered when the time meditated is equal to required time. So if the player is required to meditate for 4 hours but meditates for 3 or 5 hours the condition will not be met.


Functions

Functions are set inside of Script blocks in quest graphs. These are not all of the functions that are available inside of REDkit.

1. AddItemQuest

targetTag : name
itemName : name
quantity : int
items : array

Adds specified amount of items of given type to given GameplayEntity. You can use both (or either of) the itemName/quantity pair and the array of items. This way you don't have to use the array if you want to add just one item which is a little faster and simpler.

2. AddNPCModifierQuest

npcTag : name
buffEffects : array

Adds selected (de)buffs to actor with given tag.

3. DespawnNPCsWithTag

Despawns all actors with given tag.

4. DoorChangeState

tag : name
newState : EDoorQuestState

Finds all doors with given tag and changes their state to newState:

EDQS_Open - doors physically open
EDQS_Close - doors physically close
EDQS_RemoveLock - removes the keylock from doors (but does not change the opened/closed state)
EDQS_Enable - enables doors EDQS_Disable - disables doors (no interactions visible/possible)
EDQS_Lock - adds keylock to given doors.

The keyItemName holds the name of the key, the removeKeyOnUse tells if you want the key to be automatically removed from player's inventory when he unlocks the doors. If the keyItemName is not a valid name (e.g. empty) or the door already has a lock, this option will do nothing

5. DrawWeaponQuest

Forces the player to enter combat mode and thus draw the weapon (silver or steel).

6. EnableOrDisableContainers

containersTag : name
containerEnabled : True/False

All containers that have given tag get enabled/disabled.

7. EntityComponentQuest

tag : name
componentName : name
bEnable : True/False

Enables or disables given component of target GameplayEntity.

8. EquipItemQuest

targetTag : name
itemName : name
(optional) unequip : True/False

If unequip is set then given actor (except the player) unequips given item. If unequip is no set then the actor equips the item. Works only if actor already has the item in inventory.

(optional) toHand : True/False

The toHand parameter works only with NPCs and tells them to equip the item to hand (e.g. if this is false then the sword will be equipped and placed on the belt, if set to true if will be equipped and put in the NPC's hand).

9. FadeInQuest

fadeTime : float

Performs async fade in for given time.

10. FadeOutQuest

fadeTime : float

Performs async fade out for given time.

11. ForceTargetQuest

npcTag : name
targetTag : name

Forces NPC given by npcTag to set his combat target to Actor given by targetTag. If actor cannot be found target is set to NULL.

12. HorseWhistle

Makes Geralt call his horse.

13. KillPlayer

ignoreImmortalityMode : True/False

Kills player. If the ignoreImmortalityMode flag is set the player's immortality mode will be ignored meaning that you will be able to kill him/her even if immortal or invulnerable.

14. ModifyNPCAbilityQuest

npcTag : name
abilityName :name
remove : True/False

Adds or removes (remove flag) given ability from all NPCs having given tag.

16. PlayEffectQuest

entityTag : name
effectName : name
activate : True/False
persistentEffect : True/False

All entities with given tag will have the given effect activated or deactivated (based on activate flag). If persistentEffect is set then the effect will be set as AutoEffect.

16.RemoveItemQuest

entityTag : name
item_name : name
optional quantity : int

Removes item(s) from given GameplayEntity. If the quantity is not set then it's assumed that one item should be removed.

17. ResetFactQuest

factID : name

Sets given fact to 0.

18. RestoreMusicQuest

Restores volume of currently played music.

19. SetGroupAttitudeQuest

srcGroup : name
dstGroup : name
attitude : EAIAttitude
affiliation : EAIAffiliation

Sets attitude and affiliation of source group towards destination group. Does not set relations other way (destination group towards source group).

20. SetHealthQuest

targetTag : name
healthPerc : int
relative : True/False

Sets health of given actor (or player if targetTag is 'PLAYER') to a given level. The level is provided as percents of max health. If the relative flag is set the value is added or substracted (negative percentage value) from current health level. If the relative flag is not set then the value is set (overrides current value, negative value has no effect).

21. SetImmortalQuest

targetsTag : name
immortalityMode : EActorImmortalityMode

Changes immortality mode of all actors with given tag.

22. SoundEventOnActorQuest

actorTag : name
eventName : string

Plays given sound, positioning it on given node.

23. SoundEventQuest

eventName : string

Plays given sound (without positioning it in any particular point in the 3D space).

24. SwitchComponentStateQuest

shouldBeEnabled : True/False
objectTag : name
componentName : string

All objects with given tag have their selected component set to enabled or disabled.

25.TransferPlayerItemsQuest

designatedContainerTag: name
itemSelectionType: EItemSelectionType
steelSword, silverSword, chestArmor, boots, gloves, pants, trophy, bombs, lures : True/False
fromContainerToPlayer : True/False

Transfers items between player and container. If fromContainerToPlayer is set to true then items are transfered from container to player, otherwise the other way. Depending on itemSelectionType either all items or only equipped items are moved - this works only when passing items from player to container. The other way always selects all items regardless of how you set the flag. Items are picked from given item categories selected by True/False variables.

26. TutorialMessage

type : ETutorialMessageType
journalEntry : name

Shows tutorial message as given type (hint / pop-up). Message is given by its journal entry's key which is defined in resources\gameplay.xml.

 

______________________________________
The Witcher 3: Wild Hunt Complete Edition © 2024 CD PROJEKT S.A. Published by CD PROJEKT S.A. Developed by CD PROJEKT RED. CD PROJEKT®, The Witcher®, REDengine® are registered trademarks of CD PROJEKT Capital Group. All rights reserved. The Witcher game is set in the universe created by Andrzej Sapkowski in his series of books. All rights reserved.