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 / need enemy respawn code

Author
Message
steel gollum
17
Years of Service
User Offline
Joined: 30th Jan 2007
Location:
Posted: 30th Mar 2007 22:00
can any one give me a enemy respawn code or tell me what i need to do? I want the enemy to respawn some time after i killed the first one. Please help me.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 30th Mar 2007 23:50
What about setting a variable to 1 is the enmy is killed,then when the variable is 1 let a timer run down,when the timer reaches 0 let it set the variable to 2.If the variable is 2 your code will notice it and respawn the enemy.Set the variable to 0 again and then it starts over again.

Thats basicly what to do

steel gollum
17
Years of Service
User Offline
Joined: 30th Jan 2007
Location:
Posted: 31st Mar 2007 00:06
ty
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Apr 2007 06:31 Edited at: 2nd Apr 2007 16:17
But use an array.

It's unlikely that your game will have a single enemy, so an array will let you apply the same method using For..Next loops.

Using a multi-dimensioned array will let you store many pieces of information about lots of enemies.

For example:

Dim EnemyStats(99,9)

will store 10 pieces of info on 100 enemies - the first index being the enemy object number. This might be something like:

EnemyStats(1,0) = 1 - Enemy 1 currently alive
EnemyStats(1,0) = 0 - Enemy 1 currently dead (start timer)

EnemyStats(2,1) = 3 - Enemy 2's patrol group number

EnemyStats(8,2) = 25 - Enemy 8's current health

EnemyStats(4,3) = 1200 - Enemy 4's Respawn X Position
EnemyStats(4,4) = 2 - Enemy 4's Respawn Y Position
EnemyStats(4,5) = 54280 - Enemy 4's Respawn Z Position

...and so on.

Note: Using EnemyStats(EnemyNumber,1) in a loop, you can apply any checks or settings to a group of enemies - like having a batallion which move around and fight together.

TDK_Man

Mr X
19
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 2nd Apr 2007 09:10
And if you're useing DBPro you can use UDT's (which enables dynamic usage of the array).

SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 2nd Apr 2007 12:01 Edited at: 2nd Apr 2007 12:01
and to expand on that...



to see if an enemy is alive, checked its spawned value (of 0 or 1) and check its health value, if 0, sets its spawned value to 0 and kill it


but, like we say, if you are not using DB Pro then you can't use array().blah... would be easier to help if we know for sure which of the two you are using...
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Apr 2007 16:46
Quote: "And if you're useing DBPro"


Good point! I missed that one...

steel gollum, if you read the sticky at the top of the board, it clearly states that you should state which version of DB you are using.

If you are using DBC then Mr X and SimSmall have just wasted their time trying to help you. If not then I have.

All it needs is for everyone who posts in Newcomers to simply add [DBC] or [DBP] at the end of the post subject and everyone is happy!

TDK_Man

Login to post a reply

Server time is: 2024-09-25 19:16:05
Your offset time is: 2024-09-25 19:16:05