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

Hallucinatory NPC #28157

Merged
merged 143 commits into from
May 11, 2019
Merged

Hallucinatory NPC #28157

merged 143 commits into from
May 11, 2019

Conversation

Fris0uman
Copy link
Contributor

@Fris0uman Fris0uman commented Feb 10, 2019

Summary

SUMMARY: Content "Adds hallucinatory NPCs"

Purpose of change

Adds NPCs that are hallucinations, they do everything NPCs can do except interact with the physical world. They might still pretend to attack monster, drop or throw items and heal other NPCs or Player.

Describe the solution

  • Makes a NC_HALLU classe for NPC with the HALLUCINATION trait
  • Adds hallucination property to NPCs
  • Sets hallucination to true when NPC with HALLUCINATION trait is loaded
  • Check for is_hallucination() every time NPC tries to interact with real world.

Describe alternatives you've considered

Additional context

There's still some stuff that don't work :

  • 1 in 100 hallucination spawns as an NPC
  • You can't trade items with Hallucinations.
  • Hallucinations can't open doors, they walk through them though.
  • Hallucinations disappear if you see them while not hallucinating.
  • Hallucinations don't trigger any traps.
  • Hallucinations voice their distaste for thorazine and their love of pink tablets
  • Hallucinations only pretend to shoot, it consumes their ammo and makes fake noise in the log
  • Pretend shooting is not too spammy
  • Hallucinations don't want to trade, and have several answers as to why.
  • Hallucination friends don't count in the 2 allies needed for camp building

I'm not sure the HALLUCINATION trait is useful since it's redundant with is_hallucination(), maybe NC_HALLU classe is enought and NPC from this classe get hallucination = true on spawn, I don't know what's the best practice here.

Fris0uman added 30 commits February 9, 2019 14:37
@Mcrone617
Copy link

If you can, at least for testing purposes make it so the NPCs approach the player? especially if people will be doing the "prison challenge" the NPC might just spawn above ground and run into the forest. Having the NPC gun towards the player might be better for this testing build. You can always change it back after the testing period. Otherwise I did a little more testing, aside from the NPC running away they seemed fine on my end, they were pretty convincing at first glance, which is the intended idea.

@Fris0uman
Copy link
Contributor Author

Seems to me that the attitude of the hallucination is also something to test, if it turns out that they always run away for exemple we'll definitly want to change something but if there's a convincing mix of running away and going to the player it might be ok.

@Mcrone617
Copy link

Seems to me that the attitude of the hallucination is also something to test, if it turns out that they always run away for exemple we'll definitly want to change something but if there's a convincing mix of running away and going to the player it might be ok.

Whatever you feel is best, feel free to make changes, I'll probably make the Reddit post in about 5-6 hours or so, so if you want to do some last minute changes feel free, otherwise I'll just post your link around then. I'll let you know about the post also, I encourage you to talk to the people on the reddit thread, often people leave some decent feedback there also.
Thanks for figuring out the release build stuff and doing this in general also. I know its a pain, but hopefully you get some decent feedback from this.

@Mcrone617
Copy link

Just posted the Reddit post, so here's the link: https://www.reddit.com/r/cataclysmdda/comments/bd8k91/pr_testing_needed_on_hallucinatory_npcs/
Let me know if I messed up describing your PR or something, but I tried to do it justice, I also proposed a challenge with it, so hopefully you should get some decent feedback. Thanks again for doing this!

@ZhilkinSerg ZhilkinSerg removed their assignment Apr 21, 2019
src/npcmove.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg self-assigned this May 4, 2019
src/ranged.cpp Outdated Show resolved Hide resolved
Fris0uman and others added 3 commits May 11, 2019 11:58
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
@ZhilkinSerg ZhilkinSerg removed their assignment May 11, 2019
@kevingranade kevingranade merged commit d5d497a into CleverRaven:master May 11, 2019
@ZhilkinSerg
Copy link
Contributor

I keep getting
ERROR MAIN : ..\src\bodypart.cpp:136 [convert_bp] Invalid body part token -858993460
when the games tries to spawn an hallucination npc and I really don't know how to fixe that.

That happens because bp_hit field of dealt_damage_instance struct is not initialized by default - thus it will have some random nonsense value.

You need to assign default value in that struct or better yet set some random value like here:

body_part bp_hit;
double hit_value = missed_by + rng_float( -0.5, 0.5 );
// Headshots considered elsewhere
if( hit_value <= 0.4 ) {
bp_hit = bp_torso;
} else if( one_in( 4 ) ) {
if( one_in( 2 ) ) {
bp_hit = bp_leg_l;
} else {
bp_hit = bp_leg_r;
}
} else {
if( one_in( 2 ) ) {
bp_hit = bp_arm_l;
} else {
bp_hit = bp_arm_r;
}
}

Caused #30555, btw.

@Fris0uman Fris0uman deleted the Hallu_Npc branch June 29, 2019 17:38
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` <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants