Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Why is the timer not working in this script?

Author
Message
dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 9th Aug 2009 19:12
Ok first of all I am working with S4 mod V. 2.
Now, in my game you must defuse bombs to open a door.
On each of the bomb scripts you press a bomb, they disappear, and then they activate a dynamic object set to always active.

Once this dynamic object is activated its state is increased by 1.

Once the objects state equals 4 (theres 4 bombs) a door opens.

That part of the scripts works perfectly. Now for my problem:

The script I gave to the dynamic object says every time its state is increased it displays a hud. Then the timer starts and once it reaches 2.5 seconds the hud fades out. That's what would happen if it worked correctly. Here is the script I assign to the dynamic object:


Now what happens is the bomb disappears, the hud is displayed, but the hud stays there and doesn't fade out. So I came to the conclusion that the timers probably aren't working, but I can't see why they shouldn't be.

Any help would be appreciated!

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

meteorite
18
Years of Service
User Offline
Joined: 19th Nov 2006
Location: The Capital Wasteland
Posted: 9th Aug 2009 19:38 Edited at: 9th Aug 2009 19:41
Try this



From what I gather from your description, this should do what you are looking for.

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 9th Aug 2009 19:54
Thanks alot, I'll try it out now.

So from looking at it, I really didn't need the suspend command until the end? Does it stop the timer?
Ah and it looks like I didn't put the :state=0:state=1 after the hud definitions.

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 9th Aug 2009 20:08
Excuse the double post but,

Thanks for trying meteorite but your script didn't work. Could there be a problem with FPSC causing the timers not to work?

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 9th Aug 2009 22:05
Help would nice.

Not to sound pushy but I need this ASAP. Does anyone have any idea why this isn't working?

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 10th Aug 2009 06:38 Edited at: 10th Aug 2009 06:48
I'm not sure, but I think that I ran into this problem in the past and figured out a simple solution.
For some reason the fadeout wouldn't work right when in a timer unless I called it again, like so..

:activated=1:incstate=1,activate=0
:state=1:hudshow=bomb1,timerstart
:state=1,timergreater=2500:hudshow=bomb1,hudfadeout=bomb1,suspend
:state=2:hudshow=bomb2,timerstart
:state=2,timergreater=2500:hudshow=bomb2,hudfadeout=bomb2,suspend
:state=3:hudshow=bomb3,timerstart
:state=3,timergreater=2500:hudshow=bomb3,hudfadeout=bomb3,suspend
:state=4:hudshow=bomb4,timerstart
:state=4,timergreater=2500:hudshow=bomb4,hudfadeout=bomb4,suspend
:state=4:activateifused=1

;End of Script


Try that and see what happens.
I may be mistaken, but if my memory is working right then so should this fix.
Unless the suspend is causing a problem, because I wasn't using that in my stuff in the past.

EDIT
I see another problem though...

Quote: "
;Artificial Intelligence Script

;Header

desc = display huds when bomb is defused

;Triggers

:state=0...


:activated=1:incstate=1,activate=0
:state=1:hudshow=bomb1,timerstart
:state=1,timergreater=2500:hudfadeout=bomb1,suspend
:state=2:hudshow=bomb2,timerstart
:state=2,timergreater=2500:hudfadeout=bomb2,suspend

:state=3:hudshow=bomb3,timerstart
:state=3,timergreater=2500:hudfadeout=bomb3,suspend
:state=4:hudshow=bomb4,timerstart
:state=4,timergreater=2500:hudfadeout=bomb4,suspend
:state=4:activateifused=1

;End of Script"


:state=2:hudshow=bomb2,timerstart
:state=2,timergreater=2500:hudfadeout=bomb2,suspend

The first line shows it.
The second line never leaves the state, so the first line will keep on showing it.

:state=2:hudshow=bomb2,timerstart
:state=2,timergreater=2500:hudfadeout=bomb2,suspend


Should be come...

:state=2:hudshow=bomb2,timerstart,state=3
:state=3,timergreater=2500:hudfadeout=bomb2,suspend

... moving to another state should prevent the perpetual hudshow.
But then you would need to incstate=2 instead of one and start them at 2 having state=1 as a dummy state to fill the void.

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 10th Aug 2009 16:35
Aha! I would have never known it was that. Yeah I can see how that would continually show the hud. Thanks alot Conjured! I'll go test it out once I'm a little more awake

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 11th Aug 2009 00:36
Alright I think the problem was that 2 scripts were calling up huds at the same time and maybe that did something but I really don't know. Thanks Conjured but your script didn't work either. I came up with a different way that I should have done all along. Though it requires me to make a seperate script for each bomb, I'll just have the bomb's script pull up the hud before it gets destroyed. I tested it and it works. I tweaked my script, meteorite's script, and Conjured's script but to no avail. Now I have a headache but hey at least I got it working! Thanks meteorite and Conjured for taking the time to help!!

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 11th Aug 2009 04:32
Quote: "Thanks Conjured but your script didn't work either."

I never gave you a script.
The code I posted was only a suggestion for changes to your script.
It was never intended as a working script, as I was just pointing out the parts I was talking about.
I'm glad you got your effect working though.

dark peanut
15
Years of Service
User Offline
Joined: 31st Dec 2008
Location: USA
Posted: 11th Aug 2009 05:02
Indeed you didn't, sorry I didn't mean anything by it just wanted to say thanks.

dark peanut

Check out my Ultimate Competition Entry here: http://forum.thegamecreators.com/?m=forum_view&t=153854&b=25 Ultimatum: The Final Deadline

Login to post a reply

Server time is: 2024-11-25 05:48:37
Your offset time is: 2024-11-25 05:48:37