hi guys, just another quick question
in my game when the guy runs into the health/ammo box the disappear and adds health/ammo. My issue is, how do i make them respawn after a little while. i tried some stuff with delays and edit object add object but that didnt work
thanks for your help
hi guys, just another quick question
Added an example file on a possible solution with logic bricks.
healthandammo.blend (421 KB)
I’m using an empty as placeholder for the health or ammo, in my case just added a monkey instead. When you click on it (mouse left button + mouse over) on the monkey object, it will end the object and set a property “prop” to false which will than delay and after 120 frames ( 2 seconds) add a monkey object again on the empty and sets the property “prop” to true again.
Ofcourse you will need to send some kind of message to your health or ammo to add a certain amount, haven’t done that in this example, just take a look at the file and if something isn’t clear ask it here.
EDIT: .blend file was made in Blender 2.58 or something.
EDIT again: Found a little mistake in the file, trying to fix it atm.
EDIT: Yes, another edit the problem with my file is that it will keep adding more and more monkey ojects on the same place, you might only see one but it keeps adding them. I’m sure it must be easy to fix but haven’t got time right now. Hope the file might help you with your thinking process.
sorry, i dont understand what you are trying to show with this file. thanks for you help
A way to respawn objects using an empty object.
- The empty object will be placed on the location you want respawnable objects/items.
- The empty object will add the desired object which is on a invinsible layer.
- When you take the added object (by going over it or clicking on it or however you want) it will end the object + do what it is suposed to do (add health or ammo) + send a message to a delayed sort of timer to that will than add the object again on the empty.
ok so i used the empy but what would the logic bricks be for getting it back
i have a message respawn and a delay then edit object add object and that doesnt work
thanks so much
The spawn point will have a timer property, and a property sensor set to fire every time it reaches “0”. This will be in both layer 1 and 2 so the message sensor will actually work.
Pickups are all in layer 2, or any non visible layer that the spawn-er also occupies. Pickups have collision sensor that looks for player, and has a message sensor that sends a message to the spawner.
in game :
- Game starts
- Spawner timer defaults to 0, so it automatically spawns a pickup.
- Player collides with pickup, Pickup collision sensor actuates an end object, and sends message to the Pickup spawner to set the timer to -5. Also sends message to add health to the player health meter.
- When the timer counts up to 0 the object spawns again.
If you want a longer delay just add a greater value than -5.
If you want a smooth startup, have the camera obstructed while it draws the level with a “loading screen”, and have the default spawn timer property set to -1.
Have the other spawners offset them so everything does not happen at once.
If you spawn 50 things at the exact same time, you might see a bit of “chop”, or “lag”.
If you want to Jazz it up, have the pickup add some sort of flash, and play a sound when the player collides with it.
ok quick question, when i make the spawn timer property, do i set it as -5 or 5. b/c when i debug it it increments. how do i set it to count down?
YES! got it working thanks a million, you saved me a lot of headache
Ok you got it.
Just to clarify to others… The timers never count down. They always +1.
So… If you want to have a 5 second delay you use a negitive value like -5, and have the action fire on 0
It counts like in real math… -5,-4,-3,-2,-1,0,+1,+2,+3,+4…
To make any property in the timer work you can not use an integer or float value, you need to use an “interval” setting, or for some reason it will not work.
Sorry, I forgot the pitfalls.
Glad you got it working JohnA.