Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 11/07/09 18:11

Phydur
Member
Registered: 01/13/07

chr_focus/ai2_takecontrol Info

im thinking about making a Wiki page on how to use the ai2_takecontrol and chr_focus comands.
like a tutorial of sorts.
like if you try to focus on a character too far away, Oni blams.
but i dont know everything, like
how do you prevent this from happening? is it someing like forcedraw.
or something?

anyway. i wanted to see what you guys think, before i get started on it.

also i wasnt sure weither to put this in help and troubleshooting,
or this thread.
so go ahead and move/delete this if you feel its in the wrong place.


I intentionally spell dang, dange, FYI.

Offline

#2 11/07/09 19:11

Mukade
Member
From: Ottawa, Ontario - Canada
Registered: 05/29/07

Re: chr_focus/ai2_takecontrol Info

well, you could simply start it on this page, if the information becomes substantial enough and deserves it's own wikispace sure...

Leus and I especially would be greatly for any advice on this seeing as the mod we are working on depends heavily on that cmd combo


"He looks mean enough to tear my arm off and beat me to death with it. In fact, he looks mean enough to tear his OWN arm off and beat me to death with it."

Offline

#3 11/07/09 19:11

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: chr_focus/ai2_takecontrol Info

Yeah, it's probably a good idea to start it here, and then we can figure out where to fit it into the wiki afterwards.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#4 11/07/09 19:11

Phydur
Member
Registered: 01/13/07

Re: chr_focus/ai2_takecontrol Info

ok. i'll need to go do some reasearch, but i'll get started on that later tonight. i have to go for now.


I intentionally spell dang, dange, FYI.

Offline

#5 11/10/09 18:11

Phydur
Member
Registered: 01/13/07

Re: chr_focus/ai2_takecontrol Info

well so far. beyond the who/chr_focus #/ ai2_takecontrol 0 command set,
i've found some problems.
sometimes when i chr_focus, the center is off. er what i mean is that when I press W for forward, they walk at an angle.
i think this might have to do with the ai's combat or something. not sure though.
if you chr_focus on a dead character, you can revive them by using the chr_health command, but you also run the risk of blamming if you try to chr_focus on a dead character. i think it has to do with weither they've died or 'died' by the engine's standards, i guess.
if they are far away use "chr_draw_all_characters = 1" and then use "chr_foucs" it will blam if you dont.
but draw all chracters may cause lag if you leave this on.
but remember if they're dead you'll blam oni.
you can use "chr_who", to see all characters. but if the list is too long you wont be able to see all of it.
uhm. thats all i can think of for now. more as i come across it.
also, i'll probably turn this into a proper wiki format latter when im not busy with schoolwork

Last edited by Phydur (11/10/09 18:11)


I intentionally spell dang, dange, FYI.

Offline

#6 11/10/09 20:11

Mukade
Member
From: Ottawa, Ontario - Canada
Registered: 05/29/07

Re: chr_focus/ai2_takecontrol Info

but draw all chracters may cause lag if you leave this on.

hmm, that might be it..... That may be why I am getting incredible lag on our special forces mod :-/


"He looks mean enough to tear my arm off and beat me to death with it. In fact, he looks mean enough to tear his OWN arm off and beat me to death with it."

Offline

#7 11/11/09 01:11

Phydur
Member
Registered: 01/13/07

Re: chr_focus/ai2_takecontrol Info

if only there was a way to draw only certain characters... I'll try and look into that when i have time...


I intentionally spell dang, dange, FYI.

Offline

#8 12/10/09 00:12

Phydur
Member
Registered: 01/13/07

Re: chr_focus/ai2_takecontrol Info

uh. i guess its ok if i make a new post, right?

i've found
chr_lock_active [ai_name:string | script_id:int]
to work. i think.
the problem is you have to know the character name and id. not sure what script_id is. chr_focus uses chr_index:int btw.
also, i was running around the compound (as the sniper, testing the chr_lock_active thing) and when i got to where the widows are (above where the truck you use to break through the door is) i shot with his merc bow and the game blamed. i'm thinking its because of the way the windows breaking works.
i had left konoko by the tower, btw.

Last edited by Phydur (12/10/09 00:12)


I intentionally spell dang, dange, FYI.

Offline

#9 12/10/09 01:12

Gumby
Member
From: Seattle, WA, USA
Registered: 08/30/07

Re: chr_focus/ai2_takecontrol Info

The pipe symbol "|" means or. So either the name of the character OR the script id\chr index (same thing....).


Iritscen: roll
Iritscen: it's amazing this program even works
Gumby: i know
Iritscen: and that statement applies to my code, not just yours

Offline

#10 12/10/09 01:12

Phydur
Member
Registered: 01/13/07

Re: chr_focus/ai2_takecontrol Info

is there a way to return a characters x y and z command in scripting?
cause i think i figured out a way to kinda fake it.
it only works for windows, but if you use
chr_location chr_index:int [loc_x:float loc_y:float loc_z:float]
you can, by using a go between (say a chump)
you can swap places with your character and konoko. shape shift her for extra effect.
if you want me to explain what i mean in more detail, just ask.

*edit* after re reading what i posted. it doesn't realy make much sense.
see, since the problem is that it treats konoko differently then the bots, by switching konoko's place with the bot you want to control, shape shifting her to the bots form, you get the illusion that you're playing as the bot when you realy aren't. then just swtiching konoko back afterward solves all those blaming issues that come from using the bots. of course this may defeat the purpose that you wanted from being able to control bots...

Last edited by Phydur (12/10/09 01:12)


I intentionally spell dang, dange, FYI.

Offline

#11 12/10/09 02:12

Gumby
Member
From: Seattle, WA, USA
Registered: 08/30/07

Re: chr_focus/ai2_takecontrol Info

Nope. Not yet at least. wink


Iritscen: roll
Iritscen: it's amazing this program even works
Gumby: i know
Iritscen: and that statement applies to my code, not just yours

Offline

#12 12/11/09 14:12

Loser
Member
From: somewhere in da Czech Republic
Registered: 01/14/07

Re: chr_focus/ai2_takecontrol Info

Summing up "chr_focus" experiments from never finished script ( TCTF raid in Manplant level ):

Trying to focus on character which is inactive ( not ready to be drawn )  = BLAM! To avoid this, use:

* chr_draw_all_characters = 1
All characters are forced to be drawn, even when off screen. Usually causes heavy lags when there are more characters present.


* chr_all_active = 1
Much better variant. Forces all characters to be active ( ready to be drawn ). Causes minimal extra lags and is generally the best choice for random chr_focusing.


* chr_lock_active "name"
Similar to chr_all_active, but locks only specified character to be "ready to be drawn" all the time. If you want to cancel its effect, use chr_unlock_active "name". Useful if you know that there is only a set of characters to be chr_focused into ( such as AI2 driven comrades in a squad ).

----------------------------------------------------------------------------------------------------------------------------

Next, we sucesfully focused on some AI2 character. But we cannot do a thing with it since this character is controlled by AI2 system. To control focused character, you have to execute "ai2_takecontrol" command. This command will always apply on focused character.

"Ai2_takecontrol 0" means that this character is not controlled by AI2 system, thus if player is focused on it, he can control it. Otherwise this character does nothing.

"Ai2_takecontrol 1" means that this character is controlled by AI2 system, thus player cannot control it even if he is focused on it. You can even make main character to be ai2 controlled, but it won't fight on its own since it has set "player" flag in BINA file, so some AI2 routines are not applied. If main character is AI2 sontroled, it can for example run to flag ( ai2_movetoflag "char_name" "flag ID", used in airport during Muro's "I'm impressed" cutscene ).

----------------------------------------------------------------------------------------------------------------------------

Alright, we are focused on some AI2 character, we have taken control of it. Is that all? Nope ^_^. Find some enemy. the moment AI2 character you now control sees enemy, it strikes "startle" pose ( if that is allowed for this character in its ONCC file ) and yells its "startle" sound ( "A-HA!" for strikers, link to sound set in ONCC as well ).

Or find some enemy and have a weapon in your hand. AI2 character is under your control, but some functions like "fire at enemy if you point a gun at him" are independent ( probably because AI2 system is composed of more than one element ). So to sum it up, you control AI2 character, but it still shoots on its own ^_-.

To get rid of these effects, use ai2_passive "char_name" 0|1 command. Ai2_passive "char_name" 1 disables all AI2 driven actions of "chr_name" character.  Ai2_passive "char_name" 0 enables them back.

----------------------------------------------------------------------------------------------------------------------------

Next, sometimes you make yourself in control of AI2 character which has dialogue ( "Press CTRL to talk to this person" ). If you attempt to accept it while focused on this character, it will make a little talk for itself and then ... yes, BLAM! ^_^'.

With apologies, I forgot how to get rid of this, but I suggest trying out chr_neutral command. Maybe chr_neutral "char_name" 0 will temporarily disable its NEUT file? Or is it ai2_neutral_behavior "char_name" "none" to scrap away its behavior completely ( and how to restore it back then ? ) Sombody check it out, please.

----------------------------------------------------------------------------------------------------------------------------

Miscellaneous:

When you focus on some character and take control, you can holster / unholster weapons. Sadly, AI2 does not share player's ability to hide / draw weapon, so make sure you unholster when focusing away from this AI2, otherwise you make this AI2 character unable to use its weapon. Of course, you can do it on purpose.

If you kill AI2 character which has holstered weapon, this weapon will "pop out" of dead body within second or two after death, so don't worry about vanishing weapons.

There are two types of powerups specified in CHAR BINA file. One is "used", these ( hypos, ammo / energy clips, shield, cloak ) will be visible and useable if you focus on this AI2 character. Other ones are "dropped", these cannot be seen or used when focusing on this AI2 char, but will pop out from its body when this AI2 character is killed.


When you focus on AI2 character and you control it, you can sometimes experience weird thing: character is "off-centered". That is caused by fact that AI2 driven characters don't return to basic " stare forward" when they use "look" key, aka they turn their head. To fix this, you can press "look" key and manually center character's point of looking. Or force AI2 character somehow to stare point blank forward right before you focus into it.

Easier said than done, best way is to use either "playback" command and force character to play some short scene where it is forced to stare forwards ( playback "char_name" "film_name" "fromhere" ) or to make it invincible and totally dumb for a moment -

chr_invincible "char_name" 1  |||  chr_unstoppable "char_name" 1  |||  chr_weapon_immune "char_name" 1  |||  chr_changeteam "char_name" "Switzerland"  |||  ai2_forget "char_name"  |||  ai2_passive "char_name" 1  ||| ai2_idle char_name"

Now with a bit of luck this AI2 character will simply stand and stare. Focus on it and then revert all those commands as needed in order to have ordinary player-controlled look-centered AI2 character.




I guess that is all I can offer. Good luck with controllable AI2 characters.


                                                                                                                                               Loser

Last edited by Loser (12/11/09 15:12)


"I am just a mere reflection of what I would be."

Offline

#13 12/11/09 18:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: chr_focus/ai2_takecontrol Info

Heh, nice tutorial, Loser.  This definitely needs to be wikified at some point.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#14 12/11/09 23:12

Mukade
Member
From: Ottawa, Ontario - Canada
Registered: 05/29/07

Re: chr_focus/ai2_takecontrol Info

yupyup, and thx for some of the character draw options, I've been using it in a mod I've been making, currently in hibernation right now, since i havn't worked on it for awhile (maybe during winter break coming up...) And we had problems with massive lag spikes because of Character_draw_all = 1

now that we have another option, we may be able to fix that problem


"He looks mean enough to tear my arm off and beat me to death with it. In fact, he looks mean enough to tear his OWN arm off and beat me to death with it."

Offline

Board footer

Powered by FluxBB