Set NPC

O Ilusionista

Captain 100K
There is a way to turn and entity into NPC, by code?
I wanna make the entity check if a globalvar is set and, if yes, it turn itself into a NPC.

I tried to set the player_type into NPC but no luck.

Any ideas?
 
You can't change type so far as I know - the engine bases too many things around it and will simply ignore your attempts. The rigid entity "type" system is probably one of the most serious flaws of OpenBOR's design.

You can however get the effect you are after with a couple of different workarounds. One is to change the behavior of any entity such that it is effectively an NPC anyway, but it's pretty complex. Another is to spawn in an NPC clone of the entity and removing the original. Crude, but in the end probably the simplest method.

DC
 
so it won't work for what I want to do (I suspected since I haven't saw this in any mod yet).
My idea was to make a co-op mode for BOR, without need to make NPC clones of the chars.
Once you enter this mode and set the player 2, the player2 would check a globalvar and change it to NPC.

I don't want to make NPC clones, its a waste of memory.
 
O Ilusionista said:
I don't want to make NPC clones, its a waste of memory.

You can load/unload entities on the fly, so this isn't an issue. I don't blame you for not doing it though, it's a tedious PITA. There is a module out there that does what you want and then some (you fight as a team, and can switch between controlling one or the other at will), but was never released to the public and the creator who was a long time member (OX) had an attack of real life.

Short version - yes it can be done, but no one has deemed the effort to be worth it.

DC
 
Yes, its just too tedius. I have to duplicate every single playable char as a NPC. While its possible to load/unload entities on the fly, I still will load more things that I want to, and I try to optmize what I do as much as I can.

About the tag, Lagarto did it too on his Super Tokusatus Onore
http://www.youtube.com/watch?v=F6XAN8Aakz4#t=34

I have the code, its a bit complex but its not EXACLTY what I needed.
 
OX's is a little different. It has a tag system, but also a mode where like you asked, the second (or third) player is an NPC. The really nifty part is that you can swap which one you control (like a sports game) and the AI immediately takes over the other. Should another player join for real, they automatically took control of the NPC in that slot.

Was a very cool concept and he had some demo videos showing it in action. Unfortunately (like my own works tend to do) it eventually suffered from feature creep and he never released it.

DC
 
Hum, but if you can't change the type directly, how the second player jumps and take control of that NPC?
There is a way to force which player the player 2 should use, via script?
 
The simple answer is "I don't know". It was never something I was all that interested in doing myself and so I've never experimented with it. I have no idea if he did it though multiple clones, a huge mess of flag settings or a combination of both.

Sorry. :(
 
I think so, but it involves the messy skipselect stuff which I have no personal experience with and can't tell you much about.

Were I to venture a guess, he did it by using skipselect to disable the character select, and then immediately scripted a model switch to whichever NPC occupied that player's slot.

Again it's just a guess, but if I wanted that sort of functionality in a module, that's where I'd start.

DC
 
Damon Caskey said:
The really nifty part is that you can swap which one you control (like a sports game) and the AI immediately takes over the other. Should another player join for real, they automatically took control of the NPC in that slot.

It's so sad to read about such an awesome feature and then realize it's not going to be released anytime soon :(

(I'd really love that in every mod I play :( )
 
O Ilusionista said:
I don't want to make NPC clones, its a waste of memory.
I think you forgot that each frame loaded into engine is stored as one copy only so if you have 3 characters using the same frames then frame is stored in memory only once and its basically one character + alternatiove txt commands that take bytes/kilobytes of memory.
I used npcs to help playable characters in fightin spirit and it was working on psp fat so i know theyre not taking much memory if at all when only line that is changed in charadter is basically header line PLAYER - NPC and thats all the dfifference :)
Use clones they dont consume memory like you think they do, i think i have 13 playable characters in fspirit and each one of them has npc clone.
 
yea cause you have to update npc everytime you update playable ;D just make npcs before you release the mod so you have latest version of npc.
I think making separate npc and playable is cleanest way to do this. sometimes you dont want npcs to play all animations like get/grabs or some other stuff.
 
Back
Top Bottom