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

Conversation

Projects
None yet
10 participants
@Fris0uman
Copy link
Contributor

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 some commits Feb 9, 2019

@Fris0uman

This comment has been minimized.

Copy link
Contributor Author

commented Apr 14, 2019

Hallucination don't spawn with a pre determined attitude because the code doesn't use npc template. Which should mean that they can have any attitude random npcs have, and so some will just run away from you.
If that turn out to be a problem I can set an NPC template so that hallucination will alway come and talk to the player.
I just re uploaded the archive without any save in it

@Mcrone617

This comment has been minimized.

Copy link

commented Apr 14, 2019

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

This comment has been minimized.

Copy link
Contributor Author

commented Apr 14, 2019

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

This comment has been minimized.

Copy link

commented Apr 14, 2019

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

This comment has been minimized.

Copy link

commented Apr 14, 2019

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!

Fris0uman added some commits Apr 15, 2019

@ZhilkinSerg ZhilkinSerg removed their assignment Apr 21, 2019

Fris0uman added some commits Apr 24, 2019

Show resolved Hide resolved src/npcmove.cpp Outdated

@ZhilkinSerg ZhilkinSerg self-assigned this May 4, 2019

Show resolved Hide resolved src/ranged.cpp Outdated

Fris0uman and others added some commits May 11, 2019

Update data/json/npcs/talk_tags.json
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
Update src/ranged.cpp
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
fix

@ZhilkinSerg ZhilkinSerg removed their assignment May 11, 2019

@kevingranade kevingranade merged commit d5d497a into CleverRaven:master May 11, 2019

0 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
gorgon-ghprb Build triggered for merge commit.
Details
@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented May 16, 2019

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 Fris0uman:Hallu_Npc branch Jun 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.