Page 1 of 1

Need Help With a NPC Scene

Posted: Wed Oct 29, 2008 7:19 pm
by shiftey
I have an NPC who you must fight until he reaches low health (right now it seems I can only use the HalfHealth I/O). Once he reaches the threshold, he falls to the floor and begs you not to kill him (I already made the vcd file).If you shoot him he dies, otherwise you can press USE and he'll change relationship to ally and start following you around and giving you ammo.

Whats the best way to accomplish all of this? I have already set up the relationship changes, but I can't get him to fall down, talk, then get up and follow when you press USE.

Also, is there a way to set an Output when he reaches a specific health level? Other than "OnHalfHealth."

Posted: Wed Oct 29, 2008 9:41 pm
by fug4life
Not sure about the rest but Halfhealth, you might be able to get it to fire the correct output when he reaches a quater (halfhealth again) I know I used to have my striders fire their cannon, and on the Halfhealth output it would keep firing on dividing by 2 until dead.

Posted: Wed Oct 29, 2008 10:15 pm
by shiftey
How exactly does that work? Doesn't HalfHealth mean half of the full health?

Posted: Wed Oct 29, 2008 10:38 pm
by fug4life
I think if fire only once is not checked.

As a test use a math_counter with a intial Value 0 and max Value of 2 and the npc 'OnHalfHealth counter Add 1'

And have the math_counter turn on a light or sprite or something OnHitMax.

Posted: Thu Oct 30, 2008 12:21 am
by shiftey
This sounds like something that could probably be coded into the fgd.

Posted: Thu Oct 30, 2008 9:39 pm
by shiftey
Come on I know you people can give me a good answer to my first post. I mean there are plently of people here who make good maps with NPCs in them.

I suck at NPC scripting, its my weakness and I need some help. Gimme a hand...

Posted: Fri Oct 31, 2008 7:24 am
by DaMaN
Umm... I dunno. You can always do the good old "OnHalfHealth SetHealth 100", or better yet "OnHalfHealth mathCounter Add 1" mathCounter "OnMax beginsequence" type thingy. That'd be my way to do it.

I.E.: When the npc is at half health, set it's health to full and add one to a counter.
When the counter hits max, do the sequence.
When you do the sequence, set his health to 1 so the players can easily blow his brains out if they don't want him.

Tada!

Posted: Sat Nov 01, 2008 5:39 pm
by shiftey
Is there a way to hide his health and name while all that is happening?

EDIT: Also, I got the scenes to work, but I have two questions:

1. How does the player downloading my map get the scene files working? Don't they need to build the scenes.image file?

2. How do I make my npc squadmate not a complete retard? As it is right now he can only figure out how to follow me or my commands if its within 5 ft of him and there isn't anything in his way. He gets stuck running into a takeout box...it's quite depressing. info_nodes? I hope not :'(

Posted: Sun Nov 09, 2008 8:47 pm
by shiftey
My previous post still applies. I haven't found an answer to those ^^^. But I have another question regarding this NPC, so I didn't think it necessary to start another post seeing how I make like 100 threads a day.

Anyway..I set up nodes and checked them in game and they work fine which fixes problem #2 from the above post. However, he sometimes gets stuck on prop_physics or npc_turrets that are nearby and he doesn't follow the player. Is there a way to help him navigate better? Like push obstacles out of his way or shoot them?

Posted: Mon Nov 10, 2008 12:27 pm
by Deathy
I think pakratting the scenes.image should be enough (1st answer).

Make him nocollide to the physics objects.. I think you can do this with logic_collision_pair.

Posted: Mon Nov 10, 2008 12:52 pm
by Blues
As said about ...many... times, pakratting it won't work.
But we could have someone keeping the scenes.image up to date, like, he adds every new scene of every new map and then uploads the new file for everyone to download.

The problem is that if you put a scenes.image in your obsidian\scenes folder every single HL², Ep1 and Ep2 scene also has to be added to this image file as they would be broken otherwise. (oh and if there's hl:s scenes, they need to be added, too)

Or we could just wait until maybe skidz and hyper got a way around the scenes.image... if they ever will...

Posted: Mon Nov 10, 2008 3:13 pm
by Neico
i'm already at rebuilding the old vcd load way + scanning scenes.image before reading any vcd so we will provide all default hl hl2 ep1 ep2 (just all games that can be mounted by default) into that file and only let custom maps use the old vcd way

but i doubt that i will get it working before 1.34 comes out tough

Posted: Mon Nov 10, 2008 4:45 pm
by Blues
Oh, this is great! :)