ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Can't bypass default "use" sound

« Previous 10 events | 1 2 3 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  00:11:30  11 November 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: 6340
Yep.
  02:06:30  11 November 2012
profilee-mailreply Message URLTo the Top
soopytwist
Senior Resident
 

 
On forum: 03/30/2010
Messages: 447
Think I must be missing something

This is in script_sound.ltx:

item_antirad
item_bandage
item_drink
item_food
item_medkit
item_repair
item_vodka_1
item_vodka_2
item_vodka_3

[item_antirad]
type = actor
path = item_usage\item_antirad

[item_bandage]
type = actor
path = item_usage\item_bandage

[item_drink]
type = actor
path = item_usage\item_drink

[item_food]
type = actor
path = item_usage\item_food

[item_medkit]
type = actor
path = item_usage\item_medkit

[item_repair]
type = actor
path = item_usage\item_repair

[item_vodka_1]
type = actor
path = item_usage\item_vodka_1

[item_vodka_2]
type = actor
path = item_usage\item_vodka_2

[item_vodka_3]
type = actor
path = item_usage\item_vodka_3



And this in item_usage.script:

function on_use_item(obj)
  local i_type = items[obj:section()]
  if i_type ~= nil then
    local snd = get_item_sound(i_type)
    xr_sound.set_sound_play(db.actor:id(), snd)
  end
end



And this in bind_stalker.script:

function actor_binder:on_use_item(obj)
  item_usage.on_use_item(obj)
end



Also in bind_stalker.script under function actor_binder:reinit():

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



What I get now is a crash whit this error:

[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\priquel\sources\engine\xrServerEntities\script_engine.cpp
[error]Line          : 180
[error]Description   : <no expression>
[error]Arguments     : LUA error: ....t.a.l.k.e.r. - clear sky\gamedata\scripts\_g.script:975: bad argument #2 to 'format' (string expected, got nil)

  02:22:27  11 November 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: 6340
Whats the line above the crash? _g.script line 975 is abort, so there will be a [LUA][ERROR] line in the log right above the crash section.
  16:20:48  11 November 2012
profilee-mailreply Message URLTo the Top
soopytwist
Senior Resident
 

 
On forum: 03/30/2010
Messages: 447

---QUOTATION---
Whats the line above the crash? _g.script line 975 is abort, so there will be a [LUA][ERROR] line in the log right above the crash section.
---END QUOTATION---



Ah sorry, I didn't see that bit:

! [LUA][ERROR] ERROR: INCORRECT LOAD [_sound_actor_save].[0][47706]

Maybe doesn't like type = actor then?
  23:22:25  11 November 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: 6340
Your missing addition variables for type = actor. If you use type = 3d, it should work fine. Hopefully.
  17:06:24  12 November 2012
profilee-mailreply Message URLTo the Top
soopytwist
Senior Resident
 

 
On forum: 03/30/2010
 

Message edited by:
soopytwist
11/12/2012 17:10:33
Messages: 447

---QUOTATION---
Your missing addition variables for type = actor. If you use type = 3d, it should work fine. Hopefully.
---END QUOTATION---



Nope, already tried type = 3d, same error.

I've been going through how CoP handles item sounds, as I am in effect trying to replicate that in CS. Works a little differently and is not using a script, like you suggested I try for CS. The bind_stalker entry though is more complex as that ties in with the use of anabiotics, which of course CS doesn't have.

Definitely not the .ogg files at fault that's for sure as I pointed my previously sort-of-working script to some vanilla .oggs and the same audio problems occur.

Maybe CS can't have on-item-use sounds?
  00:14:25  13 November 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: 6340
Are you testing these on an existing game? I double checked the crash, and its save related, so it might be that the game doesn't like script sounds being added part way through a game.
  17:02:04  13 November 2012
profilee-mailreply Message URLTo the Top
soopytwist
Senior Resident
 

 
On forum: 03/30/2010
Messages: 447

---QUOTATION---
Are you testing these on an existing game? I double checked the crash, and its save related, so it might be that the game doesn't like script sounds being added part way through a game.
---END QUOTATION---



You're absolutely right, it was the save crashing the game. So I started a new game, everything fine until I actually use an item (from the start I can only afford some food or one antirad)

Error is:


[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\priquel\sources\engine\xrServerEntities\script_engine.cpp
[error]Line          : 180
[error]Description   : <no expression>
[error]Arguments     : LUA error: ....e.r. - clear sky\gamedata\scripts\item_usage.script:2: attempt to index global 'items' (a nil value)



So something in item_usage.script it don't like.


function on_use_item(obj)
  local i_type = items[obj:section()]
  if i_type ~= nil then
    local snd = get_item_sound(i_type)
    xr_sound.set_sound_play(db.actor:id(), snd)
  end
end



Or am I missing something out of this? I got rid of all the other stuff, as we're calling up script.sound.ltx to handle the ogg's.
  00:55:20  14 November 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: 6340
script_sound.ltx

item_antirad
item_bandage
item_drink
item_food
item_medkit
item_repair
item_vodka

[item_antirad]
type = actor
path = item_usage\item_antirad

[item_bandage]
type = actor
path = item_usage\item_bandage

[item_drink]
type = actor
path = item_usage\item_drink

[item_food]
type = actor
path = item_usage\item_food

[item_medkit]
type = actor
path = item_usage\item_medkit

[item_repair]
type = actor
path = item_usage\item_repair

[item_vodka]
type = actor
path = item_usage\item_vodka_
shuffle = rnd


item_usage.script

local items =
{
  bread = "item_food",
  kolbasa = "item_food",
  conserva = "item_food",
  peanuts = "item_food",
  yantar = "item_food",
  energy_drink = "item_drink",
  nonstop_drink = "item_drink",
  vodka = "item_vodka",
  bandage = "item_bandaid",
  medkit = "item_medkit",
  medkit_army = "item_medkit",
  medkit_scientic = "item_medkit",
  antirad = "item_pills",
  repair_kit = "item_repair"
}

function on_use_item(obj)
    local snd = items[obj:section()]
    xr_sound.set_sound_play(db.actor:id(), snd)
end


This should fix it.
In sound_script.ltx, the sound path for item_vodka has a '_' on the end. This tells the game to search for files with a number at the end of them. The shuffle line will tell it to pick a sound at random.
  19:03:45  14 November 2012
profilee-mailreply Message URLTo the Top
soopytwist
Senior Resident
 

 
On forum: 03/30/2010
Messages: 447
You're not going to believe this SetaKat.

After all that - while the game no longer crashes using this new script method, I have the exact same sound issue as before with my original scripts. Using items either play the correct sound or not at all, or they're too quiet to hear clearly or play back in one ear.

I just don't get it. I've already discounted the .ogg's themselves being the issue because if I reference existing vanilla .ogg's the same sound issues occur.

I'm at a loss.
 
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.: Clear Sky Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 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.