Util
90 functions
- Util_AddMouseoverSquadToSGroupIf there's a squad under the mouse cursor, this adds it to a unique SGroup. Return value is the SGroup it was added to, or nil if there was no squad under the mouse cursor. Pass in true for 'clearGroup' to clear the sgroup before adding the squad.
- Util_ApplyModifierApplies any modifier to the target SGroup, EGroup, or Player
- Util_AutoAmbientAuto-generate an Ambient Event. These are Low priority, and will hopefully interrupt nothing.
- Util_AutoIntelAuto-generate an Intel Event. These are medium priority, and will interrupt ambient, but not an NIS.
- Util_AutoNISlet
- Util_AutoSaveAutomatically save the game for the player. The savegame name is built using the abbreviated mission name + checkpoint. You can optionally have it wait until the player is out of combat.
- Util_BindFunction
- Util_Clamp
- Util_ClearWrecksFromMarkerClears vehicle wrecks from a given area.
- Util_ComparisonHelper function to process comparisons that use the Comparison enum... i.e. return true if value1 IS_LESS_THAN value2
- Util_CreateEntitiesCreates a given number of entities at a location and adds them to an egroup. A PlayerID of nil will create the entities as world objects.
- Util_CreateSquads
- Util_DespawnAllReSpawns or DeSpawns sgroups (and egroups) for all players or the indicated player.
- Util_DifVarTakes in a table and chooses the right variable for the difficulty setting. 1-4 elements. Acquires current difficulty by default.
- Util_DotProductRadiansReturns the result of the dot product of two items in radians
- Util_DriftNIS
- Util_ElementCanSeeReturns true if a Player/Team can see any or all of an SGroup/Squad/EGroup/Entity/Position/Marker
- Util_EnterCinematicModeEnters Cinematic mode
- Util_EntityLimitChecks the entity count for the world and returns true or false depending on the result. A specific value can be passed in to override the default amount.
- Util_ExitCinematicModeExits Cinematic mode
- Util_FallBackToGarrisonBuildingTry to garrison a loadable building within radius that is closer to the first squad of the sgroup than enemy
- Util_FindHiddenItemFinds a hidden position based on what the local player can and can't see
- Util_FindHiddenSpawnFollowing a path from origin to destination, finds the HS_CLOSEST/HS_FURTHEST hidden position to/from the destination
- Util_FindVisibleSpawnFollowing a path from origin to destination, finds the HS_CLOSEST/HS_FURTHEST visible position to/from the destination
- Util_ForceRetreatAllForces all squads given to retreat, regardless of whether they are on team weapons or not. Disables aiEncounters input (true disables all encounters).
- Util_FullscreenModeEnters Fullscreen mode
- Util_GarrisonNearbyBuildingFinds a nearby building to garrison. can ignore occupied [friendly] buildings. return ID of entity it found, or nil if not found
- Util_GarrisonNearbyVehicleFinds a nearby vehicle to garrison. can ignore occupied [friendly] vehicles. return ID of vehicle it found, or nil if not found,
- Util_GetAngleDifferenceReturns the angle (in degrees) between two items
- Util_GetClosestMarkerReturns the closest MarkerID to the entity/marker/pos/egroup/sgroup/squad from the table of markers provided
- Util_GetCommandLineArgumentWrapper function for command line arguments. DO NOT USE MORE THAN ONCE PER ARGUMENT.
- Util_GetCompareRandomNumberGeneratedReturns if the random number generated succeeds the comparison with the supplied value
- Util_GetDirectionReturns the heading of an item.
- Util_GetDirectionFromAtoBReturns the direction heading from point a towards point b
- Util_GetDistanceReturns the distance between two objects
- Util_GetDistanceSquaredReturns the _squared_ distance between two objects
- Util_GetEntitiesByBPFind all the entities with a given blueprint in sourcegroup and add them to destgroup.
- Util_GetFacingFromDirectionConverts a direction into a facing.
- Util_GetHealthDetermines the health percentage of a given object
- Util_GetHealthMax
- Util_GetHealthPercentage
- Util_GetMouseoverSGroupReturns a unique SGroup used to hold mouseover squads obtained from Util_AddMouseoverSquadToSGroup
- Util_GetOffsetPositionReturns a position relative to a entity/squad/egroup/sgroup/marker/position's current position and orientation.
- Util_GetPlayerOwnerReturns the player owner for any of: entity, squad, egroup, sgroup, player. for groups, the first item is used. Returns nil for world owned or empty groups
- Util_GetPositionReturns a position from entity/marker/pos/egroup/sgroup/squad
- Util_GetPositionAwayFromPlayerReturns a random position within an area that is not near a player
- Util_GetPositionFromAtoBReturns a position that is distance metres from point A, headed in the direction of point B.
- Util_GetRandomHiddenPositionFinds a hidden position based on what the local player can and can't see
- Util_GetRandomPositionReturns a random position either within the marker's proximity or with a pos and range provided. Range is ignored for rectangular markers
- Util_GetRelationshipGets the relationship between two of: entity, squad, egroup, sgroup, player. for groups, the first item is used. returns R_ENEMY, R_ALLY, R_NEUTRAL, R_UNDEFINED, or nil (if world owned or invalid parameters)
- Util_GetRelativeOffsetReturns a relative offset position to an element
- Util_GetSquadsByBPFind all the squads with a given blueprint in sourcegroup and add them to destgroup.
- Util_GetTrailingNumberReturns trailing numbers from a string, if it exists, nil otherwise. E.G. \"marker23\" would return 23.
- Util_GrabGrabs the selected squads/entities and returns them in a group. Only works with -dev.
- Util_HasPositionReturns true if given entity/marker/pos/egroup/sgroup/squad has a position; if false, Util_GetPosition will fail.
- Util_HidePlayerForNISHides all of a player's squads and/or buildings
- Util_IsAliveDetermines the object is alive
- Util_IsCinematicModeReturns whether cinematic mode is active
- Util_IsSequenceSkippedReturns whether the currently running sequence has been skipped
- Util_KillKills a given object
- Util_LogSyncWpnTracks a syncweapon ID and destroys it (by default) or makes it uncapturable (if kill is set to false)
- Util_MarkerFXPlay an events file at a given markers location
- Util_MissionTitlePlay the mission title fade.
- Util_NewHUDFeatureEventCalls UI_NewHUDFeature() as an IntelEvent. Will get queued as any other event. See UI_NewHUDFeature() for parameter details.
- Util_NormalModeEnters Normal mode
- Util_PlayMoviePlay a movie.
- Util_PlayMusicPlays music from the Data:Sound folder, and stores the music track so it can be resumed after a save/load
- Util_PrintObjectPrints out the entire contents of an Object
- Util_PrintTableSimply prints out everything in a table including nested tables
- Util_Quicksave
- Util_ReloadScriptReloads the running scar script. Current running rules would also be updated to the redefined functioin.
- Util_RestoreMusicResumes playing the music track that was last triggered i.e. after a save/load
- Util_ReverseList
- Util_ScarPosConverts a 2D top down position to a 3D ScarPosition. returns Position, if y-height is nil, y-height = ground height, terrain ground or walkable
- Util_SetPlayerCanSkipSequenceSets it so that a player can skip a scripted sequence. When the skip key is pressed, calls back the given function as a post-sequence setup. noFadeIn stops the system from fading back into gameplay when finished. Call Util_SetPlayerUnableToSkipSequence() when the sequence is finished to disable
- Util_SetPlayerOwnerSets the player owner for an entity, squad, egroup or sgroup. Also sets player owner of whatever is garrisoned inside them
- Util_SetPlayerUnableToSkipSequenceDisables Util_SetPlayerCanSkipSequence
- Util_SetStateModelTarget
- Util_SGroupAdd
- Util_SortPositionsByClosestReturns a table of positions sorted from closest to furthest (or furthes to closest if reverse is true) from the origin
- Util_StartAmbientPlay a Speech Ambient. These are the lowest priority, and will be bumped by Intel Events or NIS's.
- Util_StartIntelPlay an Intel Event. These are medium priority, and will interrupt a ambient, but not an NIS.
- Util_StartNISPlays an NIS. The NIS should have a call to NIS_START(details) at the beginning, and NIS_END() at the end.
- Util_StartNisletPlay Nislet Event. Starts a Nislet event, and calls back a function for post-nislet setup if the Nislet is skipped. noFadeIn stops the system from fading back into gameplay when the player skips
- Util_StartQuickIntelPlay a quick, one-line Intel event. These are medium priority, and will interrupt ambient, but not an NIS.
- Util_StringSplitSplits a string into a table of substrings based on a given separator.
- Util_TableContainsChecks the first layer of a table and looks for a specified Object, returns true if found.
- Util_ToggleAllowIntelEventsDebug function used to toggle whether or not IntelEvents are played. Only works with -dev parameter
- Util_TriggerEventLibrary function to trigger NIS event under a certain sets of conditions. NOTE: if checking against a marker DO NOT specify a range. The range of the marker set in the WorldBuilder will be used.
- Util_UnitCountsReturns a table containing either the total or a specific player's squad count, entity count, and vehicle count.