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 / Random Respawn in DBPro

Author
Message
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 15th Oct 2005 02:01
I am workin on a FPS and I want the enemy (Object 2), to be regenerated in a random position when he dies. When I put the code in, and killed the enemy, it switched to a weird camera angle and had the enemy randomly respawning all over the place virtually simultaneously. I was wondering, how could I make it so he only regenerates once, but still in a random place?

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Oct 2005 02:21
1. Use AUTOCAM OFF at the top of your program code to stop the camera from jumping around.

2. Not sure why thats happening it should work with the code you've got there, mind posting some more it might be an error elsewhere in the code.


Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Oct 2005 02:25 Edited at: 15th Oct 2005 02:26
The way I see it there's no need for 2 separate if's when one will work for both. I think the major flaw is that you don't change the hit point value back to the way it was (before reaching zero) to make sure that the if statement isn't run again right after it's ran the first time. I added a "suspend for key" in this to show that it is working (without a pause it will appear like it's not working right because the loop is so fast). And there's no need for EnemyHP to be a real number (unless you want to attack the monster with .5 damage).

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Oct 2005 02:28
Ahh good eye didnt see it.


Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 15th Oct 2005 03:12
Quote: "And there's no need for EnemyHP to be a real number (unless you want to attack the monster with .5 damage)."


Ahh, Ruccus' major flaw in all of his programs.

I R tEh Antid0te! ROOOAAAR!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Oct 2005 04:45 Edited at: 15th Oct 2005 04:46
Guess its starting to sound like en excuse, I really mean it though

<EDIT> That, and never adding chapters to the tut when I say I will.


Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 15th Oct 2005 23:37
Speaking of the tut. The new site doesn't seem to have it included. Any thing I'm missing?


BTW the new site looks a lot nicer than the old.

I R tEh Antid0te! ROOOAAAR!
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 16th Oct 2005 04:10
@Grog Grueslayer

For some reason, when I run the program with the code that you wrote, the program initializes, but the screen is black and nothing happens.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Oct 2005 04:14
Quote: "For some reason, when I run the program with the code that you wrote, the program initializes, but the screen is black and nothing happens. "


That's weird... this may sound insulting but you do realize that with "supend for key" the program waits for you to press a key before it goes on... right?
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 16th Oct 2005 04:46
yeah i know that, but the program won't even run. the only key that it responds to is 'Esc' and it goes back to the source code.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Oct 2005 04:57
That's real weird. Did you copy that into your code or try to run it as a stand alone program (i've only ran it as a stand alone since I don't have your entire code). It doesn't have a sync command because I don't have "sync rate" or "sync on" in that code (of course that should be outside the if statement and right before the loop). Occasionally it'll pick a random number that's out of the camera view but by hitting any key several times you should see a sphere eventually. I don't see how this would effect it but have you upgraded Darkbasic Pro to the latest? There's a link at the top of this thread right above the title.
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 16th Oct 2005 06:22
no, i don't have the upgrade but i am downloading it now. Here's my source:

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Oct 2005 07:30 Edited at: 16th Oct 2005 07:31
Ah... I was wondering why that was so familiar... sorry.

It's probably because that loop I removed the # from EnemyHP. Real numbers are for numbers with a decimal point ( like 100.2382 ). If the number is always going to be whole (such as with EnemyHP) there's no need to make them real.

The variables that don't need to be real:

EnemyHP
Ammo
MaxAmmo
Clips
MaxClips
JUMPING
Reload

In this code I didn't remove all the unnecessary real symbols but I did add the combined if statment and made another one combined (the check for spacebar and the start of the jump).

Hope this helps.

Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 17th Oct 2005 20:04
LOL thats ruccus' FPS tut.

Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 18th Oct 2005 00:30
sure is. i tried to tweak and change some stuff around to suit the way i would want it, but it never runs. it will pass the 'building executable' stage, but when the program initializes, it's only the infamous black screen; other weird crap would happen also. oh yeah, i got the upgrade but it screwed my crap up and i had to un-install and re-install darkBASIC Professional all together. i removed a few things from what you wrote and it works fine! thanks a mil!!! damn i love doing this crap!!! this is what i got:

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 18th Oct 2005 01:22
Quote: "oh yeah, i got the upgrade but it screwed my crap up and i had to un-install and re-install darkBASIC Professional all together."


Woah. Sorry about that. I upgraded and it works fine (except for the bugs that annoy me).

Quote: "i removed a few things from what you wrote and it works fine! thanks a mil!!! damn i love doing this crap!!!"


Np Just like hot sauce... programming is addictive.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 18th Oct 2005 04:59
Quote: "LOL thats ruccus' FPS tut."


w00t.


Login to post a reply

Server time is: 2024-11-27 14:34:22
Your offset time is: 2024-11-27 14:34:22