Scripts / PlaySound() problem

Author
Message
Grooovy!
16
Years of Service
User Offline
Joined: 22nd Aug 2008
Location: Delray Beach, FL USA
Posted: 31st May 2014 02:50
I created a "spawnthing" scriptlet in lua.



Everything works cool, except the PlaySound(e,0) part (see code below);



I right-clicked on my object to spawn (in this case, the stack of cinderblocks ) and in the object inspector, I set:



Main = spawnthing.lua

Spawn At Start? = No

Sound0 and Sound1 are set.



I tried PlaySound(e,0) and PlaySound(e,1) to no avail.



Am I missing something dumb?





Brook's Law ..."adding manpower to a late software project makes it later"
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st May 2014 14:38
try moving outside of the range and the sound will play

basically the standard PlaySound command has no "is playing?" check so it just constantly tries to play (thus it'll never actually play as it's stuck at the start)



change your code to



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
unfamillia
Forum Support
14
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 1st Jun 2014 01:35
sorry to hijack your thread, but, could one of you help me amend this script to spawn an entity when the player is in a trigger zone?



Cheers



Jay

AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 1st Jun 2014 13:08 Edited at: 1st Jun 2014 13:09
I really would because I really want to get back into learning lua but for about a week i have no main pc so I'm sorry but I can't help here, I tried downloading reloaded to my old laptop but its painfully slow, hopefully I can get back to making free scripts next week but , if your still after anything then let me know and I'll see if I can do it.



I'm also working on making all my scripts heavily commented to make them very simple to know what each and every line does so if you want a copy of them let me know, I got halfway through doing my hunger and thirst script before getting called away and I'll do a more advanced one next week.

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
Dralel
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 4th Nov 2013
Location: UK
Posted: 1st Jun 2014 15:06
It's simple to spawn an entity when the player is in a storyzone, make a check to see if the player is in it or not then use the SpawnEntity LUA command to do that. Also, make sure said entity has the option Spawn at start? UNchecked.



Also, looking forward to that hunger/thirst script.

GPU: GTX 660, CPU: i7 3770 Intel 3.40ghz x4, PSU: 650 Watt, RAM: 8GB DDR3, OS: Win7 Ultimate 64-bit
PM

Login to post a reply

Server time is: 2024-12-22 04:58:00
Your offset time is: 2024-12-22 04:58:00