Best way to create a NPC partner?

just spawn him with script and set parent as player to have access to him or just use global variables in player attacks to change attacks of npc but thats triky in 4 player game and multiple npcs
 
Partner NPC like dog in Shadow Dancer sounds tough to make, mostly in AI department
But let's break it to smaller pieces these questions:

1. Are you making partner NPC in 2D mod or 2.5 mod?
2. What will this NPC do when parent , or player I should say, stands still? chases enemies or stand by player or somethingelse
3. Will this NPC be available from start of game? or at least available when the character is spawned?
4. Will this NPC attacks on its own or on command of player?

There are more questions coming up, mostly from expanding #2 above, but let's start from these first :)
 
The first three can be done with OpenBOR default behaviors. Funny you should mention Shadow Dancer - because Joe is a character in my works, and the dog is included.

Anyway, the last (attack on command) absolutely requires script. Sending the actual attack command is easy because by default OpenBOR sets a property on the child called "parent" that contains the entity handle of whatever entity spawned it.

[list type=decimal]
[*]Enumerate and loop entity collection.
[*]In the enumerated loop above, you compare each entity's parent property with the handle of your parent. If they match, then the current entity in the loop is your NPC. Because entity handles are 100% unique, this will work regardless of single or multi player.
[*]Optional: Verify the NPC can or should attack. Does it need to be idle, or at a certain distance from the parent? It would look silly (not to mention cheesy from a game play perspective) if you could send a dog rushing forward when it was already busy attacking or making its way back. These kinds of checks will depend on your game play style.
[*]If all those checks pass, set NPC to perform attack - usually by making it perform an animation. Keep in mind the same facets with setting attacks for anything else.
[/list]

All that said, the NPC itself will need to have all the proper tools for moving around. You'll need to carefully set its jump ranges, walking, running and idle ranges too, as this is how it knows to follow and how close. Also remember that the NPC will instantly teleport back to the parent's location if it goes out of idle's maximum range and plays RESPAWN while doing so. IOW, you will want a visually appealing RESPAWN animation to cover for this (jumps from top of screen, teleport smoke, maybe just dies, whatever).

It's not really complicated, but it is tedious and you will need to put the legwork in.

DC
 
if you could send a dog rushing forward when it was already busy attacking or making its way back. These kinds of checks will depend on your game play style.
Specially in games Like Shadow Dancer, where you have obstacles and the dog runs over it.
 
Back
Top Bottom