12:06:37 19 January 2014 |
|
SacriPan
Senior Resident
 On forum: 09/20/2009
Messages: 319
|
@all
Thanks for you answers
@Vintar
Yeah, I figured that out afterwards
I had the same problem with an other script which had to "unhide" my weapon. It didn't work in my script and I had to do it via the bind_stalker.update() too.
Well, at least, I got it working and the code is not too complicated |
18:31:20 18 January 2014 |
|
ddraig
Senior Resident
On forum: 06/19/2012
Messages: 158
|
There's an addon for OGSE by Jek@n that has a medic included in the Bar.
These are the functions he uses to determine whether or not the actor needs healing:
function need_healing(first_speaker, second_speaker)
if db.actor.health < 1 or db.actor.radiation > 0 or db.actor:get_bleeding() > 0 then
return true
end
return false
end
function lechenie(first_speaker, second_speaker)
db.actor.health = 1
db.actor.radiation = -1
db.actor.bleeding = 1
end
As you can see, it uses "db.actor.bleeding" but OGSE itself uses the spawn bandage/eat bandage method to stop bleeding in its autodoctor features etc, and I'd be more inclined to go for that method rather than the bleeding setting.
It's slightly inelegant, but sometimes you have to be with stalker. I'd imagine it would be better to create a new "bandage" item that has a 0 size icon so it doesn't take up space in the inventory, that is functionally identical to a regular bandage but completely heals, then use that as a workaround. Otherwise you might get into situations where the medic doesn't fully "heal" you if it just uses a regular bandage etc. |
02:04:27 18 January 2014 |
|
SacriPan
Senior Resident
 On forum: 09/20/2009
Messages: 319
|
Ok I got it working.
It's weird though.
I had to spawn the item in the inventory (in my custom script, like before), but then use the eat() function in the bind_stalker.update() function.
How come I can't do this like xRatX in his script? I'm definitely missing something here :\ |
01:42:26 18 January 2014 |
|
SacriPan
Senior Resident
 On forum: 09/20/2009
 Message edited by: SacriPan 01/18/2014 1:49:04
Messages: 319
|
I did spawn a bandage (or a medkit) before doing this but it doesn't do anything.
The object spawns in the actor's inventory, and if I manually use it, it has the intended effect (bandage...), but the function eat(object) doesn't make the actor use the damn bandage.
Am I suppose to rely on a divine intervention or does this function work for some of you?
|
22:33:08 17 January 2014 |
|
SacriPan
Senior Resident
 On forum: 09/20/2009
 Message edited by: SacriPan 01/18/2014 1:41:21
Messages: 319
|
Hi guys.
I got a problem with this:
db.actor:eat(db.actor:object("bandage"))
No matter where I call it from, it doesn't seem to work for me.
I tried "medkit" too but no joy
Any ideas? |
23:43:58 20 January 2013 |
|
xRatx
Senior Resident
 On forum: 06/18/2008
 Message edited by: xRatx 01/20/2013 23:55:31
Messages: 1592
|
I've "ported" that CoP Feature a while ago.
Take a look at it
Script Part
-- CSFM Medic Script File
-- Ported from S.T.A.L.K.E.R. Call of Pripyat
-- Ported by xRatx with the help of Lijenstina
-- Date of creation : 27/06/2012 (Day/Month/Year)
-- Removes Radiation and Bleeding and restores Health.
function medic_healing(first_speaker, second_speaker)
db.actor.health = 1
db.actor.radiation = -1
db.actor:eat(db.actor:object("bandage"))
end
function bandage_medic_spawn(first_speaker, second_speaker)
alife():create("bandage", db.actor:position(), db.actor:level_vertex_id(), db.actor:game_vertex_id(), db.actor:id())
end
-- Checks if player need to be healed
function actor_needs_healing(first_speaker, second_speaker)
if db.actor.health < 1 or
db.actor.radiation > 0 or
db.actor:get_bleeding() > 0 then
return true
end
return false
end
-- Player don't need to be healed!
function actor_dont_need_healing(first_speaker, second_speaker)
return not actor_needs_healing(first_speaker, second_speaker)
end
-- Payment to Medic NPC Function
function payment_for_medic_healing(actor, npc)
dialogs.relocate_money(actor, 1000, "out")
end
Dialog Part :
<dialog id="csfm_medic_dialog">
<phrase_list>
<phrase id="0">
<text>Doctor, I need medical assistance.</text>
<next>1</next>
</phrase>
<phrase id="1">
<text>Let's have a look ... </text>
<next>2</next>
</phrase>
<phrase id="2">
<text>*The doctor is taking a look at me*</text>
<next>21</next>
<next>22</next>
</phrase>
<phrase id="21">
<text>I'll do something for you now.</text>
<precondition>csfm_medic.actor_needs_healing</precondition>
<action>csfm_medic.bandage_medic_spawn</action>
<next>211</next>
</phrase>
<phrase id="22">
<text>You don't need any medical assistance stalker!</text>
<precondition>csfm_medic.actor_dont_need_healing</precondition>
</phrase>
<phrase id="211">
<text>That's better doc. Thank you!</text>
<action>csfm_medic.medic_healing</action>
<action>dialogs.break_dialog</action>
</phrase>
</phrase_list>
</dialog>
|
|