AI conflicts

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

AI conflicts

Post by Alcoholic »

lets take barney behavior for example. how is the code written up so that he always follows the player, except when hes in combat?
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

got the same type question, wish I could help you out now!

Post by grb »

Alcoholic,
I have the same question. If I figure it out prior to someone giving the answer to you, I sure will. As you will see in my recent thread that you
help with, I am starting to work on AI scripting. It sure was easier in
Soldier of Fortune II Double Helix. But I can see that there is much more
power available in this game once one gets the hang of things.
Hope you get your answer soon.
grb
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The friendly.scr script checks the thinkstate of the AI. If it's not 'attack', he will try to follow the player. Otherwise the script just waits till the guy enters an other thinkstate.
Image
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

So jv_map....

Post by grb »

Does your statement "If it's not 'attack", imply that the programmer
can force at any given point, the mode which the friendly is in, so that after a few seconds when the friendly.scr code senses a change in the friendies "action state, e.g. follow, patrol, or attack for instance), that the
friendly will stop follow mode and go into attack?
Put another way. Can we write script code to force the friendly to leave follow mode and go into attack mode, or lets say go into a patrol mode which takes him to a given waypoint or pathnode? OR, are we tied into
letting the friendly.scr code control the thinking abilities of the friendly BASED on the original mode we put the AI into? That is what we assigned the AI in the map, or by some code early in a script sequence that forces
the AI to either follow, attack, or lets say patrol, or snipe etc..

And if your answer would be yes to the above question/statements, could you give us a short example, as how one can best accomplish changing
the mode the given AI is in, into some other mode of operation?

I hope my question is not to oxymoronic nor difficult to understand.

Sorry Alcoholic if I should have FIRST WAITED FOR YOU TO RESPOND TO YOUR QUESTION. I simply have the same question as you have in this matter.

Thank you in advance for any help on this question.
grb
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

ok cool and can i force the thinkstate to something?
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

I think your question and mine are the same....

Post by grb »

Hopefully, jv_map can provide us with a definitive answer. I hope you
where not asking me the question. My statements where designed to ask
jv_map the same question you ask, you just used a better definition of what I was asking. That is can we programmers change the "think state"
of a given AI, in order to quickly change the resultant action it will take.
Hopefully jv_map can give us a good answer as well as some code that
demonstrates how to change the think state of AI. Please do not feel you
have to respond to this statement, Alcoholic. You and I would rather get
the answer at this point.
grb
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Thinkstates are parts of the finite state machine of the AI. Any AI is always in exactly one state. In which state he is, is determined by game conditionals. Normally an AI is in idle mode, but depended on 'outside influences' he can enter an other state. All thinkstates are read-only, so there's no way you can directly alter them with a script. You can however e.g. administer some damage to make an AI enter the pain state ;).

The following think states exist: void, idle, pain, killed, attack, curious, disguise and grenade.
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

do they affect things like reaction time, etc? like, if hes curious, will he have a better chance of noticing an enemy than if he was idle?
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

oh yeah! this also reminds me of moods. they change their animations, but do moods affect reaction time, etc?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I don't think either affect reaction time.
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

can you manualy change the moods? i dont know if you can, because i saw some ai changing moods automatically. when some nazi's killed americans, i walked up behind them and watched them, and they were all nervous.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes you can manually change their moods but they can be changed back by the game at any time.

To change a mood, just type something like this:
$guy.mood = alert
Image
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

thanks jv_map

Post by grb »

Sounds as if you covered, put at rest, what can be done concerning thinkstate conditions. At least one can change the mood to fit a given
momentary scene.
grb
Post Reply