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

I still can't remove NPCs from the map #56601

Closed
I-am-Erk opened this issue Apr 5, 2022 · 0 comments · Fixed by #56629
Closed

I still can't remove NPCs from the map #56601

I-am-Erk opened this issue Apr 5, 2022 · 0 comments · Fixed by #56629
Labels
[C++] Changes (can be) made in C++. Previously named `Code` EOC: Effects On Condition Anything concerning Effects On Condition NPC / Factions NPCs, AI, Speech, Factions, Ownership Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA

Comments

@I-am-Erk
Copy link
Member

I-am-Erk commented Apr 5, 2022

Is your feature request related to a problem? Please describe.

I'm working on making random encounters, but there's still no way to despawn an NPC. I can send the NPC to walk off on their way, or teleport them to another location, but in the context of a random map, that doesn't really work for two reasons:

  • I don't want the NPC to be persistent and show up again later, necessarily: I can track persistence with global variables if I want an NPC to recur.
  • the location of the random encounter is random, I can't guarantee a target terrain is going to be in range, and I am sure we'll get errors if I try to teleport or walk the random NPC to an overmap it can't locate.
    Overall as well, we just should have the ability to add and remove things from the map, for basic scripting reasons.

Solution you would like.

overmapbuffer.cpp contains a function, shared_ptr_fast<npc> overmapbuffer::remove_npc( const character_id &id )
I believe this can be used to remove an NPC. All I want is the ability to define an effect that calls the character_id and removes it, without killing it or causing a map message. This should be very easy to do, but I don't know how.

Syntax like:

"effects": {
  "remove_npc": "guard"
}

This would then just call that function and do it as that function does it. Viola.

Describe alternatives you have considered.

I could have the NPC walk to another location, but this would probably result in them dying randomly somewhere.

I could try to teleport the NPC to a relevant location like its parent faction base, but I am almost certain this will produce errors if that location isn't loaded yet.

I could, and I'm not joking this is currently my best option, kill the NPC and delete the corpse and all its items. This will require a lot of json script for what I believe is a very small amount of code.

Additional context

Please, please help me.

@I-am-Erk I-am-Erk added NPC / Factions NPCs, AI, Speech, Factions, Ownership [C++] Changes (can be) made in C++. Previously named `Code` Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA EOC: Effects On Condition Anything concerning Effects On Condition labels Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` EOC: Effects On Condition Anything concerning Effects On Condition NPC / Factions NPCs, AI, Speech, Factions, Ownership Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant