|06-04-1999, 10:23 PM||#1|
Join Date: Jan 1999
Tips & tricks - sentient and actor \"allegiances\"
Since the subject of actors and AI seems to be "in vogue" these days, I figured it might be a good occasion to post a bit of info about what I call actor "allegiances". Don't know if this is the proper term but I can't find a better one.
First, the difference between sentients and actors:
Game code-wise, actors is a sub-class of sentients. They inherit all the properties of sentients but they have something more: more intricate functionality.
In practical terms, sentients in Sin are things like animals (bats, rats, pigeons, fishes, etc...) and functional inanimate objects like sinks, urinals and toilets.
Actors are like a step of evolution above if you will. All the monster_*, cinematic_*, hero_*, innocent_* and neutral_* entities are actors.
Almost all of those sentients and actors have an allegiance defined in the AI script file to which the entity's .def file points to. This is done in the form of the command:
All the humanoid type foes are "enemy".
All the mutant type foes are "monster"
All the friendly fighting types are "friend"
All the civilian types are "civilian"
All the animals are "animal"
All inanimate objects are "inanimate"
Well that's pretty obvious right? Why is this important and why do I call them "allegiances" ?
Because this single line of code in the AI determines who and what the sentient or actor will ally itself to.
Any actor who is "friend" is an ally to the player. They hate and will attack anything that's "enemy" and "monster" but will leave "civilian", "animal" and "inanimate" alone. A "friend" will never attack the player even if attacked by him and won't turn against another "friend" if accidently shot by him.
Any actor who is "enemy" or "monster" is an enemy to the player and "friend" actors but they will also leave "civilian", "animal" and "inanimate" alone. An "enemy" will never turn against another "enemy" if accidently shot by him.
Any actor who is "civilian" is neutral to everybody else. They are only capable of cowering when danger arises.
Any sentients who are "animal" basically hate and can attack the player if they have states and attack behaviors AI defined for this. Otherwise, they're neutral like fishes and pigeons. However, they don't hate "friend" actors or any other types.
Any sentient who is "inanimate" is of course inanimate. They can't hate anything and nothing hates them. The only inanimates are world_sink, world_toilet and world_urinal. They only reason they are part of the sentient class of entities is that they need to react to being used by the player and perform some kind of function in response (run water or flush). This is why they have a "use" definestate thread defined for them.
Whre it gets interesting is when you start modifying the sentients or actors default allegiances:
If you convert an "enemy" or "monster" to a "friend" with the command:
$actorname friend OR local.self friend
Since those are capable of fighting, their new allegiance produces a complete turnaround. They now hate and attack "enemy" and "monster" actors and won't attack "friend" or the player.
The same situation (but reversed) happens if you turn a "friend" (HC officers, JC) into "enemy". They now hate/attack "friend" and the player.
If you turn a "civilian" into "friend", the "enemy" and "monster" actors hate and kill them but they can't fight back because they don't have fighting animations and AI. They simply become cannon fodder for the baddies.
But if you turn the "civilian" into an "enemy" or "monster", they cower when they see the player and "friend" actors will attack them.
If you turn a "civilian" into "animal", they will cower when they see the player but "friend", "enemy" and "monster" will leave them alone.
Now if you turn a "friend" into "animal", this makes him hate the player but nothing else. The same goes for "enemy" and "monster".
Where it gets really interesting is if you turn an "enemy", "monster" or "friend" into a "civilian", they don't attack anybody. If attacked by the player, they will then retaliate against the player but don't retaliate against accidental attacks from other actors.
The same thing happens if you make them "inanimate" but for some reason, they seem to not have any the gooddies (armor, health) to pick up from when they die so making them "civilian" is preferable for this.
And another interesting thing to create gory situations is to turn an "animal" with attack capability (bats and rats) into "friend" or "enemy" in the case where you would like to have a swarm of rats or bats attack "enemy" or "friend" actors.
If you really want to make it whacky, just turn "inanimate" toilets and urinals into "friend" and watch the "enemy" actors mercilessly attack them
Again, sorry if this was long-winded, but I wanted to give you a complete picture of all the possible situation you can create simply by changing an actor's allegiance. The rest is up to your imagination.
The official Sin entities and scripting reference site
All times are GMT -5. The time now is 10:17 PM.