• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM NEED HELP! HIGH SCHOOL PROJECT RPG! NO DAMAGE BEING DEALT TO ENEMY'S.

S

Spencer

Guest
Hello. I have created an RPG from a tutorial I watched from HeartBeast. This is for a class and I need help working on a current issue. I can't seem to find why no damage is being dealt with the enemies. I can take damage, but it won't let me deal any. I had this game working fine (the character was dealing damage) during the weekend and I haven't done any changes to the code since then and now it won't work.... very frustrating. If anyone can fix it or tell me how to fix it, IT would be life-saving. It is due to tmr... The first person to fix this without breaking anything else I WILL PAY YOU for your service!

HERE IS A WINRAR FILE/ZIP OF MY GAME
https://www.dropbox.com/s/ffkd1z9obgc21l6/BioProject.gmx.rar?dl=0
IF THAT DOESNT WORK
https://www.mediafire.com/file/1gtnju7555u38ha/BioProject.gmx.rar
https://www.mediafire.com/file/1gtnju7555u38ha/BioProject.gmx.rar
 
Last edited by a moderator:
I

IngoLingo

Guest
Hello. I have created an RPG from a tutorial I watched from HeartBeast. This is for a class and I need help working on a current issue. I can't seem to find why no damage is being dealt with the enemies. I can take damage, but it won't let me deal any. I had this game working fine (the character was dealing damage) during the weekend and I haven't done any changes to the code since then and now it won't work.... very frustrating. If anyone can fix it or tell me how to fix it, IT would be life-saving. It is due to tmr... The first person to fix this without breaking anything else I WILL PAY YOU for your service!

HERE IS A WINRAR FILE/ZIP OF MY GAME
https://www.dropbox.com/s/ffkd1z9obgc21l6/BioProject.gmx.rar?dl=0
For sure I can take a look at it for you. I am currently at work and can't download anything from dropbox. Think you can copy and past the code you are using for the enemies?
 
S

Spencer

Guest
For sure I can take a look at it for you. I am currently at work and can't download anything from Dropbox. Think you can copy and paste the code you are using for the enemies?
There a lot there. I'll try.

https://gyazo.com/d407a3329e28f51da7e4d58aaf227cbd
https://gyazo.com/942671abda2a026fc52a4e5b71a9bc88
https://gyazo.com/421f56560b7e7bf518f3dc56bbe2ee68
https://gyazo.com/9b126df603fdd872843ca91fd31005ef
https://gyazo.com/ff3f21eb772b86b63c5920f602fca826

I think this is everywhere I used the damage, hp variables. When I run the game and try to damage the enemies it just knocks them back and it seems like I can hit them forever. It was working on Sunday, haven't touched the code since then and somehow it's not working now. If you could help me fix this THAT would be fantastic, because this is the first time anyone has done a video game for a BIO project.
 
N

Noblezim711

Guest
How much money are we talking about? I mean, I don't just help people for free. Also, I fixed it

Obj_damage

Create event:
///Initialize the damage object
global.damnboy = 1;
knockback = 10;
creator = noone;
alarm[0] = 1;

Collision Event:eek:bj_lifeform_partent

///Damage all life forms
if (other.id != creator) {
var otherid;
otherid = other.id;
otherid.hp -= global.damnboy;

if (other.id.hp == 0)
{
instance_destroy(otherid, false);
}
else
{
//Apply the knockback
if (instance_exists(creator)) {
var dir = point_direction(creator.x, creator.y, other.x, other.y);
} else {
var dir = point_direction(x, y, other.x, other.y);
}
var xforce = lengthdir_x(knockback, dir)
var yforce = lengthdir_y(knockback, dir)

with (other) {
physics_apply_impulse(x, y, xforce, yforce);
}
}
}

I accept payment in whole Bitcoins only.
 
Last edited by a moderator:

Soso

Member
It was for your 1st link with hp - damage
My bad tho doesn't really solve your issue with enemies taking damage
 
I

IngoLingo

Guest
There a lot there. I'll try.

https://gyazo.com/d407a3329e28f51da7e4d58aaf227cbd
https://gyazo.com/942671abda2a026fc52a4e5b71a9bc88
https://gyazo.com/421f56560b7e7bf518f3dc56bbe2ee68
https://gyazo.com/9b126df603fdd872843ca91fd31005ef
https://gyazo.com/ff3f21eb772b86b63c5920f602fca826

I think this is everywhere I used the damage, hp variables. When I run the game and try to damage the enemies it just knocks them back and it seems like I can hit them forever. It was working on Sunday, haven't touched the code since then and somehow it's not working now. If you could help me fix this THAT would be fantastic, because this is the first time anyone has done a video game for a BIO project.
Try this.

in the obj_damage on the collision for the obj_lifeform_parent.
replace
Code:
other.hp -= damage;
with
Code:
obj_lifeform_parent.hp -= damage;
If that doesn't work I will download the files and look at the code after work. Hope that your assignment works out.
 

Soso

Member
Wait looks like your also missing a closed bracket } for your 1st if statement in the 1st link code Damage all lifeforms. I think thats might be your issue
 
S

Spencer

Guest
Try this.

in the obj_damage on the collision for the obj_lifeform_parent.
replace
Code:
other.hp -= damage;
with
Code:
obj_lifeform_parent.hp -= damage;
If that doesn't work I will download the files and look at the code after work. Hope that your assignment works out.
That didn't work. Okay! If you could help me fix this I WILL PRAISE you in so many ways!
 
Alright, now we're in business. So to summarize the problem, you aren't able to damage any of the enemies, is that correct?

EDIT:

I don't see where you check that the enemy's hp is less or equal to zero anywhere.
 
S

Spencer

Guest
Alright, now we're in business. So to summarize the problem, you aren't able to damage any of the enemies, is that correct?
Yes, knockback works on them when I hit them. BUT you can hit them as many times as you want and it seems like they just NEVER die. It was working last Sunday, and I haven't touched the code since then. (pretty sure). I used HeartBeasts RPG tutorial to get the basics.
 
N

Noblezim711

Guest
That's the problem that I noticed. I could not see where you check to see if the enemy is dead.

In my fix, if you have a destroy event for the enemy that adds xp or something that is not being done, switch "instance_destroy(otherid, false);" to "instance_destroy(otherid, true);"
 
S

Spencer

Guest
That's the problem that I noticed. I could not see where you check to see if the enemy is dead.

In my fix, if you have a destroy event for the enemy that adds xp or something that is not being done, switch "instance_destroy(otherid, false);" to "instance_destroy(otherid, true);"
To where?
 
S

Spencer

Guest
That's the problem that I noticed. I could not see where you check to see if the enemy is dead.

In my fix, if you have a destroy event for the enemy that adds xp or something that is not being done, switch "instance_destroy(otherid, false);" to "instance_destroy(otherid, true);"
Now they die, but they dont drop XP or the health kits. Could you try and get that to work?
 
S

Spencer

Guest
These are pretty elementary problems, Spencer. It's going to be difficult to learn much if you don't put in a pretty good effort to solve them yourself.
I have been trying for the past 4 hours researching and everything. I need this by tmr and i don't have the kinda time to try this time. This is my first game i have ever made. It was working last when i tried and im confused why its not working anymore.
 
Okay then. So the next problem you are trying to solve is to drop xp when the enemies die? Is the xp an object, or is it good enough to just add xp insantly when an enemy dies?

Wait they are dropping xp and health perfectly fine for me.

I just put this into your obj_damage collision event:

with (other) {
if (hp <= 0) {instance_destroy(); } //<---------------------------
physics_apply_impulse(x, y, xforce, yforce);
}
 
S

Spencer

Guest
Okay then. So the next problem you are trying to solve is to drop xp when the enemies die? Is the xp an object, or is it good enough to just add xp insantly when an enemy dies?
When i had it working it dropped as an object and there was a chance for a health pack to drop. IM actually so confused why it stopped working because i havent touched it since it was working last...
 
N

Noblezim711

Guest
I already told you how to fix it. Go to object damage, under the collision event with the parent object switch "instance_destroy(otherid, false);" to "instance_destroy(otherid, true);"
 
sorry, i have a tendency to edit after posting...

The enemies are still dropping stuff on my computer.

I added this line to the obj_damage collision event:

with (other) {
if (hp <= 0) {instance_destroy(); } //<---------------------------
physics_apply_impulse(x, y, xforce, yforce);
}

I keep forgetting there is an alternate form of the instance_destroy() function. I gotta remember that.
 
S

Spencer

Guest
Okay then. So the next problem you are trying to solve is to drop xp when the enemies die? Is the xp an object, or is it good enough to just add xp insantly when an enemy dies?

Wait they are dropping xp and health perfectly fine for me.

I just put this into your obj_damage collision event:

with (other) {
if (hp <= 0) {instance_destroy(); } //<---------------------------
physics_apply_impulse(x, y, xforce, yforce);
}
Could you send me the project file please and thanks so i can see.
 
That was literally the only change I made to your project. Noblezim711's solution will work also.

This is the obj_damage collision event with obj_lifeform_parent

Code:
///Damage all life forms
if (other.id != creator) {
    other.hp -= damage;
   

   
    //Apply the knockback
    if (instance_exists(creator)) {
        var dir = point_direction(creator.x, creator.y, other.x, other.y);
    } else {
        var dir = point_direction(x, y, other.x, other.y);
    }
    var xforce = lengthdir_x(knockback, dir)
    var yforce = lengthdir_y(knockback, dir)
   
    with (other) {
        if (hp <= 0) { instance_destroy(); }  //<----------------------------------------------------------
        physics_apply_impulse(x, y, xforce, yforce);
    }
   
}

The only change was adding that one line I indicated with an arrow
 
S

Spencer

Guest
That was literally the only change I made to your project. Noblezim711's solution will work also.

This is the obj_damage collision event with obj_lifeform_parent

Code:
///Damage all life forms
if (other.id != creator) {
    other.hp -= damage;
  

  
    //Apply the knockback
    if (instance_exists(creator)) {
        var dir = point_direction(creator.x, creator.y, other.x, other.y);
    } else {
        var dir = point_direction(x, y, other.x, other.y);
    }
    var xforce = lengthdir_x(knockback, dir)
    var yforce = lengthdir_y(knockback, dir)
  
    with (other) {
        if (hp <= 0) { instance_destroy(); }  //<----------------------------------------------------------
        physics_apply_impulse(x, y, xforce, yforce);
    }
  
}

The only change was adding that one line I indicated with an arrow
Thank you both so much!!
 
N

Noblezim711

Guest
I just took a different approach from you. I figured that he had it working so he must have had some way to destroy the instance. I thought maybe it was a problem finding the correct id, or setting the damage state to that instance. It was only after a few moments that I realized that he didn't have a way to discover if the instance should be "dead".
 
Top