Well I am in the process of making a new game and I am having problems with the machine gunner. He patrols and will detect you but he won't shoot. How I am making him shoot is he will shoot like 5 bullets after value B is equal to 0 and it will set variable H to 5 and then every 20 secs it will shoot another bullet oh and his internal flag 1 has to be on but maybe I made something wrong. After H is equal to 0 it will reset B to 20. But i think i need to remake the whole shooting code instead of sorta basing it on a normal shooting for the other enemies. If anybody could help me thanks. I am not used to this kind of shooting like that so I would appreciate the help but I'll keep working on it myself. There has to be a glitch in my code somewhere... I'll give you the mfa for tgf2 If you need to, to get it right... I'm pretty decent with tgf2 but it takes a while for me to get new stuff right. Sorry if it is confusing
Edited by Trooper_959
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
alright here is a download link to the mfa file including the machine gunner code and it's sprite and the player with crappy tgf2 platform movement (the big yellow blocks and blue blocks are for detecting player) so hopefully you'll be able to help by examining it http://www.fileden.com/files/2008/10/29/2164256/unworkingmachinegunner.mfa
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
24th November, 2008 at 23:12:37 -
I was going to say that you should have provided the source. Thanks for that, it definitely helps. However you forgot to tell us what you are actually trying to do. We can't help you if we don't know what you want. When I run it both soliders constantly shoot at the player and sometimes follow him if I jump over them.
hey those yellow blocks are detectors not bullets, and so are the blue ones (i meant to make the detectors invisible). Alright let me re explain... sorry... I want the soldiers once they detect you to shoot like 5 bullets and then stop for like a second and then shoot another five bullets. here is an example picture of what I want so you can get the idea Now I made this in paint but those are what the bullets pretty much look like. sorry for being confusing. I did forget sorry... They aren't really following him but are just patrolling in that direction. I will also tell you this that the big purple blocks change their direction.
Edited by Trooper_959
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
The mfa file i gave a download link to just includes the machine gunner's part in the engine but I can give you the whole engine if you want Even though some of the stuff is unfinished.In case it could help
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
I don't know if I got what you meant, if it's somewhat like my enemies in Epic Commandos then here's what I did.
When the player is detected, I;
->set one alterable value to the amount of bullets I want fired (in my case three)
->Set another alterable value as timer for the bullets (i.e time between fired bullets, in my case 30 (mmf loops))
->set a flag on to restrict any other action except shooting
Then I have the actions;
When flag 0 is on+number of fired bullets is greater than 0--> Always subtract 1 from (timer value)
(timer value)is equal to 0--> fire bullet, subtract 1 from (fired bullets), set (timer value) to 30
(fired bullets) is equal to 0-->set flag 0 off.
This process will repeat itself for as many loops as initiated in (fired bullets).
Just make sure that you restrict your other actions with a "flag [whatever] is off".
I get that this isn't exactly what you were afer, but with a little tweaking I'm sure you'd pull it off.
Yea go ahead and not be constructive moren11... I'm not the freaking best with Tgf2 but neither am I the worst jeez.... I am just trying to make a game with the knowledge I know... Trying to do something for the fun of it. Oh and thanks Eternal Man, I'll try it out but I might to have to do this crap on my own and make my own code but ill try it out thanks again.
Edited by Trooper_959
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
I don't have MMF2 yet, otherwise I'd dl your mfa and help you out.
Eternal Entertainment's Code'n'Art Man
E_E = All Indie
...actually Ell Endie, but whatever.
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
26th November, 2008 at 13:54:55 -
Hey I did this in 5 minutes, because I have to go out. But now that you've actually told us what you would like us to help you with, it has made it much easier
This does not include direction detection or stopping. But in a few lines of code it is a much simpler way of shooting a few bullets in a row. You could probably add the rest yourself. Feel free to ask for any help.
Hey! THat is exactly what I wanted! Thanks! I'll try to fix it so it only does that when it detects the player and stuff
Lol i've never done custom variables before...
Edited by Trooper_959
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
26th November, 2008 at 22:38:33 -
Custom variables are quite simple when you get used to them. They're just counters that you can't see. Make sure you label your counters, because when you have heaps it's much easier to understand "Reload" than it is "Alterable Value D".
Just incase it wasn't clear:
ShootTimer = Time between bullets (Set a higher number after a shot for a longer time.)
Reload = Time before the soldier can shoot again after 5 bullets.
BulletsFired = How many bullets he shoots before reload.
I know its been about a month after this but i meant to tell you that I did get it to work and im starting to get more progress made on the game. I'll try to get custom variables used so i can remember how my engine works. If i can figure out how to label variables...
Edited by Trooper_959
Is it really worth it to go onto the battlefield? I GOT A CUSTOM RATING SEE???
To label variables just click on the object you want and look accross to it's properties panel. Find the tab with a-z on it and click "add new" then right click on the variable you just made and select "rename". I'm in bed, typing this on my iPod so I don't have mmf with me at the moment but I'm pretty sure that's right.