Leshik 0 Опубликовано 14 Октября 2011 (изменено) Всем привет! Попытался создать звук при использовании предмета при помощи скриптов, но при использовании предмета получаю не звук, а вылет: FATAL ERROR [error]Expression : fatal error [error]Function : CScriptEngine::lua_error [error]File : E:\stalker\patch_1_0004\xr_3da\xrGame\script_engine.cpp [error]Line : 73 [error]Description : <no expression> [error]Arguments : LUA error: ...:\s.t.a.l.k.e.r\gamedata\scripts\bind_stalker.script:30: attempt to index global 'sound_eat' (a nil value) stack trace: ---------------------------------------------------------------------------------------------------------------------- function actor_binder:net_destroy() if(actor_stats.remove_from_ranking~=nil)then actor_stats.remove_from_ranking(self.object:id()) end -- game_stats.shutdown () db.del_actor(self.object) sr_light.clean_up () self.object:set_callback(callback.inventory_info, nil) self.object:set_callback(callback.article_info, nil) self.object:set_callback(callback.on_item_take, nil) self.object:set_callback(callback.on_item_drop, nil) -- self.object:set_callback(callback.use_object, nil) self.object:set_callback(callback.task_state, nil) self.object:set_callback(callback.level_border_enter, nil) self.object:set_callback(callback.level_border_exit, nil) self.object:set_callback(callback.take_item_from_box, nil) self.object:set_callback(callback.use_object, nil) if sr_psy_antenna.psy_antenna then sr_psy_antenna.psy_antenna:destroy() sr_psy_antenna.psy_antenna = false end xr_sound.stop_all_sound_object() object_binder.net_destroy(self) end ---------------------------------------------------------------------------------------------------------------------- function actor_binder:reinit() object_binder.reinit(self) local npc_id = self.object:id() db.storage[npc_id] = { } self.st = db.storage[npc_id] self.st.pstor = nil self.next_restrictors_update_time = -10000 self.object:set_callback(callback.inventory_info, self.info_callback, self) self.object:set_callback(callback.article_info, self.article_callback, self) self.object:set_callback(callback.on_item_take, self.on_item_take, self) self.object:set_callback(callback.on_item_drop, self.on_item_drop, self) self.object:set_callback(callback.trade_sell_buy_item, self.on_trade, self) -- for game stats --self.object:set_callback(callback.actor_sleep, self.sleep_callback, self) self.object:set_callback(callback.task_state, self.task_callback, self) --self.object:set_callback(callback.map_location_added, self.map_location_added_callback, self) self.object:set_callback(callback.level_border_enter, self.level_border_enter, self) self.object:set_callback(callback.level_border_exit, self.level_border_exit, self) self.object:set_callback(callback.take_item_from_box, self.take_item_from_box, self) self.object:set_callback(callback.use_object, self.use_obj, self) self.object:set_callback(callback.use_object, self.use_object, self) end ---------------------------------------------------------------------------------------------------------------------- А вот сам файл sound_eat function use_snd(obj) local obj_sect = obj:section() local snd if obj_sect == 'medkit' then snd = interface\inv_medkit elseif obj_sect == 'kolbasa' then snd = interface\inv_food elseif obj_sect == 'bandage' then snd = interface\inv_bandage elseif obj_sect == 'vodka' then snd = interface\inv_vodka elseif obj_sect == 'antirad' then snd = interface\inv_pills elseif obj_sect == 'energy_drink' then snd = interface\inv_softdrink end if snd then local snd_obj = xr_sound.get_safe_sound_object(snd) snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0) end end З.Ы. Всё делал по уроку на сталкер инсайд. Изменено 14 Октября 2011 пользователем Leshik Поделиться этим сообщением Ссылка на сообщение