Scripts / Sound Zones & Freeze PLayer Query

Author
Message
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 8th Aug 2016 17:43
If I wanted to have the player freeze while a sound is played in the default sound zone script what line would I have to add and where?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 8th Aug 2016 22:32
This could help for starting



You can get comments about sound functions, at the bottom of "global.lua" file.

hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 8th Aug 2016 22:53
Excellent 3com, thanks for that.

I have another question if that's ok.

For another script i'm doing I want to be able to once within 100 distance of an object, press a key, which plays a sound, waits for a few second, and then plays a different sound.

I can easily make a script to play a sound when you press a key, it's playing a second sound after a few seconds I can't work out how to do, timers just don't make sense to me.

Any ideas?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 9th Aug 2016 19:24
Try...



hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 9th Aug 2016 22:48 Edited at: 9th Aug 2016 22:53
Thanks again 3com, much grateful

Sorry to keep bothering you, but I'm trying to build my own hud and hit a snag with sprites.

For some reason I can't get the sprite depth to work, I want the text on top of the sprite, but it's behind, any idea what i'm doing wrong?



see? I am at least trying to learn.... my head hurts now

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Aug 2016 23:38
use
PasteSpritePosition(heart_icon,heart_spr_posx,heart_spr_posy)
TextCenterOnX(heart_tex_posx,heart_tex_posy,1,""..g_PlayerHealth.." / "..g_max_PlayerHealth)

depth only works for sprites on top of other sprites
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 9th Aug 2016 23:55 Edited at: 10th Aug 2016 09:15
Thanks smallg, that's fixed the issue, however it's produced another issue....





Note how there are two sprites on screen? There's only one entry in the script to paste them, but for some reason a second sprite is being pasted in the left hand corner, any ideas?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Aug 2016 09:36
Its the original sprite, paste sprite is like a clone of the sprite and the original sprite position is always 0,0 so you just need to move the sprite off screen when you first create it.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th Aug 2016 09:37 Edited at: 10th Aug 2016 09:41
OK, how would I do that?

Like this?

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 10th Aug 2016 16:55
Quote: "so you just need to move the sprite off screen when you first create it."


Quote: "SetSpritePosition(heart_icon,300,300)"


Move to _init(e) part of the code.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 10th Aug 2016 22:53
Thanks guys, worked perfectly.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 11th Aug 2016 10:32 Edited at: 11th Aug 2016 10:42
If you're interested, here's a mock up of how I plan to have my final HUD



The square items will have their quantities displayed to the right of them (for the flashlight it will be the power %), the ammo, health and lives will have their text cantered on them.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 11th Aug 2016 12:31
nice hud belidos. thats look really professional.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 19th Aug 2016 22:16
@3Com : I've finally gotten around to trying the two scripts you posted.

Neither one works for me.

The first one (freeze unfreeze while playing sound) doesn't seem to unfreeze at all.

The second one (play a sound pause ten second play a second sound), the timer seems to apply to the first sound instead of the second sound, it waits ten seconds then plays both sounds at the same time instead of playing the first sound, pausing ten second, then playing the second sound.


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Aug 2016 23:50
yes because sounds (like animation) need to toggle or they will get stuck trying to play
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2025-01-05 06:45:55
Your offset time is: 2025-01-05 06:45:55