slentara1 0 Posted December 7, 2014 so and so took no damage I'll try it again and let you know. I found that you can represent a range like 1 .. 100, 101 .. 125, etc but I don't know if it'll work with that Share this post Link to post Share on other sites
Coolie 148 Posted December 7, 2014 (edited) Make sure you're adding elsif cases for attack over 200, up until the max atk allowed in your game. It's either that, or your base_damage formula is returning 0. It worked for me, I tested it. Edited December 7, 2014 by William C Share this post Link to post Share on other sites
slentara1 0 Posted December 7, 2014 k I'll check it Share this post Link to post Share on other sites
slentara1 0 Posted December 7, 2014 copied and pasted the script and it didn't work. I don't know why. Share this post Link to post Share on other sites
Coolie 148 Posted December 8, 2014 (edited) Need more information than that. Where did you paste it? It needs to be pasted in Game_BattlerBase. Then you need to set a skill to use the method. I've gone over how to do all of that already. It works fine for me, I've tested it multiple times, with multiple actors, at varying ATK stats. Post exactly what you added in. Edited December 8, 2014 by William C Share this post Link to post Share on other sites
slentara1 0 Posted December 8, 2014 (edited) could you go over how to call the skill again just so I'm sure I'm doing it right Edited December 8, 2014 by slentara1 Share this post Link to post Share on other sites
slentara1 0 Posted December 8, 2014 I copied the script and added it at the bottom of the game_battlerbase above the final 'end' command. in the damage formula of the skill I put 'a.conditional_attack(a, b)' I don't know what's going wrong. Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 If that's all you did, it'd be working just fine (unless you're using a character with over 200 ATK since my example only goes as high as that, you need to add more elsif cases if that's the case). You must have done something else. Did you undo the changes you made to how damage is applied before (when you wanted a float instead of an integer)? If not, I'd start there. Paste your entire Game_BattlerBase (WITH this method that isn't working for you) in a post. Is the game crashing? Is the damage just returning zero? Be specific. Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 damage is just running zero. it's on a new project file, so other than your script everything else is default Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 (edited) *sigh* Listen, I'm trying to help you out here, but you're not doing anything to help me. I asked you to post your Game_BattlerBase script here with the method added in. You completely ignored that. Try this: class Game_BattlerBase def conditional_attack(a, base_damage = 15 if a.atk <= 100 base_damage = base_damage elsif a.atk <= 125 base_damage = base_damage * 2 elsif a.atk <= 150 base_damage = base_damage * 3 elsif a.atk <= 175 base_damage = base_damage * 4 elsif a.atk <= 200 base_damage = base_damage * 5 end final_damage = base_damage.to_i final_damage.to_i end end Please, just add that in a new script UNDER Game_BattlerBase. Then start a new game. Then create a skill. Then give that skill this exact damage formula call. a.conditional_attack(a, If it isn't working, then I repeat, you are doing something wrong. I've tested this about ten times now. Also, did you revert your changes to def make_damage_value? That's another question you didn't answer. Edited December 9, 2014 by William C Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 ok I'm not trying to ignore what you're asking but I'm commenting on my phone because I don't have connection on my computer. I'm not able to copy and paste the scripts Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 (edited) deleted Edited December 9, 2014 by slentara1 Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 Good grief. It doesn't work because you're breaking the script. I said to put it in a NEW SCRIPT UNDER Game_BattlerBase. As in, right click on the script under Game_BattlerBase, click on "Insert" and put the code I gave you in the new empty space it creates. You also still won't tell me if you reverted your changes that you previously made to make_damage_value, when you wanted damage as a float instead of an integer. Come on, man. I want to help, but you gotta give us more information when you want help and answer the questions we ask. We're not mind readers and we can't see what's in your project. You can't just say "it doesn't work." Tell me what is happening. Does the game crash? Or does it just have no effect? If it is crashing, what line is the error message referencing? Do what I said here in the first paragraph of this post. If it still isn't working, then please, answer the questions asked here and be specific. Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 here is the script that I inserted under game_battlerbase. def conditional_attack(a, base_damage = 15 if a.atk <= 100 base_damage = base_damage elsif a.atk <= 125 base_damage = base_damage * 2 elsif a.atk <= 150 base_damage = base_damage * 3 elsif a.atk <= 175 base_damage = base_damage * 4 elsif a.atk <= 200 base_damage = base_damage * 5 end final_damage = base_damage.to_i final_damage.to_i end I created a new script like you said. Created a skill called the formula like you said and it is returning zero damage and my actor has 20 attack. the values I changed earlier are back to there defaults .to_i. I've also attached a screenshot of the skill. If anything is messed up it should be in one of these areas. Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 (edited) ...Why did you remove the first and last line of the last script code I posted? They're required. You can't add a method to a new script without calling a class for it. Edited December 9, 2014 by William C Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 I have the extra lines added now and it still returns zero damage I'm clueless as to why it isn't working. if I send you my project file would you be able to figure it out better? Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 Before you do that, refer to the screenshot of the script I posted, and do the same in a new project (I already know it works, but confirming that you can get it to work in a new project will tell me that something in your actual project is broken). Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 I started a new game and still returns zero damage I don't understand why it isn't working. class Game_BattlerBase def conditional_attack(a, base_damage = 15 if a.atk <= 100 base_damage = base_damage elsif a.atk <= 125 base_damage = base_damage * 2 elsif a.atk <= 150 base_damage = base_damage * 3 elsif a.atk <= 175 base_damage = base_damage * 4 elsif a.atk <= 200 base_damage = base_damage * 5 end final_damage = base_damage.to_i final_damage.to_i end end This how the script is supposed to look right? I've uploaded my script and skill data for you to look at maybe you can see something I can't. Data.zip Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 My friend, please, you have to read the post and do what I'm asking. I didn't say new game. I said new project. This will let me know if you've edited something you weren't supposed to in your current project, because you keep saying you can't get this to work when I've proven that it does work in a new project. I'm asking you to do this to confirm my suspicions. After that, I can take a look at your project and try to find your mistake. We've gone on for three pages of posts now, for one simple damage formula. It's beginning to get frustrating. Attach your project to your next post (not the new one I'm asking you to test, the one you were already working on). 1 Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 I'll try to do what you're asking, but I have added absolutely nothing to any projects except for this script. imagine having just installed the software and opened your first project, that is what I'm working with I've added no event, I haven't even drawn a map or set my starting point all that I have done is add the script. I'm not trying to say your lying about getting it to work, I'm sure you can make it work, but I can't and I'm just as frustrated as you because I don't know anything about scripting and I've fixed everything I did wrong and still can't get it to work. it just keeps coming back as no damage. I'll post the project when my wife is done with the computer, but if I can't get it working today then I'm not gonna worry about it anymore. Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 This is a simple piece of code, with simple implementation. If you're trying all of this in a clean project file, then you're doing something wrong. Here is the project I made to show you that this works: https://www.mediafire.com/?4mituif2xq4qybh If you say you've done nothing in your project but this, then work from this project. Look at the first skill in the database, then look at the script file. You should be able to find your mistake. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted December 9, 2014 (edited) Apparently VX Ace treats decimals less than one as zeros like it does with negative numbers, ex: 0.75 or -20, etc = 0. Here is my damage formula: (a.atk/b.def)*(a.atk+b.def). My issue is when the first part of the formula equals a decimal less than one (b.def>a.atk) it treats it like a zero and deals no damage. I want it to use the decimal anyway instead of making it zero and voiding the whole formula. for example: (12/16)*(12+16) should equal 21 but instead it deals no damage because 12/16= 0.75. I need to get this fixed. You need to write something like 12.0/16 otherwise it uses integer division and you lose your decimals. 3 / 4 = 0 3.0 / 4 = 0.75 Edited December 9, 2014 by Tsukihime Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 William I down loaded the project file, I copied and pasted the first skill and the script into my project and it didn't work. So I copied all the data files from your project into mine and it worked. I replaced the value with the formula I wanted to use and it also worked. So all is well now. Thank you for sticking with me through this. I still don't know what originally went wrong but I appreciate all your help. Share this post Link to post Share on other sites
Coolie 148 Posted December 9, 2014 William I down loaded the project file, I copied and pasted the first skill and the script into my project and it didn't work. So I copied all the data files from your project into mine and it worked. I replaced the value with the formula I wanted to use and it also worked. So all is well now. Thank you for sticking with me through this. I still don't know what originally went wrong but I appreciate all your help. Do you know what that means? It means you edited something, when you kept saying you didn't. Next time, try to keep track of any changes you make. It makes it easier for people here to give you a hand with issue you're experiencing. If you're going to edit a script, a good idea is to make a copy of it, and comment one of the copies out so it's not processed. Then, if you end up breaking the game and don't know what to do to fix it, you can replace it with the copy you made before you started editing things. Share this post Link to post Share on other sites
slentara1 0 Posted December 9, 2014 I'll try to keep up with it from now on. Share this post Link to post Share on other sites