Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting an on/off radio
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#6
RE: Scripting an on/off radio

Hm... You mean, like, click on the item in the inventory to turn the radio on or off (silent hill style)? I think that's somewhat problematic, since items are really designed for two things - to be used on the world entities, and to be combined. These are the events that the game can "detect", IIRC, there's really no way for the script to detect a click on an inventory item. So, I guess you'd have to work something out using those. For example, you could have the items "Radio" and "Radio Batteries", combine them, and use AddCombineCallback to detect this event. Then, under the excuse that the batteries are nearly empty, you could use a timer to turn off the sound after a short while (and replace the combined item "Radio with batteries", with the empty "Radio").
To play the sound, you could simply use PlaySoundAtEntity, passing "Player" as the 3rd parameter (asEntity), or even the PlayGuiSound function.

Anyway, it's just an idea, you'll need to test it out a bit. I'll see if I can come up with something and get back to you, and in the meantime, maybe someone else will have an idea as well.

P.S. If you're making a full conversion: I've seen people were able to replace the lantern with a flashlight; I suppose you can also replace it with other things - like with a radio. In such a scenario, you could use SetLanternLitCallback to turn the radio on or off.
(This post was last modified: 05-04-2013, 11:43 AM by TheGreatCthulhu.)
05-04-2013, 11:37 AM
Find


Messages In This Thread
Scripting an on/off radio - by Kalidus - 05-03-2013, 05:48 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-03-2013, 06:45 PM
RE: Scripting an on/off radio - by Kalidus - 05-04-2013, 07:13 PM
RE: Scripting an on/off radio - by Daemian - 05-04-2013, 10:44 AM
RE: Scripting an on/off radio - by TheGreatCthulhu - 05-04-2013, 11:37 AM
RE: Scripting an on/off radio - by Daemian - 05-04-2013, 10:56 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-04-2013, 07:20 PM
RE: Scripting an on/off radio - by Tomato Cat - 05-04-2013, 08:36 PM
RE: Scripting an on/off radio - by Kalidus - 05-04-2013, 10:57 PM
RE: Scripting an on/off radio - by Daemian - 05-05-2013, 05:10 AM



Users browsing this thread: 1 Guest(s)