I added "playsoundatsprite" function that will play audio at a sprite(obviously). I have expanded the scripttest example function to the following:
-- map_scripttest.lua - this map shows off the new scripting system in shadow warrior.
--
#include swdata/scripts/user.lua
function stagscript_function0(myspriteid, mysectorid)
local playersector = getplayersector(0);
if mysectorid == playersector then
if(getlocalvar(myspriteid, 0) == 0) then -- Only execute the print message if we just entered the sector.
if getlocalvar(myspriteid, 1) == 0 then
displaymessage("Get out of my sector!!")
setlocalvar(myspriteid, 0, 1) -- Signal that we are now in our sector.
playsoundatsprite(DIGI_TINYDICK, myspriteid)
else
displaymessage("Why the hell do you keep coming in my sector!!")
setlocalvar(myspriteid, 0, 1) -- Signal that we are now in our sector.
hurtplayer(0, 30)
playsoundatsprite(DIGI_WARNING, myspriteid)
playsoundatsprite(DIGI_HURTBAD1, myspriteid)
end
end
else
if getlocalvar(myspriteid, 0) == 1 then
setlocalvar(myspriteid, 1, 1) -- Signal that we have entered the sector at least once.
setlocalvar(myspriteid, 0, 0) -- Signal that we have left the sector.
end
end
end
Ninjakitty, on 12 June 2017 - 12:40 PM, said:
I will take a look thanks!