Bug Reports / CONFIRMED - Freeze and unfreeze a player

Author
Message
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 5th Aug 2015 15:26
Hi guys,

I am looking to be able to freeze a player for a certain amount of time and then unfreeze him.

Is there any smooth way to do this?
like:
if blabla and blablabla then
FreezePlayer()
PlaySound(e,0)
--wait 56 seconds for dialog sound file to run from slot 0
StartTimer(e)


---------------------------------------code?
if GetTimer >= 56000 then
UnFreezePlayer()
end

I don't really know how to use that timer really


Thanks for the help
The only stupid questions are those that were never asked.
PM
Bored of the Rings
GameGuru Master
20
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 5th Aug 2015 15:35 Edited at: 5th Aug 2015 15:37
I've been playing around with timers, please see example only code below (note: the example below uses OmegaCore plugin and some of the code is commented out):

Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Aug 2015 18:45
what you have in theory is correct already

if frozen == 0 then
FreezePlayer(e)
PlaySound(e,0)
frozen = 1
StartTimer(e)
else
if GetTimer(e) > 56000 then
UnFreezePlayer(e)
frozen = 2 --optional
end
end
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 5th Aug 2015 19:00
ya know thats so funny because i was going to write "else" there and didnt........code. Yay, I was close! I'm learning,!
The frozen variable is actually nice because then this interaction will only happen once like its supposed to.

final:



Thanks smallg

and to Bored of the Rings That looked way overcomplicated!
The only stupid questions are those that were never asked.
PM
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 5th Aug 2015 20:13 Edited at: 5th Aug 2015 20:19
Wierd stuff.
Freeze commands have to be () and not (e). once corrected it froze me but showed me a new bug. Once unfrozen I was randomly teleported somewhere in the map......consistently

Next wierd thing i used a 16bit stereo and a 16bit mono of the same file and they both were acting like, once i was in the range of the character creator created characters scripted range of 100......the sound played from sound(e,1) was like, playing the first byte of the sound at mega speed making a sort of low volume buzz.....and as soon as i exited this range the sound played perfectly in both cases. (this was without the freeze btw). This also worked repeatedly and consistently.

I even went through the process of testing this with my sounds in many different audiobank folder and it always did the same thing, whether it was stories, ambience, misc.

im getting very frustrated because almost ANYthing I do with sounds its completely bugged out. Ive been working nearly a week now on just getting some sounds played the way i want these 2 "NPC's". This second case is even just using the 1 given sound slot for playable sounds.


GRRRR

Edit: it also did this with regular characters. it wont polay sound(e,1) while within range.......it only plays it if you go in then back out. this defeats my freeze purpose which is also bugged.
So many walls to climb with gameguru.
The only stupid questions are those that were never asked.
PM
cybernescence
GameGuru Master
12
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 6th Aug 2015 01:34
I've found that UnFreezePlayer() appears not to be working in this version ... it seems to crash or hold the script without an error.

Sounds seem OK - the low buzz may be the repeated call of the sound - make sure you are only calling it once or it will start over and over rapidly making a buzz. Try using PlaySoundIfSilent(e,1) rather than PlaySound(e,1) if you don't want to adjust your script too much and see if that helps.
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 6th Aug 2015 02:19
i added a local variable isplaying = 0 etc and it worked and so did the freeze but i got teleported nonetheless
The only stupid questions are those that were never asked.
PM
SoUlFaThEr
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 6th Aug 2015 15:11
It is not teleportation after some testing and paying closer attention. it keeps your last pressed WASD held down while frozen for the duration....kinda like you are still moving and when unfrozen get teleported there.
The only stupid questions are those that were never asked.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Aug 2015 18:48
yep the PlaySound command wont work as you expect unless it's called once and only once otherwise you get that buzzing as it's repeatedly trying to play the sound (as cyber said) - hence why your variable fixes it.
PlaySoundIfSilent(e,0) is a good alternative however it will repeat the sound after if the condition is still true so for a one-time only sound then using a variable is the best option.

as for the teleportation, as you rightly said, it will still register any key presses and mouse movement while "frozen" and, although you can't see it happening, the player will still be "moving" and thus is teleported/facing a new direction after unfreezing.... hopefully it'll get fixed at some point.
for now you can use a hidden object to store the location of the player / place at that location when he is first "frozen" and then teleport him there using the TransportToIfUsed(e) command (it's not perfect but it's better than nothing)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Pirate Myke
Forum Support
15
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th Aug 2015 14:36 Edited at: 7th Aug 2015 14:40
This has been tested and confirmed, and reported.

Thank you.

I am moving this thread to the bug report section.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2025-06-21 05:07:29
Your offset time is: 2025-06-21 05:07:29