Enemy factions

mishadude

New member
Hello everyone. Is it possible to have two different groups of enemies who canattack and be hostile to player, NPC and the other group of enemies, but not to each other? I need it for gang war levels for a cop game I want to make
 
Hello, i have been trying to figure out something similar to your question.

as far as i know entities can only attack players, enemies or NPCs, & other 2
i have read around & the only way to make some entities attack specific entities is with script, but the only examples i have found is for special enemies that can only attack a particular NPC or player
(lets say you want an enemy that attacks only player 2)

so it stands to reason that using script will probably allow you to create - lets say "rabbit" entities & "duck" entities

rabbits are aggressive to ducks exclusively, ducks aggressive to rabbits, exclusively...
 
Hi, yeah, I think we need to put our heads together and figure it out. Do you mean a script inside of the entity file or a script file in the scripts folder?

What I want to get in the level is this: Two rival gangs are fighting in the middle of the street and innocent people are getting hurt in the crossfire. Your job is to incapacitate all the gang members and to save as many civilians as you can
 
To change who AI controlled entity can and will attack (they are two different things), look up hostile, canhit, and projectilehit in the manual. These settings exist at the model level and the entity level. Each type (player, npc, enemy, etc.) has a default set, but you can change them on the fly to whatever you like.

As an example, you could have certain enemies that only go after each other, only attack players and leave NPC's alone, or maybe just make them extra grumpy and hate everybody. :)

DC
 
Damon Caskey said:
To change who AI controlled entity can and will attack (they are two different things), look up hostile, canhit, and projectilehit in the manual. These settings exist at the model level and the entity level. Each type (player, npc, enemy, etc.) has a default set, but you can change them on the fly to whatever you like.

As an example, you could have certain enemies that only go after each other, only attack players and leave NPC's alone, or maybe just make them extra grumpy and hate everybody. :)

DC

yes, but this hard-coded options are limited,
for example , i have been looking to make an enemy that will only attack an special type of NPC, on the "hostile to" line i added "Larry" (the name of the specific NPC)
Openbor accepts the line , but if you make the special entity "larry" instead of NPC openbor crashes.

kind of related , it would be nice for the "hostile to" part would accept specifics, like player 1, "hulk"...

mishadude

i wish i could be of more help regarding the scripts, but i have been reading the threads about how they work & i still cant visualize how the commands work.


there is this entity called bosser, that is not part of OPNEbor (hardcoded)i believe it goes with a script so it can be "registered" & recognized, maybe that could lead you to the creation of NPC1's, NPC2's , etc.

I used it in NIghtslashersX, but to tell you the truth i still don't know how it works or why, i just know it does & that it is different from all the others....

EDIT:

try to experiment with stealth

stealth {stealth} {perception}

    ~This command sets stealth ability to entity
    ~{stealth} defines how 'invisible' the entity to hostile entities. Default value is 0
    ~{perception} defines how well entity can see stealth entities. Default value is 0
    ~For instance, entity with {stealth} 2 is only 'visible' to hostile entities with {perception} 2 or higher
    ~This command doesn't affect visual at all IOW entity is still visible to players

- with this, i believe that you can have enemies hostile to enemies that only share a particular level of perception...

the only caveat with this method is that you have to think in advance because enemies that have a perception of 9000 will be able to "see" a 8000 level enemy.

as for how you can change those detections/hostilities on the fly....

i can't give you an example... anyone?
 
Yeah, I've thought about stealth and perception before, but this brings another set of headaches.

I took me a while but I've figured out what DC was trying to get me to understand. I need to have one gang as enemy who are hostile to and canhit  player and NPC. Then, the second gang should be spawned as NPC who are hostile to and canhit player and enemy. The only problem with that is that the second gang won't be hurting the civilians, but I'll settle for that.

Edit

No, wait, it's worse than that. Gang2 won't be able to hurt player's NPC cop allies and vice versa. Player can be set to be able to hit everyone, but then the player will be able to hurt civilians.
 
oldyz said:
yes, but this hard-coded options are limited,
for example , i have been looking to make an enemy that will only attack an special type of NPC, on the "hostile to" line i added "Larry" (the name of the specific NPC)
Openbor accepts the line , but if you make the special entity "larry" instead of NPC openbor crashes.

First of all, no, it is NOT crashing. It is logging a user error and shutting down because it has no way of doing anything with the information you gave it. There is a huge difference.

At the moment, yes, "factions" are based on entity type, and types are limited to a specific hard-coded list. But there is a script only property called "custom_target" (it's renamed in later versions, so be aware it won't be backward compatible). What this does is cause the entity to target whatever entity pointer you place in it, no matter what. That enables you to write your own target selection system if you are so inclined.

kind of related , it would be nice for the "hostile to" part would accept specifics, like player 1, "hulk"...

That's not really feasible. It would require a string search on every engine update and slow the frame-rate to a crawl, no matter how powerful your CPU is. What we need is a numerically based faction system - this is what every game engine ever made that has a faction system does internally. I'm working on just such a thing. It will allow up to 32 custom factions at once, each with their own adjustable targeting behavior. Each entity can be a member of as few or as many factions as you like, and you can switch them on the fly. Only thing is it won't be available for some time. in the meanwhile, I suggest you look at custom_target and see if you can figure out how to build one yourself. It really isn't difficult as you might think.

DC
 
nsw25 is right, faction system is doable in OpenBoR, you can see it in this video starting from 1:42

As for sharing, I can share the script. However I prefer share it in a small demo or something cause it involves multiple entities
 
hehe , i love those panic fire animations

Damon Caskey
sorry about the use of the word crashing, i could not find another way to say it.
Great news about those faction features tho.
i will try to understand  more about custom_target...

well, Bloodbane, i for one would be very grateful, & i'm sure that this opens up other great features for modders...

there is a tiny 16 mB verison of nightslashersx that i uploaded just for those type of specific additions, that way users can find the scripts & codes easier, altho im pretty sure there is even smaller & simpler demos out there to see new scripts or things like that in action....
 
Back
Top Bottom