Im having a bit of trouble with my spawn system, it works fine somtimes but othertimes it doesent work right, since in both MMF and TGF, the PICK RANDOM OBJECT condition is a bit shakey. Im trying to think of a new system, but having a bit of trouble. Mabye sombody else can show me a difrent way? I just need it so every say.. 10 secs, it sets a number from random 0 - 10, if the number = 1 then create a object from a random location. The object cannot overlap another object aswell. Any ideas?
We are the music makers, we are the dreamers of dreams...
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
4th September, 2003 at 00:27:27 -
Yeah sure:
Every 10 secs - set counter to random(10) + 1
if counter = 1 - create player at 0,0; player.x,y = Random(screenwidth,height); set counter to 0
Well since there is alot of guns, that would take alot of code to make everything move over. Plus, I only want one gun to spawn since it would make the game uneven if a player could get every gun in one spot.
We are the music makers, we are the dreamers of dreams...
Actuley thats just the problem. When I spawn a weapon, I check to see if there is already a weapon overlaping the spawn box. And since groups work when they WANT to, it doesent work all the time. :/ (Taking the line of code that checks overlap, makes it work perfectly)
We are the music makers, we are the dreamers of dreams...
Well again, this system revolves around that one line of code.
X Weapon is overlaping Spawn
That line is *Insert Bad Word*
I tryed checking all weapons instead of checking the group. And for some reason that doesent work, I guess its to much or somthin. If somehow I could check for the group in a box area. This seems to work better, but I want to make it so it auto finds the spawn box, and checks for the group in an area around that spawn. So that if I make a level editor, players can place spawn boxes anywhere they want, and it auto draws a box around it and checks for the group.
Since all the guns stay in the same position, perhaps I should try to ask if a group is at same X,Y pos as spawn box. :/
We are the music makers, we are the dreamers of dreams...
That's true. A while ago I made a spawner that spawns monsters at various locations, but for some reason it wasn't working well. Then it worked, and everything was fine...if you want I can send it to you, as it could probably be easily modified for weapons.(Only one possible problem I can see)
Thats exactly what happned to me, its now stable. But when I add a new weapon, somthin will go wrong and some gun wont spawn. But then it seems to fix it self, I only hope they spawn when I release the game.
We are the music makers, we are the dreamers of dreams...
It must have something to do with the order the events are added to the lines. Might have to be EXACTLY right for it to work properly...and every time you add a new weapon the events are added in the "wrong" order until you rearrange it and it finally starts working again...
I think your exactly right, its a very touchy group of code.
We are the music makers, we are the dreamers of dreams...
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
11th September, 2003 at 00:44:59 -
Actually, that's exactly what my code does.
Every 10 secs - set counter to random(10) + 1
if counter = 1 - create player at 0,0; player.x,y = Random(screenwidth,height); set counter to 0.
If player is overlapping a player
+ pick player at random - destroy player.
^^ This part makes it so the player can't be created on walls, if you don't want him destroyed just change it to:
If player is overlapping a player
+ pick player at random - player.x,y = Random(screenwidth,height)
Assult andy, I didnt think of Picking Random Gun at random, to destroy. Since I tryed making it so, if a gun is overlaping a gun, destroy gun. But then it just destroyed both the guns.
Kramy, I will defintly try this if my spawn code goes wonky again, thank you.
We are the music makers, we are the dreamers of dreams...