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.

Newcomers DBPro Corner / timer() problem {dbpro}

Author
Message
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 30th Oct 2005 06:57
in my fps, i want there to be an ammo crate that (when picked up) is deleted and then regenerated after not existing for 10 seconds.



If your ammo is less than your max ammo and you pick up an ammo crate, it fills your current ammo to the max. If your ammo is at your max ammo, and your clips is less than you max clips, then it will add 1 to your current clips. Either way, the ammo crate is supposed to be deleted and regenerated after 10 seconds. It seems that it is not deleting the ammo crate when I run over it, and it increases ammo and clips simultaneously as long as neither of them is at its max.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Oct 2005 10:41 Edited at: 30th Oct 2005 10:41
Well the problem is this:

The timer doesn't reset itself every time you call the regen function. The timer is a timer by the computer that will keep running even while you're program is not running.

You have to do something like this:



Also, in you're "make object cube" line, you use "position object 7,100,Ground#,280". Make sure you make the Ground# variable a global, else Ground# will always be 0.0...

Grtz

Sven B

PS: Check the sticky thread about timer() by TDK for a tutorial on timers.

Immunity and Annihalation makes Immunihalation...
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 31st Oct 2005 04:28
Quote: "PS: Check the sticky thread about timer() by TDK for a tutorial on timers."


I just may have to do that because it's not working. I tried to make ground# a global variable but it said
Quote: "Declaration name 'Height(1 is not valid at line 91."


when i get the object 7, it never regenerates no where. not even at 0,0.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Oct 2005 11:10
Try changing the variables name. (Since it says that it isn't a valid declaration name )

Well, I can't really test you're code, but doesn't you're ammo have to regenerate at 100,Ground#,280?

Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2024-11-27 14:30:04
Your offset time is: 2024-11-27 14:30:04