ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Effector/Postprocess question

Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  07:23:55  30 June 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
You need to post the error log so we can try see whats wrong.
  21:35:05  29 June 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
06/29/2012 21:35:49
Messages: 158
So I've got the script files here, now, and I want to figure out what's going on here.

I've pretty much adapted this from Stalkersoup's way of doing things as it seems pretty consistent with what I want to do:

Under the
actor_binder:reinit()

section it has:


self.object:set_callback(callback.use_object, self.on_use_object, self)



I've made a new function that should be called whenever you use an object like this:


function actor_binder:on_use_object(obj)
	if obj then
		amk_mod.amk_use(obj)
	end
end



In my amk_mod.script file I've got the following function:


function amk_use(obj)
        amk_items.amk_medicine(obj)
        amk_items.amk_attachments(obj)
        amk_items.amk_instruments(obj)
end



The amk_items.script file contains the functions that control what I want to happen when certain items are used (so if I were to double click a guitar/harmonica it would play a brief snippet of music etc.)

So one section sort of looks like this:


function amk_medicine(obj)
        use_antirad(obj)
end




function use_antirad(obj)
    if obj:section() == "antirad" then
    level.add_pp_effector("blur.ppe", 11, false)
    end
end



Each of these functions works fine when I use them on their own, but when I set it up to check these functions in an attempt to clean things up a bit and not have my bind_stalker.script file be huge, it keeps giving me errors and I'm guessing it has to do with the way I'm setting up the script structure.
  17:46:07  27 June 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
Messages: 158

---QUOTATION---
Iirc, the number "11" in this case, is simply just a unique number assigned to that effect. Cant remember about the "false" bit but perhaps it means to repeat or not, not sure.
Btw, your first code you posted looks fine although there was no need to use server object i dont think. Your second piece of code will not play the effect for sixty seconds, rather just once as before and an irrelevant timer will just be using up memory
if i get a chance tonight i'll try hack something together. I have written a simple timer already, it just needs to be adjusted.
---END QUOTATION---



I figured out that just setting it to the ppe effector using add.ppe.effector will play the effector for a short while (which is what I want), so it looks like for this particular case using a timer isn't needed at all.

I do have a slight scripting problem, though, but I'm not at my main computer at the moment so I'm unable to post the relevant info at the moment.
  17:30:21  26 June 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Iirc, the number "11" in this case, is simply just a unique number assigned to that effect. Cant remember about the "false" bit but perhaps it means to repeat or not, not sure.
Btw, your first code you posted looks fine although there was no need to use server object i dont think. Your second piece of code will not play the effect for sixty seconds, rather just once as before and an irrelevant timer will just be using up memory
if i get a chance tonight i'll try hack something together. I have written a simple timer already, it just needs to be adjusted.
  22:28:49  25 June 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
06/25/2012 23:07:11
Messages: 158
Sorry for the additional question:

I've sort of hacked this together from the CoP bind_stalker.script using the function for using anabiotics:


function actor_binder:on_use_item(obj)
if(obj) then
		local s_obj = alife():object(obj:id())
		if(s_obj) and (s_obj:section_name()=="antirad") then
			level.add_pp_effector("blur.ppe", 11, false)
		end
	end
end



My hope with this is that when you use the antirad item it will add the "blur" effector. I'm not sure what the functionality of the two parts after that are ( "11, false" ) .. could they be the time that the effect lasts or something?

For reference, the original anabiotic function was:


function actor_binder:use_inventory_item(obj)
	if(obj) then
		local s_obj = alife():object(obj:id())
		if(s_obj) and (s_obj:section_name()=="drug_anabiotic") then
			xr_effects.disable_ui_only(db.actor, nil)
			level.add_cam_effector("camera_effects\\surge_02.anm", 10, false, "bind_stalker.anabiotic_callback")
			level.add_pp_effector("surge_fade.ppe", 11, false)
			give_info("anabiotic_in_process")
			_G.mus_vol = get_console():get_float("snd_volume_music")
			_G.amb_vol = get_console():get_float("snd_volume_eff")
			get_console():execute("snd_volume_music 0")
			get_console():execute("snd_volume_eff 0")
		end
	end
end



e: I've just realized that since I'm using AMK as a base, there's already timers included in amk.script I think.

I'm thinking along the lines of something like:


function actor_binder:on_use_item(obj)
if(obj) then
		local s_obj = alife():object(obj:id())
		if(s_obj) and (s_obj:section_name()=="antirad") then
                        amk.start_timer("antirad_timer",60,"")
			level.add_pp_effector("blur.ppe", 11, false)
		end
	end
end



I'm thinking this would apply the blur effector for the duration of the timer (60)?
  18:42:29  25 June 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
Messages: 158

---QUOTATION---
i'm On mobile so cant in into too much detail, but what you need are two things.
1. you need to add function on_item_use and all its callbacks to bind stalker (been discussed here quite a few times, try search that function)
2) a timer function that is called by said bind_stalker function that will initiate your effect, and time how long it last, and even when or if it should happen again.
If it is a new item, them You would also need to make it usable by giving it antirad properties for example and just changing the name and visual etc.
---END QUOTATION---



Thanks a lot for the information! Now I know how to do it I've already won half the battle.
  09:32:54  25 June 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
 

Message edited by:
Vintar
06/25/2012 9:38:15
Messages: 6349
i'm On mobile so cant in into too much detail, but what you need are two things.
1. you need to add function on_item_use and all its callbacks to bind stalker (been discussed here quite a few times, try search that function)
2) a timer function that is called by said bind_stalker function that will initiate your effect, and time how long it last, and even when or if it should happen again.
If it is a new item, them You would also need to make it usable by giving it antirad properties for example and just changing the name and visual etc.
  21:48:26  24 June 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
06/25/2012 22:28:08
Messages: 158
e: Oops, edited by mistake.
 
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.