Post by eternity on Jun 4, 2018 15:26:58 GMT
Note that although this list shows the underlying .qed opcode number, the opcode number is not needed in the X2QS language, as you will only use the condition/action name.
Also note, that although generally this list could be used as a .qed documentation, the X2QS lang internally changes a few things (for example, it applies reverse boolean logic in a couple of cases, where 0 is true, and 1 is false, of course the compiler will write things as the game expect them once it creates the .qed file. When writing the quest, you don't need to be aware of these internal details, this warning is only for those that want to use this list as .qed documentation.)
This is the conditions list. For the actions list, go here
Never (opcode 0)
Description: this condition evaluates always to false, so any action this Event may have will never be executed.Params: none.
Notes: the game seem to use this in some negative Event. They are probably Event that were dummied by devs on purpose or by their tools.
Always, Always_, Always__, and Always___ (opcodes 1, 29, 31 and 39 respectively)
Description: All these conditions evaluate always to true. Params: none.
Notes: Strictly speaking, the real "Always" is Always. The other are likely debug conditions that were dummied in the release version of the executable. To avoid any potential problem with future game updates, use the opcode Always, and forget about the other three.
Unk2 (opcode 2)
Description: Unknown purpose condition. Param 1: stage (stage code, stage id or X2mMod object; a negative number is allowed)
Notes: the only vanilla quest that uses this is TPQ_06_01, and it uses -1 on the stage param...
Ko (opcode 3)
Description: it evaluates to true if the character specified is ko'd.Param 1: a QmlChar object.
Param 2: a boolean with unknown purpose.
Param 3: an integer with unknown purpose.
TimeWithinState (opcode 4)
Description: it evalutes to true when the specified amount of time has elapsed since the current script State started.Param 1: time in seconds (float)
IsDemoLoadCompleted (opcode 5)
Description: it evalutes to true when a demo previously loaded with action LoadDemo has finished loading.Params: none.
Notes: internal game name for this is IsSceneInitCompleted, but my name is less confusing.
DemoPlayEnded (opcode 6)
Description: it evaluates to true when a demo previously played with PlayDemo has finished playing. (either normally or by the player skiping it).Params: none.
FadeCompleted (opcode 7)
Description: it evaluates to true when a fade started with actions FadeIn or FadeOut has finished.Param 1: fade in boolean. If true, it waits for fade in completion. If false, it waits for fade out completion.
TimePassed (opcode 8)
Description: it evaluates to true when the time elapsed since the quest started is >= or <= than the specified amount.Param 1: conditional operator (only >= and <= are allowed).
Param 2: the time in seconds (float).
Health (opcode 9)
Description: it evalutes to true when the health of the specified char is >= or <= than the specified percent.Param 1: conditional operator (only >= and <= are allowed)
Param 2: a QmlChar object.
Param 3: percent of total health (float)
Unk10 and Unk13 (opcodes 10 and 13)
Description: condition of unknown purpose.Param 1: cms (can be cms 3-letter code, cms numeric id, or a X2mMod object)
Param 2: an integer with unknown purpose.
Param 3: an integer with unknown purpose.
Param 4: an integer with unknown purpose.
Notes: Unk10 and Unk13 are internally the same game condition. They only differ in the opcode number.
InStage (opcode 11)
Description: it checks if the specified char is in the specified stage.
Param 1: the char to check (a QmlChar object)
Param 2: stage (stage code, id or X2mMod object)
Param 3: boolean with unknown purpose. If this parameter is true, the game does an additional unknown check.
RandomPercentSmallerThan (opcode 12)
Description: it compares a random number between 0-99 with the specified number. If the random number is smaller than the specified number, the condition will evaluate to true.
Param 1: integer to compare the random number to. A value >= 100 will make the condition equivalent to Always. A value <= -1 will make the condition equivalent to Never.
Notes: the random number used by this function is pre-generated for the current Script State. What does that mean? That means that if multiple events in the same State use this condition, all of them will be checking the same random number.
Example usage:
Script
{
; Zero or more State here
State 5
{
Event 0
{
Condition RandomPercentSmallerThan(25)
; Put some actions here. The actions here will have a 25% of probabilities of running
Action GotoState(--put state to go here---); Leave current state so that the other percent checks in this state won't trigger.
}
Event 1
{
Condition RandomPercentSmallerThan(80)
; Put some actions here. The actions here will have a 55% of probabilities of running (80-25)
Action GotoState(--put state to go here--); Leave current state so that the other percent checks in this state won't trigger.
}
Event 2
{
Condition RandomPercentSmallerThan(100)
; Put some actions here. The actions here will have a 20% of probabilities of running (100-80=
Action GotoState(--put state to go here--); Leave current state so that the other percent checks in this state won't trigger.
}
}
; Zero or more State here
}
PlayerHealth (opcode 16)
Description: it evaluates to true if the player character health is >= or <= than the specified amount.
Param 1: conditional operator (only >= and <= allowed)
Param 2: percentage of total health (float)
TeamHealth (opcode 17)
Description: it evaluates to true if a whole team percentage health is >= or <= than the specified amount.
Param 1: conditional operator (only >= and <= allowed)
Param 2: the team. One of the following constants allowed: PLAYER_TEAM, PLAYER_TEAM2, ENEMY_TEAM (the difference between PLAYER_TEAM and PLAYER_TEAM2 is not very clear atm, but a theory suggests that PLAYER_TEAM only checks human controlled players, and PLAYER_TEAM2 includes ai ones). Usually, you will be using PLAYER_TEAM2 if you want to monitorize player team health.
Param 3: percentage of the sum of total healths of all chars in the team.
ClearScreenClosed (opcode 19)
Description: it evaluates to true after the player closes the quest results screen.
Params: none
CheckFlag (opcode 20)
Description: it evaluates to true if the specified Flag variable equals the specified boolean value.
Param 1: the flag variable (must be declared before the first script, check action SetFlag for example)
Param 2: the value to check (boolean)
PlayerRaceIs (opcode 21)
Description: it evaluates to true if the player character race and sex are the specified ones.
Param 1: a race constant. Valid values: HUMAN, SAIYAN, FRIEZA, MAJIN, NAMEKIAN and ANY. If ANY, only the sex check is done.
Param 2: a sex constant. MALE, FEMALE or ANY. If ANY, only the race check is done.
Notes: surprisingly, the function works with roster characters. E.g, PlayerRaceIs(SAIYAN, MALE) will return true for Goku, etc.
However two things about this: 1) Some vanilla chars like Zarbon return Saiyan, and Champa return human (!?). 2) We don't know where the game stores the info of race/sex for roster chars, so it is unlikley that it would work properly for modded chars.
TLDR; When possible, use this only when you expect the character to be a cac.
NumHumanPlayers (opcode 22)
Description: it evaluates to true if the number of human players (not controlled by AI) is >= or <= the specified value.
Param 1: conditional operator (only >= and <= allowed)
Param 2: the number to compare with (an integer)
Notes: Condition NumHumanPlayers(>=, 2) can only evaluate to true if the quest is being run online.
UseSkill (opcode 24)
Description: it evaluates to true when the specified char uses the specified skill.
Param 1: the char (a QmlChar object)
Param 2: the skill. Skill ID1 (not id2!), skill string code (not recommeded for skills), or X2mMod object.
HitWithSkill (opcode 25)
Description: it evaluates to true when the specified char has been hit with the specified skill.
Param 1: the char that is hit (the victim). A QmlChar object.
Param 2: the skill. Skill ID1 (not id2!), skill string code (not recommeded for skills), or X2mMod object.
KoWithSkill (opcode 26)
Description: evaluates to true if the specified char has been ko'd with the specified skill.
Param 1: the victim (a QmlChar object)
Param 2: the skill. Skill ID1 (not id2!), skill string code (not recommeded for skills), or X2mMod object. Apparently, if an awaken skill is set here, the condition seem to evaluate to true if the killer was transformed with that skill.
DialogueFinish (opcode 27)
Description: it evaluates to true when the specified dialogue has finished playing.
Param 1: the dialogue (a Dialogue object)
NumCharsDefeated (opcode 28)
Description: it evaluates to true when the number of characters from the specified team that have been defeated in the specified stage is >= than the specied amount.
Param 1: The number of chars to check for (>= will evaluate to true).
Param 2: Team type. Either PLAYER_TEAM or ENEMY_TEAM constant. Unlike in other places, PLAYER_TEAM2 constant can't be used here, as PLAYER_TEAM already includes all the allies for this action.
Param 3: the stage. Stage code, id or X2mMod object.
Notes: for enemy team, the condition to seem to work as intended and it will triger when the number of enemies defeated is >= than param1. But for player team, it looks like the condition is actually >= (param-1)? (at least when there are Player2, Player3, etc, maybe it works ok with quest specific allies).
IsFighting (opcode 30)
Description: it evaluates to true when the specified character is fighting.
Param 1: a QmlChar object.
Notes: a typical usage of this condition by vanilla quests is to set up an initial char dialogue. Possibly, the function doesn't evaluate to true until the char has chosen a target? This function works with both, allies and enemies.
IsAlive (opcode 32)
Description: it evalutes to true if the specified character is alive. This condition will evaluate to true on chars that are not spawned yet and never were ko'd.
Param 1: a QmlChar object.
Notes: a typical usage of this condition by vanilla quests is being checked before playing a dialogue, because no one wants a corpse or a removed character to talk.
Removed (opcode 33)
Description: it evaluates to true when the specified character gets removed. On chars that get removed on ko, this would happen a bit later than Ko event.
Param 1: a QmlChar object.
Notes: it is easy to mistake this with Ko condition, but remember that this one will evaluate always to false in chars that don't auto remove on ko: like party players (Player, Player2, etc), and chars that had the action "DontRemoveOnKo" called on them.
BevPlayCompleted (opcode 34)
Description: it evaluates to true when the bev started with PlayBev has completed.
Params: none.
Notes: because the scene played with PlayScene are also from bev nature (from a common bev file), there is a possibility that this condition could wait for those too. However, this hasn't been confirmed and such usage has not been detected in vanilla quests.
FightStartedWithChar (opcode 35)
Description: it evaluates to true if the player (or maybe the player team?) has started a fight againt this char.
Param 1: the char (a QmlChar object)
ObjectsPicked (opcode 36)
Descirption: it evaluates to true when the specified number of objects have been picked from the ground (those objects you can see with the scouter)
Param 1: integer of unknown purpose, only -1 was seen in vanilla quests. There are a lot of probabilities that this and Param 2 are both item_type+item_id (in unknown order) and that -1 acts as "Anything".
Param 2: integer of unknown purpose, only -1 was seen in vanilla quests. There are a lot of probabilities that this and Param 1 are both item_type+item_id (in unknown order) and that -1 acts as "Anything".
Param 3: the number of objects to check.
Example usage: Condition ObjectsPicked(-1, -1, 3); Will evaluate to true when the player (or maybe player team) picked 3 objects from the ground.
CarriesDragonBalls (opcode 37)
Descirption: it evaluates to true when the specified character is carrying a dragon ball (or two, I guess).
Param 1: the char (QmlChar object)
Param 2: an integer that is unused by game code.
DragonBallsSent (opcode 38)
Description: it evaluates to true when the specified number of dragon balls have been sent to the time machine.
Param 1: the number of balls to check for (integer)
Param 2: an integer that is unused by game code.
IsBevLoadCompleted (opcode 40)
Description: it evaluates to true when a bev loaded with LoadBev has finished load and is ready to be played.
Params: none
EventDone (opcode 42)
Description: it evaluates to true if the specified event, in the specified state, in the specified script has been done.
Param 1: the script index. This is 0, for your first script, 1 for the second (if any), etc
Param 2: the state number.
Param 3: the event number.
Unk43 (opcode 43)
Description: condition with unknown purpose. It is possible that it evaluates to true if the specified battle_index slot or maybe mob_index slot is free to be used by the game (so that a character can be loaded).
Param 1: an integer, that is likely to be either a battle_index (range 0-6) or mob_index (range 0-13)
Notes: the only vanilla quest using this is TMQ_0506.
IsQuestFinished and IsQuestUnfinished (opcodes 44 and 45 respectively)
Description: these functions perform the opposite action. IsQuestFinished evaluates to true if the specified quest has been finished at least once (either complete or ultimate, it doesn't matter). And IsQuestUnfinished... the opposite.
Param 1: the quest. Quest code or X2mMod object. The quest type must match the type of the quest using this.
Example usage: (example asumes that this quest is called TMQ_MYTEST)
TextEntry NotCompleted
{
en: "You haven't yet completed this quest!"
}
TextEntry Completed
{
en: "You already completed this quest before."
}
Script
{
State 0
{
Event 0
{
Condition IsQuestFinished("TMQ_MYTEST")
Action ShowTip(Completed, true)
}
Event 1
{
Condition IsQuestUnfinished("TMQ_MYTEST")
Action ShowTip(NotCompleted, true)
}
}
}
TimeInDemo (opcode 46)
Description: evaluates to true when the time elapsed since a demo started playing is >= than the specified amount.
Param 1: time in miliseconds. (integer)
TeamCarriesDragonBalls (opcode 47)
Description: a version of CarriesDragonBalls that check for a whole team instead of a char. It evaluates to true when the specified group carries one or more dragon balls.
Param 1: the team. One of the following constants: PLAYER_TEAM, PLAYER_TEAM2, or ENEMY_TEAM (see TeamHealth description for a possible difference between PLAYER_TEAM and PLAYER_TEAM2)
Param 2: an integer that is unused by game code.
RemainingTime (opcode 48)
Description: it evaluates to true when the remaining time in the quest is >= or <= than the specified amount.
Param 1: conditional operator (only >= and <= can be used).
Param 2: time in seconds (float).
ReviveCheck (opcode 49)
Description: it evaluates to true when the specified character gets revived by an ally.
Param 1: the char to check (a QmlChar object)
Notes: the name used here matches the one used by game devs.
DetectedWithScouter (opcode 50)
Description: it evaluates to true when the specified character has been detected by the player using the scouter.
Param 1: the char to detect (a QmlChar object)
ComboSuccess (opcode 51)
Description: it evaluates to true when the combo set up by Action ShowComboAndListen has been performed successfully.
Params: none.
ActionDone (opcode 53)
Description: it evaluate to true when the specified action is performed by the player (actions like jumping, guard, etc, take a look at sample in Action ListenForAction in the actions page). Usually called after a ListenForAction was called, but see Notes.
Param 1: the action (integer). Look at decompiled CHQ_0100 to find out several of thems.
Param 2: integer with unknown purpose.
Param 3: integer with unknown purpose.
Param 4: integer with unknown purpose.
Notes: according to my tests, the condition could work even if ListenForAction wasn't used (...). Still, I suggest to use it, it is what the game quests do.
ItemUsed (opcode 54)
Description: it evaluates to true when a battle item (capsules, etc) is used.
Param 1: integer whose purpose hasn't been confirmed but it is believed to be item id (from battle_item.idb)
Unk55 (opcode 55)
Description: condition with unknown purpose.
Param 1: a QmlChar object.
Param 2: an integer with unknown purpose. The game checks for a range 0-12, that looks like subopcode or mode.
Param 3: a boolean with unknown purpose.
TeacherDialogueFinish (opcode 56)
Description: it evaluates to true when the specified teacher dialogue (started with action TeacherDialogue) has finished playing.
Param 1: the teacher dialogue id (integer).
HealthDamageOver (opcode 57)
Description: it evaluates to true when the specified character has recieved, at least, the specified amount of health damage.
Param 1: the char (QmlChar object)
Param 2: the health damage to check, in absolute quantity (intteger).
Notes: only vanilla quest that make use of this are raids.
HCFinished (opcode 58)
Description: it evaluates to true when a Hero Colosseum game has finished.
Params: none
PartnerIs (opcode 59)
Descrption: It evaluates to true when the specified partner in an OSQ quest (Fu quest) is the specified one. It only works on OSQ quests, in other quest it always evaluates to true, regardless of who you specify in the params.
Param 1: the partner to check for. One of the following constants can be used: PARTNER_KRILLIN, PARTNER_TIEN, PARTNER_YAMCHA, PARTNER_PICCOLO, PARTNER_RADITZ, PARTNER_GOHAN_KID, PARTNER_NAPPA, PARTNER_VEGETA, PARTNER_ZARBON, PARTNER_DODORIA, PARTNER_GINYU, PARTNER_FRIEZA, PARTNER_ANDROID18, PARTNER_CELL, PARTNER_LORD_SLUG, PARTNER_MAJIN_BUU, PARTNER_MR_SATAN, PARTNER_GOHAN, PARTNER_GOTENKS, PARTNER_TURLES, PARTNER_BROLY, PARTNER_BEERUS, PARTNER_PAN, PARTNER_JACO, PARTNER_GOKU, PARTNER_WHIS, PARTNER_COOLER, PARTNER_ANDROID16, PARTNER_FUTURE_GOHAN, PARTNER_BARDOCK, PARTNER_HIT, PARTNER_BOJACK, PARTNER_ZAMASU, PARTNER_VIDEL, PARTNER_FUU.
Notes: it hasn't been tested, but it is possible that PARTNER_VIDEL doesn't work, as it's not used in any quest. Probably you would use PARTNER_GOHAN to check for both Gohan+Videl, since they are a special case (in the osq quests, they both get loaded, although in some fight you only see one of them, but that's scripted).
Unk60 (opcode 60)
Description: a condition of unknown purpose, probably related with player raid boss functionality.
Param 1: a boolean of unknown purpose.
Param 2: an integer of unknown purpose.
Param 3: an integer of unknown purpose.
Notes: This condition was added in version 1.11, and has only been seen use by the player raid boss quests (PRB_0100 and PRB_0200).
The actions below are all provided by XV2Patcher and are not available in vanilla games. They have big enough opcodes to avoid any problems with future game updates. Also, all of them start with XV2P in the name.
XV2P_IsAvatar (opcode 1000)
Description: it evaluates to true when the specified character is an avatar (a cac, time patroller, whatever you want to call it).
Param 1: the char (QmlChar object)