Actions

To learn how to use these actions, take a look at the AIScript documentation page. If the action name begins with the word If, then the action is considered a conditional action, which is discussed in the AIScript documentation.

MACTION_AddAnimatedHUDTexture

Very similar to MACTION_AddHUDTexture, but instead of simply overlaying textures, it does this, plus animates them. If done correctly, this can allow for complex notifications or camera effects.


Variables

MACTION_AddHUDTexture

Allows you to overlay an array of textures onto the screen. This can allow for simple notifications or camera effects. If you want to animate textures instead, use MACTION_AddAnimatedHUDTexture. MACTION_AddHUDTexture and MACTION_AddAnimatedHUDTexture are not compatible! Make sure you only use one at a time, since they both use the same HUD element at the current moment.

To get started, provide a texture to overlay in TextureActions.Texture, then specify where on the screen this texture should display at by assigning TextureActions.OriginType. You can overlay as many textures as you want, and can also remove specific textures by changing the ManageType and then adding textures to TextureActions.Texture to specify which textures should be removed.


Variables

MACTION_AddNotify

Adds a notify to a given pawn, allowing for tying event calls localized within the pawn class itself to be fired, when certain parts of certain animations of the pawn are played. This means that you can essentially add an event to an animation playing on the current pawn.

The game natively uses this function on pawns which need the ability to run code specifically when a part of a certain animation is played by the pawn. In order to use this action properly, you'll need to have some knowledge of how the game handles functions in actors. If you don't know how this works, you likely shouldn't mess with this. This action is most helpful when you have directly modified the code of a certain pawn, but can also be used on existing pawns to add some new logic, provided that the function you want already exists within the pawn.

Notice: Adding a notify is PERMANENT until the game is closed!


Variables

Keywords

MACTION_Announce

The all-in-one action for announcing text onto the screen. Announcing text onto the screen will appear as centered text shown on the center of the game's screen. Text can also represent some sort of data from an actor in the current map via a ReplacePhrase.


Variables

MACTION_AttachPawnToBone

Attaches a provided pawn to a provided pawn's bone, or detaches it depending on the options picked. A pawn only has a bone if it is being displayed via a Mesh (you can check whether it is by checking its property window and checking the DrawType in the Display tab).

To check what the name of the bone that you want to attach to is named, you'll need to open up the level editor, then open the animation browser, then locate your mesh. Once you've found your mesh, click the icon at the top left corner of the browser that is right of the blue box icon. Then, once you clicked that, click the next button right of that one. If you did this correctly, you should be able to see the names of every bone.


Variables

Keywords

MACTION_BouncePawnTo

Bounces a pawn to a specified point, just like how a bounce pad would.


Variables

Keywords

MACTION_CameraFlyTo

Emulates FlyTo and/or TargetFlyTo from CutScript. Comes with all original customization, plus more!

Most options have 2 values that can be given. Value 1 is for FlyTo, and value 2 is for TargetFlyTo. This allows you to configure both a FlyTo and a TargetFlyTo within the same action.

It's not recommended to use this in order to make an elaborate camera movement happen; you should always use CutScript for complex camera movements.


Variables

Keywords

MACTION_ChangeCondition

Takes a specified condition and sets its condition to either true or false. Also comes with the option to toggle the condition if you need that instead.


Variables

MACTION_ChangeLevel

An all-in-one action that provides the best way to change to a different level. Can customize whether the loading image shows, what the new game state should be, whether to fade the screen out (as well as what color, fade time, etc.), whether to fade out the music, whether to travel the inventory and how long it should take before a level transition actually occurs.


Variables

MACTION_ChangeRunSpeed

A simple action that allows you to change the run speed of a given pawn. The reason this is helpful is because the game has a hacky method of modifying a pawn's run speed, so this simplifies that process of changing the pawn's run speed massively. Simply provide a pawn and the new run speed to change the pawns running speed!


Variables

Keywords

MACTION_ChangeSkin

Changes the skin of a provided actor to something else. By changing the skin of an actor, you change the textures that it references when the actor displays its textures. You can optionally change the skin back to its default, if you wish to undo any skin changes you've made.


Variables

Keywords

MACTION_ChangeState

Changes the state of a provided actor to something else.


Variables

Keywords

MACTION_Debug

An essential action for any developmental work. This action is typically used for quickly announcing or logging text, and should not be used for officially-released projects. The text/comment supports replace phrases (done with TransferProp), which allows you to replace a phrase seen in the comment with data obtained from a TransferProp, which can be very helpful for debugging how certain aspects of a mod/map function more easily.


Variables

MACTION_DeleteSaveGame

Attempts to delete a save game. In the case that the game is currently playing off of that save game, then the Windows operating system will not allow the game to delete the save game.


Variables

Keywords

MACTION_DeliverLocalizedDialog

Plays a dialog from a pawn with automatic subtitles. Can be heavily customized.


Variables

MACTION_DestroyActors

Locates the specified actors, then destroys them. The method in which they are destroyed can be configured.


Variables

MACTION_DropCarryingActor

Finds the specified pawn, then drops the currently held actor (or instantly destroys if needed). This is used for when it's needed to force a pawn to drop an actor they're holding. Keep in mind that by doing this, you may cause the dropped actor to get stuck on top of the pawn's head, which could cause further issues.


Variables

Keywords

MACTION_EnemyRunAway

Makes any specified enemies run away. This is typically used when a cutscene occurs in order to prevent certain enemies from interacting with the cutscene pawns.


Variables

MACTION_FadeActor

Fades an actor to a new color and/or opacity. Can be given a fade time, fade type, a color and can be destroyed when done. To reset the fade values of an actor, set the color to (A=255,R=127,G=127,B=127).


Variables

Keywords

MACTION_FadeView

Fades the screen. Can be given a fade time, fade type, a color and can make it flash. To reset the fade values of the screen, set A=0 in ScreenColor.

Notice: any sort of screen fades can overwrite other screen fades (including cutscene fades). You should keep this in mind when considering whether or not you can actually do a screen fade without running into issues.


Variables

MACTION_FollowPawn

Makes a pawn start or stop following another pawn. A maximum of 2 pawns can follow a leader, but you can assign followers to followers.


Variables

Keywords

MACTION_ForceAction

Makes the specified pawn run a certain action. All actions follow game rules unless specified otherwise (they won't work if the typical conditions are not true). The only action types that require a pawn to be specified are those which are not considered global, such as a Cutscene Skip or a Pause Menu.


Variables

Keywords

ActionType Exception List:

MACTION_GotoMenu

Goes to a specified menu, or closes a menu. The menu name should be formatted as such: Package.Class (Example: KWGame.KWPageFrontEnd). In the ActionType variable, there are 2 options that look very similar, those being AT_CloseMenu and AT_CloseAllMenus. AT_CloseMenu closes the most recent menu, and AT_CloseAllMenus closes every currently-opened menu. This can be helpful if you're overlapping menus on top of each other. The other 3 variables provided in OpenMenuVars are additional native variables that can be provided, but they are, for the most part, un-helpful.


Variables

MACTION_IfActorExists

Returns true if the specified actor exists in the current map and fits the ExistType condition.


Variables

ExistType Descriptions

MACTION_IfActorInRange

Returns true if the specified actor is within range of another specified actor.


Variables

ConditionType Descriptions

Keywords

MACTION_IfActorTouching

Returns true if the specified actor is touching another specified actor.


Variables

ConditionType Descriptions

Keywords

MACTION_IfCanSeeActor

Returns true if an actor can currently be seen by the current player's camera.


Variables

MACTION_IfComplexRandomPct

Similar to ACTION_IfRandomPct, but supports more than 2 outcomes and comes with weighted odds as an option. The method in which this action can allow for multiple outcomes is by having each random action number act like ACTION_GotoAction. No outcome will result in the action returning false due to the nature of this action, meaning there's no reason to add an ACTION_EndSection in the AIScript.


Variables

MACTION_IfCounter

Returns false until the action has been run iNumToCount times, at which point, will always return true. This action, in a way, emulates a Counter actor. In contrast with the original Counter, you can count beyond 255 times, can randomize the amount of times it counts and can (technically) reset the counter.


Variables

MACTION_IfCurrentLevelTime

Returns true if the amount of time passed in the current level has surpassed the amount of expected elapsed time (condition can optionally be inverted). It's important to mention that the level time value gets saved, so if you load a save, the level time value will go back to how much time had originally elapsed.


Variables

MACTION_IfCurrentMap

Returns true if the current map is expected.


Variables

MACTION_IfCurrentMusic

Returns true if the game is currently playing an expected music track. If music is completely muted, then this will always return false, regardless if a music track would otherwise be playing.


Variables

MACTION_IfCurrentPlayer

Returns true if the current player has an expected tag.


Variables

MACTION_IfCurrentPlayerIsDerivedFrom

Returns true if the current player is a parent or child of the condition class. In other words, if the found actor is the same class or a sub-class of the condition class, it will return true.


Variables

MACTION_IfGameLanguage

Returns true if the game is currently using an expected language. Expected languages should be typed as they would be specified in Default.ini. Example: INT, ENG, or RUS.


Variables

MACTION_IfGameState

Returns true if the game is currently in an expected game state.


Variables

MACTION_IfGetProp

Returns true if the TransferProp (referred to as the Get) matches the condition (dependent on GetType).


Variables

Keywords

MACTION_IfHasInventoryCount

Returns true if the current player has an inventory item count of iItemCountCondition or more from the specified inventory type. It's important to mention that a majority of inventory types are not modified correctly by the original game's pickups, but MPickup's do modify these correctly.


Variables

MACTION_IfInState

Returns true if the specified actor is in a specified state.


Variables

Keywords

MACTION_IfLogicalGate

Returns true if the logic gate type returns true. You can pick from 1 of 8 different common logic gates for the condition. Takes 2 inputs, both being take from a  TriggeredCondition that is in the current map.


Variables

MACTION_IfMapExists

Returns true if an expected map is accessible (can be opened) by the game.


Variables

MACTION_IfMPakVersion

Returns true if the MPak version is expected.

Example: v6.0 (check the info MVersion in the source code to see what version of MGame you're using).


Variables

MACTION_IfObjectDetail

Returns true if the current object detail mode is expected.


Variables

MACTION_IfPlayingAtXFPS

Returns true if the game's native FPS cap equals fExpectedMaxFPS.


Variables

MACTION_IfPossessedByController

Returns true if the specific actor is possessed by a specific controller. The most useful function of this action is the ability to figure out whether or not the player is in a cutscene.


Variables

Keywords

MACTION_IfSaveGameExists

Returns true if the game slot ID provided currently contains a saved game.


Variables

MACTION_IfTodayIsWithinDateRange

Returns true if the current date is within the range of dates provided. Date format expected: MM/DD/YY. If ignoring a part of the date, it's recommended to use the number 0 to replace the part of the date you wish to ignore. However, this isn't strict, and can be any number you want.


Variables

MACTION_LerpToPoint

Finds the KWPawn with the tag GetPawnTag and lerps/moves the pawn from its current point to the LerpToTarget point. Lerp in this context simply means to ease (or move) the position of a pawn from 1 location to another.


Variables

Keywords

MACTION_LocalizeData

Takes external data out of LocalizeActions.Localize.FileName and transfers that data to an actor (through SetProp). If the filename contains \\, you can read from a directory starting from ..\\System\\. An example of reading inside a folder: Cutscenes\\BeanStalkBonus_Intro will open the cutscene file BeanStalkBonus_Intro.int. Since these files are localization files, the data file it reads can be different, if the game's language is different. For instance, the game language INT (International) is the default language if you're playing on the English version of the game. This is essential for any sort of external resource management.

To understand how to use this action, you'll need to understand what a SectionName, Key, and FileName is. The easiest one is FileName, which is simply the name of the file you're trying to read from. Next, let's read the example below:

[CharInfo]

BBS=Bandit_Boss

BGY=Bored_Guy

BND=Bandit

DNK=Donkey

ELF=Elf


In this example, I've shown a part of the file GameData.int, which you can find in the game's System directory. Take note of the [] at the top of the file. When text is put in between brackets, this means the text is being classified as the name of this section. This means that the SectionName in this case equals CharInfo. Lastly, the Key. The Key is going to equal a line that is underneath the section. Examples: BBS, BGY, BND, DNK, and ELF are all Key's.

With this all being accounted for, how do we actually use this action? Let's say we wanted to get the string Bandit_Boss out of this particular example file. The SectionName would need to equal CharInfo, the Key would equal BBS, and FileName would need to equal GameData, since that's the file we're accessing with this function. If we ran this action with those provided values for the variables (with SetProp setup correctly), we would get the string Bandit_Boss SetProp'ed onto the actor of our choosing. Now you should understand how you can use this action!


Variables

MACTION_LockCamTo

Locks or unlocks the player's camera to a specific point, just like cutscenes can. Stopping the LockCamTo is as simple as setting bLock=false and providing the actor that is currently being locked onto.


Variables

MACTION_ManageAntiCheat

Manages M.A.C. (Master's Anti-Cheat) to change whether it's on or off. If M.A.C. is not placed in the current level, then it will be spawned in with the default settings.


Variables

MACTION_ManageCameraEffects

Allows you to manage the current camera effects the current player's camera should be using. The camera effects feature is pretty unfinished overall and can't be improved any further, and it has a tendency of causing crashes. While this action tries to avoid crashing, there can be no guarantees. It's recommended to use MACTION_AddHUDTexture for the most part, since it has no risk of crashing. You should realistically only use this action for toggling motion blur.


Variables

MACTION_ManageCameraSettings

Manages the current camera settings. To modify a certain variable within the camera, first, head over into the CamChanges.CamChangesToApply variable, then toggle any of the variables in there. When you set them to true, you enable the ability for you to modify the individual variable. Out of the box, no camera variables will be modified, until they have been explicitly enabled by you. This means you have to specify which variables will be changed. For example, if we modified CamChanges.CamChangesToApply.bApply_vLookAtOffset=true, this makes it so that the variable vLookAtOffset changes the value of vLookAtOffset from within the current player's camera.

Additionally, most settings can be defaulted by setting CamChanges.CamChangesToApply.bDefaultAllApplications=true and then toggling which variables you want defaulted, just like you would normally (as previously explained). They can all also be randomized, in case you need the value to be randomized for some purpose. To enable randomization for a specific variable, just like how we toggled on certain variables, you have to toggle certain variables to be randomized, and then you have to specify the range of the random value afterward.



Variables

MACTION_ManageGamePausing

Allows you to enable or disable the ability to pause the game. This can cause hardlocks if the player opens up the pause menu while dying, so you need to keep that in mind when disabling pausing.


Variables

MACTION_ManageHUDItems

Loads or unloads any HUD item onto the screen, and can be configured via SetProps. Most HUD items aside from MHUDItem's will typically not persist across save-loads.


Variables

MACTION_ManageStrengthAttribute

Manages the strength attribute on a specific playable character. This is purely a visual change, so it does not actually give the playable character additional attack damage.


Variables

MACTION_ManageTimer

Manages the timer HUD, allowing you to turn on a timer visual, or to turn it off.


Variables

MACTION_OnEvent

Runs the OnEvent() function for a specified actor. Read more about OnEvent() here.


Variables

Keywords

MACTION_PawnLookAt

Makes a specified pawn look at a destination.


Variables

Keywords

MACTION_PawnTurnTo

Makes a specified pawn turn to a destination.

Notice: this doesn't work for the current player; use a cutscene for that.


Variables

Keywords

MACTION_PlayCredits

Plays the credits with a new credits system I coded, or can optionally play your own custom credits read from the map's data file.

With this new credits system comes some configuration, which is done directly in the credit's file. If you wish to configure your credits, you must provide this entire block of text:

[Settings]

fInitialPauseDelay=0.0

bSkippable=true

fCreditsScrollRate=1.0

fHorizontalOffset=0.0

sMapToOpenOnceFinished="Book_FrontEnd"

BackgroundMaterial="Storybook_TX.Interior_2"


The settings/variables above are the default settings, but you can adjust them to your liking. If you adjust any of the settings, you must provide every setting. If you're using a custom credits file from within the map's data file, you still must provide each line manually, followed by an empty space as shown above.


Variables


Settings

MACTION_PlayerConsoleCommand

Executes a player console command (a player console command is meant to refer to a PlayerController executing a console command, instead of running the function ConsoleCommand(), which is limited to have almost no useful console commands). Supports executing a random console command, getting a console command from a TransferProp, replacing phrases through TransferProp and picking a random replace phrase.


Variables

Keywords

MACTION_PlayMusic

A better version of ACTION_PlayMusic that allows you to play a song, randomly play a song or stop all songs.


Variables

MACTION_PlaySound

Plays a localized or un-localized sound. For the localized sound part of this action, you can assign any actor to be the owner of the sound.


Variables

Keywords

MACTION_PopupText

Pops up text onto the screen, just like how the PopupTrigger is somewhat capable of doing, but in a much more simple manner. Provides simple customization for a text popup that utilizes the KnowWonder subtitle system. This is a simple and effective method of displaying custom text on the screen, without announcing it in the center of the screen.


Variables

MACTION_RoundRobin

Emulates a physical RoundRobin actor that works by going through a cycle of various GotoActions. In addition to the default RoundRobin, you can also customize how many times it will loop.


Variables

MACTION_SaveLoadGame

Saves or loads a game. Simply provide a save slot ID along with whether you wish to save or load a game. Can also save or load to the current save slot.


Variables

MACTION_SaveLoadInventory

Saves or loads an inventory from global data. Simply save an inventory, then load it back any time! The inventory is considered to be everything the current player has collected, but can be adjusted by removing certain inventory types in the InventoryTypesToSave variable.


Variables

MACTION_SetFOV

Sets the current player's current FOV to a specified value. Can be added or multiplied to and can be randomized. An ease type and time can also be specified.


Variables

Keywords

MACTION_SetGameState

Sets the GameState the game is currently in. This action is arbitrarily restricted to only work for the 6 GameStates shown in KnowWonder debug menu. You can optionally run a TransferProp to make a variable on a certain actor equal the current GameState.


Variables

MACTION_SetGlobalData

Sets a value to a slot in global data.


Variables

MACTION_SetPawnGroundFriction

Sets a pawn's ground friction value. A manual ground friction change can be enabled or disabled on a per-pawn basis.


Variables

Keywords

MACTION_SetProp

Sets a variable to a specific value on a specific actor. If you're looking for extreme customization, or more documentation regarding how this action can be used, look into the action MACTION_SetPropPlus.


Variables

Keywords

MACTION_SetPropPlus

Sets a variable to a specific value on a specific actor... or does virtually anything related to this. Do be wary that if you don't know what you're doing that you likely shouldn't use this action. Also, this action is very, VERY complex and not that intuitive at the current moment. All features can be heavily customized and most options will work with each other. There is an extreme amount of customization this action has; read below to learn more.

Main Features:

Features that are outside the scope of this action:


Variables

Keywords

MACTION_ShakeView

Shakes the current player's screen with the settings provided. This is essentially a port of the ViewShaker actor, but without the need for an additional actor.


Variables

MACTION_SwitchControlTo

Switches the currently controlled player to a different player. Similar to the SCTP or SwitchControlToPawn console command, however, this supports adding a time between switches and the ability to swap the locations of both of the players. Supports randomizing the player label to switch control to.


Variables

MACTION_Teleport

Teleports an actor to a specified point. If the teleportation point is blocked, then the teleportation location is slightly adjusted to try to make it work.


Variables

Keywords

MACTION_TransferClipboard

Gets a string from the computer's clipboard, then transfers that data onto an actor.


Variables

Keywords

MACTION_TriggerRandomEvent

Triggers a random event upon being fired. If enabled, supports using weighted odds to make certain events have a higher chance of being fired.


Variables

MACTION_WaitForCutscene

Waits until all current cutscene(s) stop playing.


Variables

MACTION_WaitForEventSimple

Waits for the event with the name that is the event on the ScriptedTrigger that instigated this script. Should be typically used for a MScriptedTrigger since it has very good native support for this action. If you're using a ScriptedTrigger instead, then give the ScriptedTrigger a unique Event in order to satisfy this action's condition.

Notice: do not provide an ExternalEvent as it is pointless.

MACTION_WaitForTimer

Waits a certain amount of time before continuing the AIScript. Can be assigned a random time and can be assigned a time from a TransferProp.


Variables

Keywords