BSL:Functions: Difference between revisions

1,412 bytes added ,  19 November 2025
m
TOCfloat no longer does anything in Vector 2022
(added big warning to chr_holdkey because BWest never finished writing the code for it)
m (TOCfloat no longer does anything in Vector 2022)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{TOCfloat}}
To learn how to declare and use functions, read the BSL manual's [[BSL:Manual#Functions|Functions]] section. This page documents Oni's built-in (or "native") scripting functions. The other half of the available scripting commands are in [[BSL:Variables]].
To learn how to declare and use functions, read the BSL manual's [[BSL:Manual#Functions|Functions]] section. This page documents Oni's built-in (or "native") scripting functions. The other half of the available scripting commands are in [[BSL:Variables]].


Line 116: Line 115:
*ai2_skill_show - shows the currently selected shooting skill
*ai2_skill_show - shows the currently selected shooting skill
*ai2_spawn ai_name:string [force_spawn:string{"force"}] - creates and starts an AI from a character object - ai2_spawn ambush_striker_2
*ai2_spawn ai_name:string [force_spawn:string{"force"}] - creates and starts an AI from a character object - ai2_spawn ambush_striker_2
''Adding "force" onto the end of the ai2_spawn command tells the game that the AI should be spawned even if it's already present, allowing you to duplicate any character. This will work even if CanSpawnMultiple is not turned on in the [[XML:BINA/OBJC/CHAR|character's BINA data]].''


===chr===
===chr===
Line 128: Line 128:
*chr_animate_block [ai_name:string | script_id:int] anim_name:string [num_frames:int] [interp_frames:int] - plays an animation on a character and blocks until done - chr_animate_block 0 KONOKOlev11_cnsl_idle 300
*chr_animate_block [ai_name:string | script_id:int] anim_name:string [num_frames:int] [interp_frames:int] - plays an animation on a character and blocks until done - chr_animate_block 0 KONOKOlev11_cnsl_idle 300
*chr_boss_shield [ai_name:string | script_id:int] - turns on the boss shield for a character - chr_boss_shield OutroNinja
*chr_boss_shield [ai_name:string | script_id:int] - turns on the boss shield for a character - chr_boss_shield OutroNinja
''See [[Shields]] for a definition of "boss shield".''
''See [[Boss shield]] for details.''
*chr_changeteam [ai_name:string | script_id:int] team_name:string - changes a character's team - chr_changeteam guard1 Syndicate
*chr_changeteam [ai_name:string | script_id:int] team_name:string - changes a character's team - chr_changeteam guard1 Syndicate
''Team name strings: Konoko, TCTF, Syndicate, Neutral, SecurityGuard, RogueKonoko, Switzerland, SyndicateAccessory''
''Team name strings: Konoko, TCTF, Syndicate, Neutral, SecurityGuard, RogueKonoko, Switzerland, SyndicateAccessory''
Line 187: Line 187:
*chr_super [ai_name:string | script_id:int] super_amount:float - set's a character's super value
*chr_super [ai_name:string | script_id:int] super_amount:float - set's a character's super value
''This sets a character's "<u>external</u> super" value, meaning their Daodan glow, but will not grant them any special powers such as Daodan overpower. It is used to give Konoko her Daodan glow in the Mountain Compound opening cutscene (she isn't granted overhealth until the cutscene ends). The super_amount value determines the brightness of the Daodan particles: consider the effective range to be 1-10. The Compound cutscene gives Konoko a glow of 1, and the cheat code "chenille" gives her a glow of 10.''
''This sets a character's "<u>external</u> super" value, meaning their Daodan glow, but will not grant them any special powers such as Daodan overpower. It is used to give Konoko her Daodan glow in the Mountain Compound opening cutscene (she isn't granted overhealth until the cutscene ends). The super_amount value determines the brightness of the Daodan particles: consider the effective range to be 1-10. The Compound cutscene gives Konoko a glow of 1, and the cheat code "chenille" gives her a glow of 10.''
*chr_talk [ai_name:string | script_id:int] sound_name:string pre_pause:int post_pause:int [priority:string | ] - causes a character to play a line of dialogue - chr_talk victim_mansci_1 c02_62_11sci 0 0
*chr_talk [ai_name:string | script_id:int] sound_name:string pre_pause:int post_pause:int [priority:string | ] - causes a character to play a line of dialogue
''Only used once in the game, when <code>chr_talk victim_mansci_1 c02_62_11sci 0 0</code> is called for Dr. Kafelnikov's yell when he runs away. Normally dialogue is played with <tt>sound_dialog_play[_block]</tt>, but <tt>chr_talk</tt> has the interesting difference of attaching the sound to the character in the world (like dialogue that plays in NPC interactions), which means it should fade away as they get farther from the player. <tt>chr_talk</tt> also employs a unique "talk buffer" not used by any other command, where up to 8 sounds can be queued for the AI to play; if the queue is full then the <tt>chr_talk</tt> command will be discarded. The optional "priority" argument has these choices: "idle", "chatter", "say", "call", "pain", "yell", "override". If you specify "override", the sound will play immediately, but only if the talk buffer was not full.''
*chr_teleport [ai_name:string | script_id:int] flag_id:int - teleports a character to a flag - chr_teleport 0 105
*chr_teleport [ai_name:string | script_id:int] flag_id:int - teleports a character to a flag - chr_teleport 0 105
*chr_ultra_mode [ai_name:string | script_id:int] [on_off:int{0 | 1}] - enables ultra mode for a character
*chr_ultra_mode [ai_name:string | script_id:int] [on_off:int{0 | 1}] - enables ultra mode for a character
Line 193: Line 194:
*chr_unlock_active [ai_name:string | script_id:int] - unlocks the character active
*chr_unlock_active [ai_name:string | script_id:int] - unlocks the character active
*chr_unstoppable [ai_name:string | script_id:int] [on_off:int{0 | 1}] - makes a character unstoppable - chr_unstoppable IntroMuro 1
*chr_unstoppable [ai_name:string | script_id:int] [on_off:int{0 | 1}] - makes a character unstoppable - chr_unstoppable IntroMuro 1
*chr_vocalize [ai_name:string | script_id:int] type:string - makes a character utter a vocalization (vocalize type strings: taunt, alert, startle, checkbody, pursue, cower, superpunch, superkick, super3, super4). Character must be present in AISA file in order to work. Otherwise it will vocalize only the player.
*chr_vocalize [ai_name:string | script_id:int] type:string - makes a character utter a vocalization (vocalize type strings: "taunt", "alert", "startle", "checkbody", "pursue", "cower", "superpunch", "superkick", "super3", "super4"). Character must be present in AISA file in order to work. Otherwise it will vocalize only the player.
*chr_wait_animation [ai_name:string | script_id:int] [anim_name:string]  - waits for a character to play a specific animation - chr_wait_animation 0 KONSPRrun_lt KONSPRrun_rt
*chr_wait_animation [ai_name:string | script_id:int] [anim_name:string]  - waits for a character to play a specific animation - chr_wait_animation 0 KONSPRrun_lt KONSPRrun_rt
*chr_wait_animstate [ai_name:string | script_id:int] [anim_name:string] - waits for a character to reach a specific animation state - chr_wait_animstate 0 run_slide
*chr_wait_animstate [ai_name:string | script_id:int] [anim_name:string] - waits for a character to reach a specific animation state - chr_wait_animstate 0 run_slide
Line 410: Line 411:
*sound_objects_reset (null) - reloads the sounds objects
*sound_objects_reset (null) - reloads the sounds objects
*trig_reset trigger_id:int - resets a trigger to non-triggered state - trig_reset 91
*trig_reset trigger_id:int - resets a trigger to non-triggered state - trig_reset 91
''See note under "[[#triggers (lasers)|triggers]]".''
*trigvolume_reset name:string - reset a trigger volume to its level-load state - trigvolume_reset tv_move4
*trigvolume_reset name:string - reset a trigger volume to its level-load state - trigvolume_reset tv_move4
*turret_reset turret_id:int - resets a turret to initial state
*turret_reset turret_id:int - resets a turret to initial state
Line 451: Line 453:
*trig_speed trigger_id:int volume:float - sets a triggers speed - trig_speed 514 .15
*trig_speed trigger_id:int volume:float - sets a triggers speed - trig_speed 514 .15
*trig_reset trigger_id:int - resets a trigger to non-triggered state - trig_reset 91
*trig_reset trigger_id:int - resets a trigger to non-triggered state - trig_reset 91
''Pass no trigger ID to <tt>trig_reset</tt>'' to reset all triggers. Note that if a trigger has its "time off" field filled in, it will shut back off after the amount of time specified in that field (but this feature is never used in the vanilla game data).''


===trigger volumes===
===trigger volumes===