ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
respair kit use problem

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  15:20:39  21 April 2012
profilee-mailreply Message URLTo the Top
olaf1
Senior Resident
 

 
On forum: 01/17/2012
Messages: 240
respair kit use problem

i have a problem when i drop my repair kit his menü open but i don´t will that this menü open i hop that anyone understand my problem


hier is the script

i start the script so

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

				if ps_items then
					ps_items.on_item_drop(obj)
				end

repair_kit.repair_kit_benutzt(obj)

end




and this is the script


function repair_kit_benutzt(item)
	if db.actor:alive() == true then
		if has_alife_info("ui_inventory") then
			if item:section() == "repair_kit" then repair_ui_menu() end
		end
	end
end

function repair_ui_menu()
    level.start_stop_menu(repair_kit(get_hud()), true)
end




i hope that anyone help me thank you
  00:16:39  22 April 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
So you dont want the menu to open?

If yes then comment out the line :
repair_kit.repair_kit_benutzt(obj)


so it looks like :
--repair_kit.repair_kit_benutzt(obj)



and done.
  11:25:17  22 April 2012
profilee-mailreply Message URLTo the Top
olaf1
Senior Resident
 

 
On forum: 01/17/2012
Messages: 240
but i will open the menu when i use it but not when i drop this objeckt it is the same?
  11:51:53  22 April 2012
profilee-mailreply Message URLTo the Top
SetaKat
Ex modder, Zones only ferret and will someday release a game
(Resident)

 

 
On forum: 02/20/2010
Messages: 6342
Heres some sample code. Place into your script, and change the "repair_kit" string to whatever the name of your repair kits item section is.

function on_item_drop(obj)
	if obj:section() == "repair_kit" then
		obj_id = obj:id()
	end
end

function update()
	if obj_id and alife():object(obj_id)==nil then
		repair_ui_menu()
	end
end


myScriptName.on_item_drop(...) gets added to bind_stalker's on_item_drop(), myScriptName.update gets added to bind_stalker's update()
Then it should work correctly.
  12:46:12  22 April 2012
profilee-mailreply Message URLTo the Top
olaf1
Senior Resident
 

 
On forum: 01/17/2012
Messages: 240

---QUOTATION---
Heres some sample code. Place into your script, and change the "repair_kit" string to whatever the name of your repair kits item section is.

function on_item_drop(obj)
	if obj:section() == "repair_kit" then
		obj_id = obj:id()
	end
end

function update()
	if obj_id and alife():object(obj_id)==nil then
		repair_ui_menu()
	end
end


myScriptName.on_item_drop(...) gets added to bind_stalker's on_item_drop(), myScriptName.update gets added to bind_stalker's update()
Then it should work correctly.
---END QUOTATION---




thank you
  12:57:32  22 April 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
Yeah sorry i totally misunderstood your first question.
  13:10:32  22 April 2012
profilee-mailreply Message URLTo the Top
olaf1
Senior Resident
 

 
On forum: 01/17/2012
Messages: 240

---QUOTATION---
Yeah sorry i totally misunderstood your first question.
---END QUOTATION---


it´s OK
  23:57:20  22 April 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
Ok so now I know what you want (I think)

Looking at Fluffy`s code, it will do nothing.

If you want to use on_item_use in SoC then you must add it manually to bind_stalker including all its callbacks, so in function actor_binder: net_destroy() you add the line :
self.object:set_callback(callback.use_object, nil)


in the function actor_binder: reinit() you add the line :
self.object:set_callback(callback.use_object, self.on_use_item, self)


then create a new function like this :
function actor_binder:on_use_item(obj)
	repair_kit.repair_kit_benutzt(obj)
end


and in your function actor_binder: on_item_drop (obj) you do as I said before, you comment out the line like so :
--repair_kit.repair_kit_benutzt(obj)


and now it should only open the menu when you use it.
 
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-2022 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.