Peter120 Posted February 14, 2012 Author Share Posted February 14, 2012 Problem: I've some problem with my HealHP and HealMP spells… It not cost mana, (whatever I set) It can be used on Any NPC (and overheal them :O) And there is no cooldown time (whatever I set)Robin Said:Yeah, it's bugged. Simply take the code which removes MP and add it to the Heal spell switch.Erwin said:You need some programming knowledge to do it..I need: A tutorial to do itPlease Help! Link to comment Share on other sites More sharing options...
erkro1 Posted February 14, 2012 Share Posted February 14, 2012 Learn VB6 or let someone do it for you, this isn't a request board.. Link to comment Share on other sites More sharing options...
Peter120 Posted February 14, 2012 Author Share Posted February 14, 2012 :huh: Link to comment Share on other sites More sharing options...
Robin Posted February 14, 2012 Share Posted February 14, 2012 @Erwin:> Learn VB6 or let someone do it for you, this isn't a request board..Yes it is. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted February 14, 2012 Share Posted February 14, 2012 @Robin:> Yes it is.I feel as if we should start moving these to Questions & Answers and begin doing requests there as well, for categorization purposes. Most systems have posts in the Tutorials board and I wouldn't have a problem to start requests for those that aren't.Anyway, back to answering the original question.* * ***Everything is server-side.****Part 1: Fixing overhealing**Find:```MapNpc(mapNum).Npc(index).Vital(Vitals.HP) = MapNpc(mapNum).Npc(index).Vital(Vitals.HP) + Spell(.Spell).Vital```and under that add:```If MapNpc(mapNum).Npc(index).Vital(Vitals.HP) > GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vitals.HP) Then MapNpc(mapNum).Npc(index).Vital(Vitals.HP) = GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vitals.HP)```>! The line above this sets the NPC's health. However, the next line checks if it is over the maximum amount of health an NPC can have. If it is, it is moved back down.Find:```MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + Damage```and under it add:```If MapNpc(mapNum).Npc(index).Vital(Vital) > GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vital) Then MapNpc(mapNum).Npc(index).Vital(Vital) = GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vital)```>! Same logic as the other NPC fix. You'll note that Vitals.HP will change to Vital because the function is generalized. We can put nicer code in for players because there is already a neat little function for them!Next find:```Player(index).Vital(Vitals.HP) = Player(index).Vital(Vitals.HP) + Spell(.Spell).Vital```_and replace(!) it with:_```SetPlayerVital index, Vitals.HP, GetPlayerVital(index, Vitals.HP) + Spell(.Spell).Vital```>! The SetPlayerVital function already takes care of all this for us, so all we have to do is give it the amount we want to set it to and let it work. For this reason, we don't need the old code that set it.* * *_Part 2: Adding mana cost AND fixing cooldown_The solution here is simple and elegant. Unfortunately many of the lines repeat so it's hard to put it in easy tutorial form. Instead I'll just give you the code to replace.Find this big chunk of code:``` If targetType = TARGET_TYPE_PLAYER Then If Spell(spellnum).Type = SPELL_TYPE_DAMAGEMP Then If CanPlayerAttackPlayer(index, target, True) Then SpellPlayer_Effect VitalType, increment, target, Vital, spellnum End If Else SpellPlayer_Effect VitalType, increment, target, Vital, spellnum End If Else If Spell(spellnum).Type = SPELL_TYPE_DAMAGEMP Then If CanPlayerAttackNpc(index, target, True) Then SpellNpc_Effect VitalType, increment, target, Vital, spellnum, mapNum End If Else SpellNpc_Effect VitalType, increment, target, Vital, spellnum, mapNum End If End If```(hint: modCombat.bas, about line 1316)And replace it with:``` If targetType = TARGET_TYPE_PLAYER Then If Spell(spellnum).Type = SPELL_TYPE_DAMAGEMP Then If CanPlayerAttackPlayer(index, target, True) Then SpellPlayer_Effect VitalType, increment, target, Vital, spellnum DidCast = True End If Else SpellPlayer_Effect VitalType, increment, target, Vital, spellnum DidCast = True End If Else If Spell(spellnum).Type = SPELL_TYPE_DAMAGEMP Then If CanPlayerAttackNpc(index, target, True) Then SpellNpc_Effect VitalType, increment, target, Vital, spellnum, mapNum DidCast = True End If Else SpellNpc_Effect VitalType, increment, target, Vital, spellnum, mapNum DidCast = True End If End If```>! The DidCast flag is used by the other spells to set cooldown and take mana. Unfortunately, the damage MP and heal MP and HP didn't do it.* * ***Done!** As always, post if you have problems. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 It fixed the MP cost and the cooldown time, but i can still heal enemies and overheal them :( Link to comment Share on other sites More sharing options...
Robin Posted February 15, 2012 Share Posted February 15, 2012 Then you didn't follow Part 1 correctly. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 ![](http://www.freemmorpgmaker.com/files/imagehost/pics/9acfdc6efbca35a674708b339f397263.png)I did it correctly Link to comment Share on other sites More sharing options...
Robin Posted February 15, 2012 Share Posted February 15, 2012 That's the 'heal over time' code. You need to add it to the normal healing code too. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 Where is it, please? :embarrassed: Link to comment Share on other sites More sharing options...
Robin Posted February 15, 2012 Share Posted February 15, 2012 @Peter120:> Where is it, please? :embarrassed:It's the exact same line of code. Ctrl + F it. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 I know how to search :DBut I only have one of that line :O Link to comment Share on other sites More sharing options...
erkro1 Posted February 15, 2012 Share Posted February 15, 2012 @Robin:> Yes it is.O, sorry, I thought this was Q&A.Anyways, I think its bad to do all stuff people want for them, it makes then lazy and nobody has made a good game with lazyness so that means we're spending time..Still, I think its good to help people with their programming questions and learn them the bits of VB6. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 You want to help me with cut my help? Link to comment Share on other sites More sharing options...
erkro1 Posted February 15, 2012 Share Posted February 15, 2012 No, requesting things and helping people are two completely different things. Link to comment Share on other sites More sharing options...
Robin Posted February 15, 2012 Share Posted February 15, 2012 @Erwin:> O, sorry, I thought this was Q&A.> Anyways, I think its bad to do all stuff people want for them, it makes then lazy and nobody has made a good game with lazyness so that means we're spending time..> Still, I think its good to help people with their programming questions and learn them the bits of VB6.It's amazing how uppity people get when they learn a bit of knowledge. You were the exact same when you started. Link to comment Share on other sites More sharing options...
Peter120 Posted February 15, 2012 Author Share Posted February 15, 2012 :confused: Link to comment Share on other sites More sharing options...
erkro1 Posted February 15, 2012 Share Posted February 15, 2012 @Robin:> It's amazing how uppity people get when they learn a bit of knowledge. You were the exact same when you started.Yes, but I've learned that I shouldnt be lazy and learn programming so I did.And with: let someone do it for you I meant pay someone for it to do it or find someone who is going to help you, I just want to help you, I was exactly thesame when I started around here, but people said I should learn VB6 and I did, now things are way easier for me.If you want to do it this way I'm ok with that, but I feelt like I should say to you that it really helped me learning VB6. Link to comment Share on other sites More sharing options...
Wing Posted February 15, 2012 Share Posted February 15, 2012 Actually Erwin, this is a good way for him to learn. Soul did just give the fixes, but he explained what the problems were and why the codes will fix them. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted February 15, 2012 Share Posted February 15, 2012 @Peter120:> I did it correctlyI'm sorry, the blame is partially mine :embarrassed:. I saw that the player code had a check for it in SetPlayerVital and I assumed the NPC did something similar, so I didn't check it. You could probably figure it out by yourself (it uses the same logic), but this should fix it anyway.Find:```MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + Damage```and under it add:```If MapNpc(mapNum).Npc(index).Vital(Vital) > GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vital) Then MapNpc(mapNum).Npc(index).Vital(Vital) = GetNpcMaxVital(MapNpc(mapNum).Npc(index).Num, Vital)```>! Same logic as the other NPC fix. You'll note that Vitals.HP will change to Vital because the function is generalized. Link to comment Share on other sites More sharing options...
Peter120 Posted February 16, 2012 Author Share Posted February 16, 2012 It won't save from trolls, but it works now, Thanks! Link to comment Share on other sites More sharing options...
ElementalChaos Posted February 25, 2012 Share Posted February 25, 2012 hey i went and put everything in and when i go to make server.exe it says variable not defined and then high lights VitalType in this line of codeSpellPlayer_Effect VitalType, increment, target, Vital, spellnum Link to comment Share on other sites More sharing options...
ElementalChaos Posted February 27, 2012 Share Posted February 27, 2012 oh and where is the second part to the guide?, some one told me that there was one Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now