Jump to content

Making a Medic NPC that heals other NPCs?


EvilPlushToy

Recommended Posts

Ive been working on this for a few days now and i was able to script an npc to heal themselves and use up a stimpack in the process and be unable to do so if they run out of stimpacks

what i haven't been able to pull off successfully is having a medic in my group of followers that will automatically heal npcs besides themselves. I just want to know if people think this is possible or should i give up on it?

Link to comment
Share on other sites

OMG! Its totally possible. Remember that you are a human being (at leaset I think so, if not then you're probably some super intelligent alien robot race and can do even more) and nothing is impossible when humans put their minds to it. You just need a good script, possibly using some FOSE commands - if you want to check for any NPC following the player, not just specific NPCs that you already know about. Once you locate a ref that is following the player, check his health and if its below a threshold that you can define through dialogue with your medic, that medic can use an AI package to locate the ref and apply stimpaks or super-stimpaks, or Jet or booze or whatever.

 

Okay, wait, the AI packages might be a problem if the refs are unknown...

Link to comment
Share on other sites

OMG! Its totally possible. Remember that you are a human being (at leaset I think so, if not then you're probably some super intelligent alien robot race and can do even more) and nothing is impossible when humans put their minds to it. You just need a good script, possibly using some FOSE commands - if you want to check for any NPC following the player, not just specific NPCs that you already know about. Once you locate a ref that is following the player, check his health and if its below a threshold that you can define through dialogue with your medic, that medic can use an AI package to locate the ref and apply stimpaks or super-stimpaks, or Jet or booze or whatever.

 

Okay, wait, the AI packages might be a problem if the refs are unknown...

 

Haha, awesome answer!

I've actually done most of that, and by ref do you mean the in game refrence ID or the geck refrence (editor ID), that could be my problem. I'm trying to make it specific npcs, not just any npc so that simplifies things i think. I'm not sure how to make the script get the npc's in game refrence id, which is probably what i need since im using duplicates of the same base NPC (they're meant to be expendable soldiers). In any event thanks for the advice you've given so far i think you may have pointed me in the direction i needed to make this work.

Link to comment
Share on other sites

I was thinking about this last night. I had made a follower who self medicates - she uses stimpaks and other DRUGS (Oh my!) on herself based on dialogue, just like in the original Fallout games. So I was thinking that making a medic wouldn't be that much of a stretch. There are two difficulties that I can foresee, getting the Medic to the NPC if its ref (Ya the Editor Reference ID or the in game Reference ID - aren't they the same thing?) is unknown, and getting a nice idle animation to play when the medic is applying his/her trade.

 

If you only use known refs, like CloverRef or CharonRef, then the first part is easy as you can make one AI package for each known NPC. Here's the thing. FOSE commands can allow you to perform a 'ref-walk' to get the NPC refs from any Actor while the game is running, so you could extend the ability to any NPC that any user would have in their game. But you can't make an AI package for an NPC that your mod doesn't know about. But you can place some XMarkers in the game and move them to the refs once they are found and set the XMarker(s) as the target of an AI Package. That would get the medic close. Then if you got the ref to stand still, the Medic could do his little dance of healing and it would look pretty good. The tricky part is doing this while in combat as combat sort of takes over the actions of the Actors. With my little follower girl, I had to force her out of combat to play the self-stimming idle. This wasn't all that good because enemies would still attack her and might even kill her before she would finish the idle. Perhaps I should have added a few additional checks to make sure she wasn't a combat target before applying the non-combat package used to play the idle. Anyway, I'm rambling.

 

Here is the ref-walk code segment that will return all actors who are following the player:

 

Ref rCurRef

set rCurRef to GetFirstRef 200 0 0	;200=All actors, 0=cell depth, 0=I dunno what this last 0 does
Label 10
if rCurRef	
if (rCurRef.GetPackagetarget == player) && (rCurRef.GetCurrentAIpackage == 1)
	;Whoohoo I found a ref thats following the player
	;Add code here for what you want to do now
Endif
Set rCurRef to Pencil01       ;used to prevent the 'apple' bug
set rCurRef to GetNextRef   ;Move to the next ref
Goto 10
Endif

 

If you have questions about this nifty script segment, just ask.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...