BSL talk:Functions

From OniGalore
Jump to navigation Jump to search

table design?

geyser, is this about what you wanted?
I have to do it over again, as I screwed a few things up...
How do you leave a box empty? Just put a space in?
Also, the types need listing...
The Mystery Man ^_^


Dear sir. Either log in or sign, preferably both.
I'd prefer if signatures were listed in a tidier way.
(I mean function signatures, not people's sigs ^_^)
There is currently an example table in the sandbox.
I wouldn't give one-line examples in such a table...
Instead, I'd provide console-powered mini-tutorials.
For example, see what I put here: ai2_allpassive.
Such a mini-tut is more flexible than a table cell.
And we'll be basically building a tutorial as we go.
geyser 03:03, 22 January 2008 (CET)
Type Name Arguments Description Example
X ai2_active script_id:int] forces an AI into active mode
X ai2_attack script_id:int] [target_name:string | target_script_id:int] forces an AI to attack another character ai2_attack IntroNinja 0
X ai2_barabbas_retrievegun script_id:int] makes barabbas retrieve his gun if it is lost ai2_barabbas_retrievegun barabus
X ai2_barabbas_run lets Barabbas run while carrying his gun
X ai2_chump (null) creates a chump
X ai2_chump_stop stops the chump
X ai2_comehere script_id:int] tells an AI to come to the player
X ai2_doalarm script_id:int] [console_id:int] tells an AI to run for an alarm ai2_doalarm ambush_commguy_2 4

if the AI is passive, ai2_doalarm cannot be executed

X ai2_dopath script_id:int] path_name:string tells an AI to run a particular path ai2_dopath A_E3 patrol_49

if the AI is passive, ai2_dopath cannot be executed

X ai2_followme script_id:int] tells an AI to follow the player ai2_followme s2_t05
X ai2_forget script_id:int] [forget_char:string] makes one or all AIs forget they saw anything ai2_forget Sec_Ambush_BOL_1
X ai2_idle script_id:int] tells an AI to become idle ai2_idle A1_intro01
X ai2_inactive script_id:int] forces an AI into inactive mode
X ai2_kill [param1:string] [param2:string] kills one or more AIs ai2_kill ScanKerr01 // ai2_kill
X ai2_lookatchar script_id:int] [ai_name:string | script_id:int] tells an AI to look at a character ai2_lookatchar 0 Barabus

needs ai2_takecontrol 1 if Konoko should do that

X ai2_lookatme script_id:int] tells an AI to look at the player ai2_lookatme s2_t05
X ai2_makeaware script_id:int] [target_name:string | target_script_id:int] makes an AI aware of another character ai2_makeaware GrifElite04 char_0
X ai2_makeblind script_id:int] on_off:int{0 | 1} makes a single AI blind ai2_makeblind ShinShin 1
X ai2_makedeaf script_id:int] on_off:int{0 | 1} makes a single AI deaf ai2_makedeaf ShinShin 1
X ai2_makeignoreplayer script_id:int] on_off:int{0 | 1} makes a single AI ignore the player ai2_makeignoreplayer ParkStriker 1
X ai2_movetoflag script_id:int] flag_id:int [setfacing:string{"setfacing"}] tells an AI to move to a flag ai2_movetoflag 0 1091

needs ai2_takecontrol 1 if Konoko should do that

X ai2_neutralbehavior script_id:int] behavior:string sets up an AI's neutral-interaction ai2_neutralbehavior neutral_3 none
X ai2_noncombatant script_id:int] non_combatant:int{0 | 1} sets or clears an AI's non-combatant state ai2_noncombatant A1_intro01 1
X ai2_panic script_id:int] timer:int makes an AI panic or not panic ai2_panic A1_s_red02 300

I've tried ai2_panic A1_s_red02 300 ==> Oni crashed

X ai2_passive script_id:int] passive:int{0 | 1} stops an AI from thinking for itself ai2_passive Intro_Striker_4 1
X ai2_reset [reset_player:int] resets AI as if start of level ai2_reset
X ai2_setalert script_id:int] alert:string sets the alert state of an AI ai2_setalert Floor2_Striker_2 high (alert strings: lull, low, medium, high, combat)
X ai2_setjobstate script_id:int] tells an AI to take its current state as its job ai2_setjobstate E_Er34

if the AI is passive, ai2_setjobstate cannot be executed

X ai2_setmovementmode script_id:int] mode:string sets an AI's current movement mode ai2_setmovementmode finalam_striker_1 walk (movement mode strings: creep, walk, walk_noaim, run, run_noaim)

needs ai2_takecontrol 1 if Konoko should do that

X ai2_spawn ai_name:string [force_spawn:string{"force"}] creates and starts an AI from a character object ai2_spawn ambush_striker_2
X ai2_tripalarm script_id:int] trips an alarm ai2_tripalarm 2 0
Where is chr_main_class and chr_set_class? Don't they belong on the BSL function page? EdT 22:14, 24 October 2008 (CEST)
This is a short table Gumby put together. It's nowhere near complete. The most current stuff is HERE --geyser 00:47, 25 October 2008 (CEST)

chr_teleport -1

chr_teleport [ai_name:string | script_id:int] flag_id:int - teleports a character to a flag - chr_teleport 0 105
Tried today it with -1, chr_teleport -1 400, which seems to give random results, but always retrieves a spawned character, I thought it would always retrieve the first character alive after Konoko but seems it isn't always the case. Have anyone had also a look a this? If it was a underflow probably it shouldn't retrieve characters most of the time. --Script 10k 12:55, 8 August 2012 (CEST)

chr_index vs script_id

What's the difference between chr_index and script_id? I think it's that that is messing the things.--Script 10k 16:43, 8 August 2012 (CEST)

If there's a difference, my guess would be that chr_index is the ONCC order* and script_id the spawn order**.
* oncc order: installed oncc files, shapeshift to see the numbers.
** spawn order: first spawned character is 0, second spawned character is 1, and so on. --paradox-01 17:24, 8 August 2012 (CEST)

I've been playing with chr_focus lately, I am sure that that char_index is the spawn order. Haven't checked the ONCC order although. --Script 10k 17:31, 8 August 2012 (CEST)

Uhm, I confused chr_index with class_index, sorry. (eg chr_set_class chr_index:int [class_name:string | class_index:int])
However I checked the ssg's list and it looks like that chr_index is used only be PC retail. *shrugs* --paradox-01 18:13, 8 August 2012 (CEST)
EdT can use it on Mac, not sure what version he have? Which one is EdT? --Script 10k 20:59, 9 August 2012 (CEST)


chr_kill_all_ai (null) - kills all the AI, I couldn't get it work. F6 in developer mode works although.

But I've found a good alternative: ai2_kill();, kill them all too. By curiosity have anybody got chr_kill_all_ai work? --Script 10k 21:00, 9 August 2012 (CEST)


"chr_vocalize [ai_name:string | script_id:int] type:string - makes a character utter a vocalization (vocalize type strings: override, yell, pain, call, say, chatter, idle)"

Couldn't get this to work with any other character than Konoko (player). If someone can "vocalize" bots please let me know. Script 10k (talk) 21:59, 20 August 2016 (CEST)

Correct me if I'm wrong: AIs spawned by CHAR collection come without an script_id. You would need to add characters via AISA and set <ScriptId>. In case of chr_vocalize, an non-existing script_id is probably replace by 0 and so redirected to player. With CHAR workflow you should use ai_name instead. --paradox-01 (talk) 11:40, 21 August 2016 (CEST)
Works like a charm paradox-01! I've added the character to AISA and it worked as supposed. Thanks! :)
One thing, in my game the strings available for vocalize aren't the same as described above. They are: "taunt, alert, startle, checkbody, pursue, cower, superpunch, superkick, super3 and super4". Can you check which ones are present in your game?
Interesting. You are correct about those being the strings for chr_vocalize. The strings given on BSL:Functions, such as "chatter", are associated with chr_talk, but it seems that they have no effect. So the Functions page is in error. --Iritscen (talk) 17:42, 21 August 2016 (CEST)
"They are: "taunt, alert, startle, checkbody, pursue, cower, superpunch, superkick, super3 and super4". Can you check which ones are present in your game?" - Yep looks the same in my exe. --paradox-01 (talk) 20:17, 21 August 2016 (CEST)


"chr_holdkey [ai_name:string | script_id:int] key_name:string num_frames:int - forces a character to hold a key down for some frames"

Couldn't get this one to work too. I tried chr_holdkey char_name "h" but seems character didn't hold the key either the player or the ais. "h" key in my oni is thr keyboard punch key.

Please let me know if any of you got this to work. Script 10k (talk) 23:52, 25 August 2016 (CEST)

SSG (no example in his command list given), geyser, loser and gumby couldn't make that command work. So forget about it ;)
Use FILM file instead:
chr_playback_block([ai_name|script_id], film_name, fromhere)
fromhere - ignore the position, rotation is still used
interp - interpolates between current character position and film position (awkward when height is not the same)
You could probably create a level 0 package made of such keys and then use them whenever needed.
Caution with editing frames, game crashes when done wrong. --paradox-01 (talk) 08:37, 26 August 2016 (CEST)
Thanks paradox-01. I am going to try that.Script 10k (talk) 20:05, 28 August 2016 (CEST)