ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
[REQ]Eat a Brain to Cure Psy Illness

1 2 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  12:49:29  1 August 2013
profilee-mailreply Message URLTo the Top
Storm Shadow
A machine, a Shadow Machine.
(Resident)

 

 
On forum: 11/14/2007
Messages: 1430
[REQ]Eat a Brain to Cure Psy Illness

Hey everyone,

You know how when you're fighting a Controller, and you get all fucked up by their Psy Attack, and become Psy Ill, as your Psy Bar goes down (the blue bar in your inventory screen). You start seeing double and hearing weird sounds and everything goes all blury, etc... I'm sure you know what I mean.

When you finally kill that Controller, you are sill feeling very Ill and it takes a while for your Psy Health to return to normal. Controllers can spawn a death item, a monster part called Controller Brain (modded feature). Which is a pretty damn good item to get, it has mean as health regen and anti-rad properties and good stuff like that if you eat it. And so it should, you've just worked pretty damn hard to earn it!

But, unfortunately in SHOC engine there is no property for affecting Psy Health when eating an item, like there is for regular health, radiation, bleeding, etc.

Therefore, what I would like to request is a script that detects if you eat a Controller Brain and fully restores your Psy Health when you do...

Is there anyone out there who can help me out with this?

Thanks in advance.

Regards,

Storm Shadow.
  15:59:59  1 August 2013
profilee-mailreply Message URLTo the Top
Steelyglint
Senior Resident
 

 
On forum: 06/06/2009
Messages: 5171
In NS there is 'antizombin' which is supposed to keep you from being zombified by a controller. I imagine it must reduce psi damage, so maybe looking at how that is handled will give you the answer you seek.

.
  20:12:54  1 August 2013
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
08/01/2013 20:14:52
Messages: 319
Hey Shad, try this:


In bind_stalker.script (1.06 patch):

function actor_binder n_item_drop (obj)
level_tasks.proceed(self.object)
--game_stats.update_drop_item (obj, self.object)

--your mod here
local item_used = obj:section()
local psy_hit = hit()

if has_alife_info("ui_inventory" then
if (item_used == "conserva" then
psy_hit.power = 0.7
psy_hit.direction = vector():set( 0, 0, 0 )
psy_hit.impulse = 0
psy_hit.draftsman = db.actor
psy_hit.type = hit.telepatic
db.actor:hit (psy_hit)
end

if (item_used == "energy_drink" then
psy_hit.power = -0.9
psy_hit.direction = vector():set( 0, 0, 0 )
psy_hit.impulse = 0
psy_hit.draftsman = db.actor
psy_hit.type = hit.telepatic
db.actor:hit (psy_hit)
end

end
--your mod here

end



In this example I used the conserva and the energy drink to lose and then gain back your "psy_health". You just have to replace the section of those object by the one you want, and try different values for "psy_hit.power".

Test it out at the rookie camp, conserva and energy drink are just laying there, now we know why

++
  08:21:05  2 August 2013
profilee-mailreply Message URLTo the Top
Storm Shadow
A machine, a Shadow Machine.
(Resident)

 

 
On forum: 11/14/2007
 

Message edited by:
Storm Shadow
08/02/2013 8:21:47
Messages: 1430
Hi, ok thanks heaps, so this is what my bind_stalker looks like now:
--------------------------------------------------------------------------------------
function actor_binder:on_item_drop (obj)
    if obj:clsid() ~= clsid.wpn_ammo then
    level_tasks.proceed(self.object)
	end
    --game_stats.update_drop_item (obj, self.object)
	
	--your mod here
	local item_used	= obj:section()
	local psy_hit = hit()

	if has_alife_info("ui_inventory";) then
	if (item_used == "conserva";) then
	psy_hit.power = 0.7
	psy_hit.direction = vector():set( 0, 0, 0 )
	psy_hit.impulse = 0
	psy_hit.draftsman = db.actor
	psy_hit.type = hit.telepatic
	db.actor:hit (psy_hit)
	end

	if (item_used == "energy_drink";) then
	psy_hit.power = -0.9
	psy_hit.direction = vector():set( 0, 0, 0 )
	psy_hit.impulse = 0
	psy_hit.draftsman = db.actor
	psy_hit.type = hit.telepatic
	db.actor:hit (psy_hit)
	end

	end 
	--your mod here
	end
	
	
	_z.on_item_drop(obj, self.object)
	abc_sleep.uptabc(obj)
	abc_medkit.chk_medlot_object(obj)
    ngc_mod.itemuse(obj)	--NGC_MOD ADDITIONAL
end
--------------------------------------------------------------------------

It dosn't really work to good, yeah.
  12:00:20  2 August 2013
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
Messages: 319
I believe it is crashing

You didn't copy/paste it well

The "end" after the second "--your mod here" has to be deleted
  04:07:47  3 August 2013
profilee-mailreply Message URLTo the Top
Storm Shadow
A machine, a Shadow Machine.
(Resident)

 

 
On forum: 11/14/2007
Messages: 1430

---QUOTATION---
I believe it is crashing

You didn't copy/paste it well

The "end" after the second "--your mod here" has to be deleted
---END QUOTATION---



Thanks man, I've sorted it out now, I just had to remove the smilelys from you code. It's working perfectly now.
---------------------------------------------------------
function actor_binder:on_item_drop (obj)
    if obj:clsid() ~= clsid.wpn_ammo then
		level_tasks.proceed(self.object)
	end
    --game_stats.update_drop_item (obj, self.object)
	
	-- Start Reb v1.2 --Code care of SacriPan
	local item_used	= obj:section()
	local psy_hit = hit()
	if has_alife_info("ui_inventory") then
		if (item_used == "mutant_controller_brain") then
			psy_hit.power = -0.75
			psy_hit.direction = vector():set( 0, 0, 0 )
			psy_hit.impulse = 0
			psy_hit.draftsman = db.actor
			psy_hit.type = hit.telepatic
			db.actor:hit (psy_hit)
		end
	end 
	-- End Reb v1.2 --Code care of SacriPan
		
	_z.on_item_drop(obj, self.object)
	abc_sleep.uptabc(obj)
	abc_medkit.chk_medlot_object(obj)
    ngc_mod.itemuse(obj)	--NGC_MOD ADDITIONAL
end
--------------------------------------------------------

  05:56:48  3 August 2013
profilee-mailreply Message URLTo the Top
SetaKat
Ex modder, Zones only ferret and will someday release a game
(Resident)

 

 
On forum: 02/20/2010
 

Message edited by:
SetaKat
08/03/2013 5:57:37
Messages: 6342
With actor_binder: on_item_drop, its triggered whenever an item leaves your inventory. If you want to have it trigger only when an item is used, you need to enable another callback function, and add the appropriate function.
Use this instead (should work)
function actor_binder:net_destroy()
	...
	self.object:set_callback(callback.use_object, nil)
end

...

function actor_binder:reinit()
	...
	self.object:set_callback(callback.use_object, self.use_object, self)
end

...

function actor_binder:use_object(obj)
	<your code here>
end

  12:36:55  3 August 2013
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
08/03/2013 16:26:04
Messages: 319
Seems you're right.

I will modify this, as I also have to do it for my mod now...
  13:17:53  3 August 2013
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
08/03/2013 14:12:10
Messages: 319
Allright, got it working properly this time, thanks to Setakat's insight.

Though, it differs a bit.

In bind_stalker.script:


--code

function actor_binder:reinit()

...

self.object:set_callback(callback.use_object, self.on_use_item, self) --SACRIPAN

end



--SACRIPAN
function actor_binder: on_use_item(obj)

local item_used = obj:section()
local psy_hit = hit()


if has_alife_info("ui_inventory" ) then
if (item_used == "mutant_controller_brain" ) then
psy_hit.power = -0.75
psy_hit.direction = vector():set( 0, 0, 0 )
psy_hit.impulse = 0
psy_hit.draftsman = db.actor
psy_hit.type = hit.telepatic
db.actor:hit (psy_hit)
end
end


end
--SACRIPAN

--code


Seems like there is no need for the "net_destroy()" function, as it didn't work when I used it.
  15:59:21  3 August 2013
profilee-mailreply Message URLTo the Top
SetaKat
Ex modder, Zones only ferret and will someday release a game
(Resident)

 

 
On forum: 02/20/2010
 

Message edited by:
SetaKat
08/03/2013 16:02:06
Messages: 6342
The net_destory() is a tidy up function, without it, your relying on whatever underlying garbage collector to release your object and any references/links it may have, which may or may not do this. Releasing the callback in net_destroy ensures that the callback will be properly reclaimed by the GC.

Also, the db.actor object does have a psy_health property, which is the mental health. You can get/set this in a similar way to the health/power/radiation property. Its tidier, fewer lines of code, and less of an impact on the engine as well. Might also be worth looking at.
 
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-2021 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.