The last time I asked for help I got such good respons so I though I`d ask here again.
The game is an RPG with real time battles, and the problem probably lies within the "combat events". The idea is giving each enemy 2 invisible objects which decide its reach, So far there is only one foe and it`s reach is supposed to be 1.
When the player step into that reach the enemy will hit the player every third second, the first hit should be 3 sec after that the player entered the "attack zone". That way the player might be able to go in close, hit, go back(as if dodge:ing the foes attack), and so on.
This foe is only supposed to hit for one dmg(1 heart!) but for some reason, sometimes it hits for 2dmg!
I think it might has to do with my scratch animation which is an object that spawns on the player when the foe is ready to strike, that object is what actually deals the dmg, but I also feel that it is important with some kind of animation to make the battles a little more "fun". The Player also plays another animation when hit (he "blinks" once), can that be a problem?
Anyway, anyone who would like to take a look could download the gam here (Yes, I use TGF =/ ). Don`t let the grapic scare you, it`s supposed to look like that.
Well from what I found out deals with your last event and your "taking damage" animation. The way you have it setup now is that your player is overlapping when the "slash" spawns, it takes the damage and then flashes. While flashing it stops the "'Slash' overlapping 'Player'" event but when the player finished the flash the "Slash" animation is not finished so the "'Slash' overlapping 'Player'" starts up again thus taking another heart away. By taking out the "blank" frame in that animation it fixed the double damage effect.
I replaced the "blank" frame with a copy of your character but replaced it's color with red, so it shows that he was hurt but keeps the error from occurring.
Hello guys! I'm New! -- I've been new for a year now...haha
There is still one weird thing thou. Might just be me but sometimes when entering the foe`s battle reach he does not wait 3sec to strike as he is supposed to, instead he strikes almost instantly, which could be a problem.
I think it might have to do with how I set the "wait Xsec" event, I admit I was not really sure what I was doing since I never done anything like that before. Suggestions?
I've never used TGF so i don't know whether it uses Alterable Values and Flags, but if they do then I would utilize those. Dedicate "flag 0" for in range and "Alterable Value A" for Attack Timer. Before going into your event editor, set your Alterable Value A how ever long you want it to take to attack.
If player is overlapping "close strike area"
-or-
If player is overlapping "close strike area 2"
-- Set flag 0 ON
This first event it pretty self explanatory.
If flag 0 is ON
-- Substract 1 from Alterable Value A
This next event will start the timer if the Flag is ON
X If player is overlapping "close strike area" X
X If player is overlapping "close strike area 2" X
-- Set flag 0 OFF
-- Set Alterable Value to (whatever you had it set to in the beginning)
This event will make everything reset itself if the player leaves the ranged area.
If Alterable Value A =< 0
-- (do your attack stuff)
-- Set flag 0 OFF
-- Set Alterable Value A to (whatever you had it set to in the beginning)
This event will set off the attack when the timer hits 0. After the attack it will reset itself.
I hope that was easy to understand. If not then let me know.
Hello guys! I'm New! -- I've been new for a year now...haha
Personally, I'd ditch the detectors altogether and compare the distance using a formula.
I took the liberty of making some modifications to your game to demonstrate what I mean.
TGF has Flags and Alterable Values, don`t know how many for each object though..
I understood everything except the timer? Were is the timer? If the attack goes off when the alterable value get <0 then the foe will attack when the player enter the zone?
[EDIT; oh! I missed the part were I was supposed to set the alterable value. Were if not in the event editor can I do this? Thanks.]
Sketchy
I`m not good at using code or TGF, thats why I used detectors (the only way I know). I tried to download your example but all I get is an empty gam file.. D:
I don't have TGF - I saved it using MMF1.5, but I guess it didn't work
Here's the changes anyway;
It's occurred to me that you may need to save your alterable values. If I remember right, TGF doesn't have very many, although it's possible to pack several numbers into one.
Originally Posted by Sketchy I don't have TGF - I saved it using MMF1.5, but I guess it didn't work
Here's the changes anyway;
It's occurred to me that you may need to save your alterable values. If I remember right, TGF doesn't have very many, although it's possible to pack several numbers into one.
Yeah, I've used that method several times. In one of my tactics games Value A held the values of HP, MoveP, and a few other things. Simply put, I did it like this
987
9 = HP
8 = MP
7 = Something Else
1. Divide 100 into 987 = 9
2. Subtract the above result (9) times 100 to = 87
3. Repeat 1 and 2 with 10's
or the left$, right$, and mid$ functions are pretty useful if they exist in TGF. Gets a bit trickier when you are adding zeroes in front of values to force them to a certain length.
Hello, Lonnemyr. I've shortened my name since you were last here, but I also got my old hard drive back, so I now have TGF1 again! However, I can't help you right now, not until Friday, because I have to work.
By the way, I`m trying to set all normal events (like open tresure chests, pushing blocks, etc) in the first frame, and then copy the entire frame with events and everything, delete the "play area" and remodel it. I`m thinking I wont have to redo everything in the event editor everytime if I do this.. but maybe it would be better to select tose "normal events" as global? Are there any drawbacks with global events? I never used them..
Jon Lambert
Good to see you again! It`s ok, The "engine" probably won`t be done untill friday anyway=
Sketchy & Knudde
You`ve gotten me all confused now, I`m open for suggestions for how to make the combat more stable etc but I don`t know how to do what sketchy has done (I`m not even sure what he has done). Please explain it like you would explain something to an idiot
About saving flags and values, The game won`t be that complex.. or big, really. Of course I dont know everything that will be needed yet, but I`m thinking something like 5 (small) dungeons with bosses and "special items". Nothing to fancy though, mostly puzzle solving and a few monsters here and there. And ofc, some puzzles outside the dungeons were you can get some tresures and "stuff".
So far I have done;
*Player movement.
*Pushy blocks which you can push around - every zelda clone has them
*Arrow "blocks" on which player can stand and "PurPur" will be moved to the place were the arrow is pointing. - Thinking about doing other arrow blocks on which you could push those "pushy blocks" and also give purpur an animation when moved by the arrow blocks.
*tresure chest which you can open and get a few gems from.
-----------
If anyone has any suggestions to anything else I should put in this game I will lend you an ear, nothing monster complex though, becuse if I try something like that I will never finish
[EDIT; I updated the file, only new in this one is the "pushy block mongos" which you can push around and the red arrow blocks on which you can pushy the "pushy block mongos" and then they will move in that direction. I also deleted most of the battle events since it was buggy and it seems like someone here could give me a better idea for how to solve it.]
Edited by the Author.
[EDIT2; oh, it seems like I didn`t delete most of the battle events. Still some left... ]
To start with, all your graphics are basically 50x50 pixel squares (or "Tiles"), and they all line up to form a "grid".
All of the active objects in your game have what are known as "Alterable Values" (3 of them in fact - A,B, and C). These work just like counters, except that they are unique to each instance of an object. Even if you have lots of duplicates of "Baddie1", each one has it's own individual set of alterable values.
Flags work in much the same way, but can only be "on" or "off". Think of them as counters whose value can only ever be "0" or "1". You'll generally use them as switches, to "activate" or "deactivate" events.
Let's start with this bit "X( Baddy 1" ) / 50".
Remember that "grid" I was talking about? What this bit does, is find the horizontal grid coordinate of "Baddy 1" like in the diagram above. We do this by dividing its screen coordinate by the width of each individual tile - in this case 50 pixels.
"Y( "Baddy 1" ) / 50" does exactly the same thing with the Y coordinate.
Ignoring the Abs() for now, what we're essentially saying is this;
(Grid X of "Baddie 1" - Grid X of "PurPur") + (Grid Y of "Baddie 1" - Grid Y of "PurPur")
Looking at the example image above, this would be;
( 3 - 1 ) + ( 1 - 0 ) which = 3
Hopefully, you can now see that what we are doing, is finding the distance in grid tiles, between the "Baddy1" and
"PurPur", and setting "Baddy1"'s alterable value to this distance.
Now, back to that "Abs()" business...
"Abs" is a special function that removes the sign from a number. "-10" becomes just plain "10" for example.
So why do we use it here? Well, suppose we change the positions of "Baddy1" and "PurPur".
Our formula would now look like this;
( 1 - 3 ) + ( 2 - 1 ) which = -1
However, the actual distance is still 3. By using Abs() to force all our values to be positive, we get the correct result.
Right, that just about covers Line 11 - onto line 13!
What we're doing here, is comparing the grid distance that we just calculated to "1". Here, "1" represents the maximum attack range of "Baddy1" (measured in grid squares of course). If we used "2" instead of "1", then "Baddy1" could attack "PurPur" from 2 squares away.
We're using another alterable value here - "Alterable Value B". Once we've determined that "PurPur" is within attack range (1 square away) we start to add 1 to Alterable Value B every second.
In line 16, we check to see if alterable value B = 3, as this would mean that "PurPur" has been within attack range for 3 seconds. In this case, we perform all the actions relating to an attack, and reset alterable value B to 0, ready to start timing the next 3 seconds.
Now, let's go back to line 14 for a second. This is to check whether "PurPur" leaves attack range within the 3 seconds.
This way, we know to set alterable value back to 0. Otherwise, "PurPur" could be in attack range for 2 seconds before moving out of range. This would result in alterable value B reaching 2, thus next time "PurPur" moved back into range, it would take just 1 second before damage was dealt, instead of the normal 3 seconds.
Hmmm. You appear to be doing everything right. There's a possibility that TGF may not support the Abs function - you don't seem to have a lot of the buttons in the expression editor that there are in MMF.