ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
How to health of npc ?

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  19:20:48  21 December 2014
profilee-mailreply Message URLTo the Top
hexef
(Novice)
 
On forum: 05/12/2014
 

Message edited by:
hexef
12/21/2014 19:22:36
Messages: 26
How to increase health of npc ?

Hello.

I am playing Shoc with a companion mod and I want to make my companion tougher,because he dies way too fast,3 bullets and he is out of the game.What I am trying to accomplish is to make him more of a bullet sponge,but I don't know which script function would increase the total hit points of an npc.

Or maybe a function which detects whether a npc is hit or not.I could use that function to make my companion take damage from only 10% of the gunshots he gets hit from.

Any help would be appreciated
  22:39:02  21 December 2014
profilee-mailreply Message URLTo the Top
hexef
(Novice)
 
On forum: 05/12/2014
 

Message edited by:
hexef
12/21/2014 22:41:33
Messages: 26
The title of the thread was supposed to be "How to INCREASE the health of npcs",sorry for the typo

Anyway,I figured out how to make my friendly companions tougher,sort of.
Here is how I did it:in xr_motivator.script file,go to

function motivator_binder:hit_callback(obj, amount, local_direction, who, bone_index)

If you want your current companion to be tougher,like in my case,this is a good example on how to do it:
Inside this function,at the beginning of it,type the following code:

if is_companion(self.object:id() and amount < 0.3) then
self.object.health = 10
xr_sound.set_sound(self.object, nil)
stop_play_sound(self.object)
end

-- is_companion is the function to check whether the npc is my companion or not (that highly depends on the companion mod you are using,the function name could be something else) and amount means how much damage the npc must take(in percentage of his health) in order to be able to regenerate to full health in an instant.In our example,if the npc takes 30% damage from the last hit,then he will regenerate but if he takes more than 30% (amount>0.3) then he will not regenerate or maybe die .If you remove the amount part of the code,he will be invincible

I hope this information will help our fellow stalkers who suffered from their dead comrades.

Happy hunting with your buffed up squadmate ! Be careful though,The Zone doesn't like wanderers in groups,one wrong step and She will spill Her wrath on you
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.