Skip to content

Expanded Drama Actions

Temporary Version

This part of documentation is a partially written stub, and API usages may change at any time.

CWL comes with a small set of built-in drama expansion methods, which you can checkout code here.

This feature requires the CWL configuration value Dialog.ExpandedActions set to true, enabled by default.

In the drama sheet, you can use the CWL special action invoke* or i* for short to call expansion method:

Parameter Passing

Parameters are separated by comma , and written within the parentheses of the expansion method, similar to code syntax:

actionparamactor
invoke*/i*honk_honk(arg1, arg2)pc

Most of the methods also take actor cell as the target character to execute the method on, such as pc or tg(the drama owner character), or any valid character id. Default is tg.

If the jump in the same line has any value, then the return value of the expansion method will be used to determine if the jump will be executed. Returns true will execute the jump, otherwise not.

Value Expression: +5, *10, =69, !=114 etc, used to evaluate or assign values.

Actions

methodparamdescriptionjump
add_itemitem id, material alias(optional), level(optional), count(optional)Add the item with id to actor, default random material, auto level, and count of 1always
equip_itemitem id, material alias(optional), level(optional)Equip the item with id on actor, default random material, auto levelalways
join_partyMake actor join player partyalways
join_faithreligion id(optional)Make actor join the specific religion with id or leave the current religion with empty valueif success
apply_conditioncondition alias, powerApply a condition with id to actor, default power 100always
cure_conditioncondition aliasCure the condition on actorif cured
remove_conditioncondition aliasRemove the condition on actoralways
build_extassembly partial nameAttempt to add static methods from assembly to drama expansion tableif success
emit_callext.methodInvoke an external static methodalways

build_ext and emit_call requires the CWL configuration value Dialog.ExpandedActionsAllowExternal set to true, enabled by default.

Scene Play

methodparamdescriptionjump
move_next_tocharacter idMove actor next to character with id on the same mapalways
move_tilex, yMove actor with relative tile offset, such as 1, 1 or 2, -1always
move_zonezone id, level(optional)Move actor to a specific zone with id, and specific level, default 0always
play_animeanime idPlay animation on actoralways
play_effecteffect idPlay effect on actoralways
play_emoteemote idPlay emote on actoralways
play_screen_effectscreen effect idPlay screen effectalways
pop_texttextPop a text bubble above actor headalways
portrait_setportrait id(optional)Set actor portrait in dialog to the specific one or reset with empty value, from Portrait folder, e.g. UN_myChara_happy.png could be set with happy or UN_myChara_happyalways
show_bookbook id, category(Book or Scroll)Open a book, supports LangMod/**/Text folder, for example Text/Book/ok.txt would use (ok, Book)If success

Modifications

methodparamdescriptionjump
mod_affinityvalue expressionModify actor affinity with value expressionif success
mod_currencycurrency type, value expressionModify actor currency with value expression. money money2 plat medal influence casino_coin ecopoalways
mod_elementelement alias, power(optional)Modifies a specified element (feat/resistance/skill, etc.) for the actor, default power 1. Different types of elements use different power scalingalways
mod_element_expelement alias, value expressionModifies the exp of a specified element for the actorIf success
mod_famevalue expressionModify player fame with value expressionalways
mod_flagflag, value expressionModify the flag value from actor with value expression, such as +1, =1, 0. This supports non player characteralways
mod_keyitemkeyitem alias, value expression(optional)Modify player's keyitem value with expression, default =1if success

Conditions

These are still expansion methods that uses invoke* action same as above, but their return value is important.

methodparamdescriptionjump
if_affinityvalue expressionCheck actor affinity with expression, such as <5, >=90, !=0if satisfies
if_conditioncondition aliasCheck if actor has active condition with aliasif active
if_currencycurrency type, value expressionCheck actor currency with value expression. money money2 plat medal influence casino_coin ecopoif satisfies
if_elementelement alias, value expressionCheck actor element with expressionif satisfies
if_faithreligion id, reward rank(optional)Check if actor is certain religion and above reward rank, default >0if satisfies
if_famevalue expressionCheck player's fame with value expressionif satisfies
if_flagflag name, value expressionCheck actor flag value with expression, such as =5, 1, !=0if satisfies
if_keyitemkeyitem alias, value expression(optional)Check if player has keyitem with expression, default >0if satisfies
if_racerace idCheck if actor is of certain raceif satisfies
if_tagtagCheck if actor has certain tag defined in Chara rowif defined
if_zonezone id, level(optional)Check if actor is in certain zone and optionally check levelif present

There are 3 special composite conditions where you put the above condition as parameter:

methodexamplejump
andand(if_flag(flag1, >0), if_flag(flag2, <0))If all satisfies
oror(if_race(lich), if_race(snail))If any satisfies
notnot(if_zone(dungeon), if_zone(field), if_zone(underground))If none satisfies

if_flag or hasFlag?

hasFlag in if column is a static condition, which only gets evaluated once on drama load, which means your flag value changes later won't reflect unless using reload action or reopening the drama. CWL's if_flag() expansion condition is dynamic and can be used for branching.

Implementing Your Own

CWL offers easy API to add expansion methods in your own script DLL, without even needing to reference CWL's script assembly.