Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning doesn't work on some NPCs #194

Closed
Cervicia opened this issue May 5, 2023 · 6 comments
Closed

Cloning doesn't work on some NPCs #194

Cervicia opened this issue May 5, 2023 · 6 comments
Labels
bug Something which causes issues when using the tools. fixed in staging branch This bug has been fixed in the staging branch of OpenCAGE. [TOOL] Script Editor This issue applies to the script editor within OpenCAGE.

Comments

@Cervicia
Copy link

Cervicia commented May 5, 2023

When cloning some NPCs for example humans, they won't spawn. The only thing, that is visible is the model of their weapon. Steps, I did:

  • searching in the missionscript for human
  • cloning one of the entities(composite) and setting a new position

AI_NPC_weapon

Moving the position of exisiting humans works fine.
@MattFiler MattFiler added bug Something which causes issues when using the tools. [TOOL] Script Editor This issue applies to the script editor within OpenCAGE. labels May 6, 2023
@MattFiler
Copy link
Owner

MattFiler commented May 7, 2023

Done a bit of digging into this, it appears that randomly generated NPCs (not the Alien or story characters) compile to a separate binary file called CharacterAccessorySets which defines the bodyparts to spawn for NPCs (hence why you're only seeing guns). Will see if I can add support for it to the script editor!

@MattFiler MattFiler added the in progress This issue is currently being worked on. label May 21, 2023
@MattFiler
Copy link
Owner

MattFiler commented May 27, 2023

Update: there was an unknown value in the NPC setup file which I've now figured out, making this possible! Will add support for it in the next update, along with some improved MVR stuff as a result of the new finds, which should help fix #95 too.

@MattFiler
Copy link
Owner

20230529225318_1

Pic of the first custom human NPC spawned in using the NPC editor! Will push it out to the staging branch soon after some more work.

@MattFiler
Copy link
Owner

MattFiler commented May 30, 2023

This is now live on staging!

  • Create a custom NPC by adding a new composite entity in your script which is any one of the ARCHETYPES/NPCS/HUMAN variants.
  • With your new entity created, follow the composites through (using the "Go To" button in the top right) until you reach the Character entity within - this may be a couple layers deep through other NPC-related composites, keep an eye out for NPC_LOGIC as that's usually where it comes from.
  • Select the Character entity when you find it, and then press the "Function" button in the top right. The new editor window should appear.
  • Press "Add New" in the top right of this window and select your newly added NPC in the dropdown list (this list is a hierarchical view of all NPCs that point to this Character entity, so look for the name you gave yours within each hierarchy to find it), then click add.
  • Now, select that same NPC hierarchy in the dropdown of the active window. With the instance of your new NPC selected you can begin setting up the NPC's attributes.

Currently available is support for:

  • Adding composite references for the character's head, torso, arms, legs, shoes, and collision.
    • To do any of these, click the "Change" button and select a composite. Ideally look in the "NPC/*" directory & select something appropriate (e.g. a torso for a torso). I've left it open to any composite incase you add any custom ones outside of that directory.
  • Selecting the skeleton of the NPC.
    • Ideally, keep all components of the NPC the same gender to avoid rigging issues. If it's tricky to figure out the gender from the name I can add a better display of that.
  • Shirt decals.
    • This is a choice of either medical, engineering, generic, or technical. Some of these choices not only change the decal but also some colour variations on certain clothing. I'm still working on figuring out where this data comes from.

I'll continue to expand the character editor over time as I learn more about the format, and I also plan on adding a previewer to see your character easier in the editor.

Be aware, from my testing of this it appears you may need to use NPCs in conjunction with NPC_ForceNextJob to give them an active job (JOB_Idle is a default idle state) & mood (CHR_SetMood) - but I'm not entirely sure if that's required or just something extra. There other extras like CHR_SetAlliance to make the game end if you kill them, etc too.

Thanks for the request! Let me know if you have any issues!

@MattFiler MattFiler added fixed in staging branch This bug has been fixed in the staging branch of OpenCAGE. and removed in progress This issue is currently being worked on. labels May 30, 2023
@Cervicia
Copy link
Author

Thanks for your work! I really appreciate you putting so much effort into this.
I tested it and everything works fine.
The only minor bug I found is that when you add the NPC to the Character entity, a Skeleton is already visually selected, but not yet properly applied.
Now when you try to spawn the NPC in the game, the game either crashes or the NPC is not spawned.
To prevent this, you must first actively select a skeleton. Then the NPC spawns as it should.

@MattFiler
Copy link
Owner

Glad to hear it worked! Will fix that skeleton bug - thanks for spotting 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something which causes issues when using the tools. fixed in staging branch This bug has been fixed in the staging branch of OpenCAGE. [TOOL] Script Editor This issue applies to the script editor within OpenCAGE.
Projects
None yet
Development

No branches or pull requests

2 participants