I'm currently making numerous games and only one thing stops me a damage code I've tried numerous codes just want a simple code that does damage over 20 or so spaces and cannot go though other mobs any help is appreciated ill give any information possible also ran into a few other problems like equipping more than one thing at a time but damage is my number one priority right now I can figure that one out on my own thank you to whom ever helps
1
2
ID:1232703
|
|
Ants376 wrote:
I'm currently making numerous games and only one thing stops me a damage code I've tried numerous codes just want a simple code that does damage over 20 or so spaces and cannot go though other mobs any help is appreciated ill give any information possible also ran into a few other problems like equipping more than one thing at a time but damage is my number one priority right now I can figure that one out on my own thank you to whom ever helps You are probably having issues because you are tackling multiple problems that are intertwined within one. It helps to break it down into smaller steps when handling something like this. I'd start by reading this Tutorial Aside from that, you would need to be more specific about what types of attacks you want your players to be able to have. |
Also a good way to reduce Health is..
var/damage = max(1, src.strength*4 - M.defense*2) // dmg var So if your Health is below 0, max() will set M.Health to 0 due to the other number being lower than 0. |
its like a 2d game i want like an arcade looking shooter where you can only side to side and up and down ut still faceing right or lefti want to to damage whatever is in veiw and i got health and whatnot need a deathcheck to see if the codes im useing are right i also want the code to sleep right so it goes good with the animations
|
just want a simple damage, non projectile like damage just saying if so and so in within field of view and is parallel of player mob takes x damage depending on strength wich i rename firepower
|
mob |
thank you Akando5959 i think it worked but i am working on a equip unequip game this is a example of what i have for one of the guns
obj/makarov as you can see there is a lot more i need to do like adding ammunition and whatnot but im just trying to show a little of what im doing if it helps im just not sure how to add in the damage with the shoot action and another problem i don't want the players to be able to stack equip but that's the least of my worries i changed the code you gave me a bit mob and my death check proc is mob if you see anything wrong at all just let me know and ill post what ever is needed to help you guys out help me out. the sleep is for the animation i have for the death animation fyi *update* i used this code on my equipment and it worked obj/makarov shoot(mob/attacked in oview(1)) but i keep getting the error guns.dm:25:error: deathcheck: undefined proc guns.dm:24:warning: if: if statement has no effect need someone to help make my deathcheck proc work just found out that the animation i have for the weapon doesnt go unless there is a mob within the feild of veiw due to the code not good with if and elts statements never got a good enough example of one |
Also for the death check make it attacked.deathcheck()
The way you have it, the shoot verb has no idea what deathcheck() is because it is not defined for obj. In this case we are passing attacked into the objs shoot verb, so we need to access the attacked mobs deathcheck() proc, which we do by doing attacked.deathcheck() |
Yes the oview is only set up to effect a mob with in one space of the shooter. We would then need to change it to a larger range by changing the oview() argument.
|
hmmm i did that and it didnt really do what i was expecting it kinda just made the player and the mob to disappear sometimes the player before the mob wanted the death animation to happen to the attacked than the dead icon state to be active than for the "body" to stay for a few than dissapear. second wanted the attack animation to happen wither a mob is in view or not so i can also still have it so it depleats the ammo once i get the codes in order for that. im sorry for being too much of a pain i am sure to put your byond sn into the credits when i am done with this kinda a amateur at this only recently got into this again. if it helps i am working on 50X50 icons for the players and mobs possibly going bigger for bosses idk if that changes much
|
Try increasing the sleep amount a little at a time until it works the way you want it to. That is what I typically do when I have timing troubles.
shoot(mob/attacked in oview(1)) When you are calling deatcheck() you are not giving it an argument so it just runs every deathcheck. Go ahead and make it deathcheck(attacked) so that it knows who should be being death check. Than we need to change: mob |
What are you doing with your take damage proc? I see you have a mob arg, and then you put damage amount. Is this so you change the name of mob/attacker?
|
im sorry im an amateur with this like i said it would be easier for me if you used some of my DM codes so i know how each statement works i have no clue what you are trying to do there FIREking
|
In response to Ants376
|
|
Just gonna delete my comment, I think my points where out of the scope of your question.
|
1
2
This can be done several ways...
var/dmg = src.Str * 3
Here you've created/calculated a formula onto a variable. Now all you have to do is subtract it from a mob's.... In your case I assume you'll have a var called HP or Health.
M.HP -= dmg // Reducing M's Health by dmg
If this does not answer your question. Try to be a bit more informative, and specific.