thezeus Posted February 5, 2011 Author Share Posted February 5, 2011 Any recommendations for implementing energy. I did it this morning and got relatively close however there were some errors, so I am going to re-attempt it tonight. Upon creating a new game, it calls for the vitals HP MP XP, but for some reason it was giving me an error at the XP callup. If anyone has some quick advice for my re-attempt I'd be willing to take any.I know this isn't much of a question, but I figured if anyone is willing to share in their experience I would appreciate it. Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 5, 2011 Share Posted February 5, 2011 Just copy everything for MP, and rename it to Energy. Then, in your running part of the code, reduce however many points from energy and just do a check. if energy = 0 then no running.This is a really easy implementation. Link to comment Share on other sites More sharing options...
thezeus Posted February 5, 2011 Author Share Posted February 5, 2011 Ya I know, I'm going to do it again within the hour. The variables I found thus far are vitals.mp splayermp maxmp & mp. Anymore I'm forgetting? Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 6, 2011 Share Posted February 6, 2011 no idea :) Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 6, 2011 Share Posted February 6, 2011 right ok….I've added this for you. To demonstrate it working I've added it to the attack system but I'll explain what to do to get it working for your run feature.Find this code in **Sub HandleAttack**```' Reduce energy SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1```Delete it or comment it out or whatever, also in that sub you will find:```SendVital index, Energy```You can delete that or comment it or whatever.It reduces your Energy when you attack, and if you have no Energy is should prevent you from attacking at all.Again, if you don't want to use this for attacking, delete this code in that same sub also:```' can't attack if energy is 0 If GetPlayerVital(index, Energy) < 1 Then PlayerMsg index, "You have no energy", vbRed Exit Sub End If```–--------------------------------------------Right then. I don't have your running code, so here's the steps you need to take in order for it to work properly for you.Remember that VB6 reads code in the order that you put it in, so you will need to add this in the beginning of your "Run" sub routine. It should prevent the player from running if they have 0 energy:```' can't run if energy is 0 If GetPlayerVital(index, Energy) < 1 Then Exit Sub```Now then, while the player is in "run mode" or whatever, you need to add this code every time the player walks to a new grid:```' Reduce energy SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1```And at the end, you need to add this so that it updates the Energy vital on the client side:```SendVital index, Energy```–--------------------------------------------Now if you still don't want that energy feature to work with attacking, then you'll need to remove some code from the client.Find:```If GetPlayerVital(MyIndex, Vitals.Energy) < 1 Then Exit Sub ' no energy, can't attack```Delete it….----------------------------------------------**MAKING ADJUSTMENTS**If you want to make adjustments to the max energy, and regen and all that stuff you'll need to edit these sub routines:**Function GetClassMaxVital****Function GetPlayerVitalRegen**Energy in my system currently uses the Agility stat, but you can adjust this to whatever your preference.Here's the source code, nothing else was edited. I've added a bar for Energy in the clients main game form and also in the item editor.You'll need to test the item editor because I haven't :)You can adjust this code to work however way you want simply by adding those 2 bits of code (The reduce Energy and SendVital bits).Enjoy._**Source Code (No exe files):**_ http://www.miragesource.draignet.com/EO1_5_1.rar Link to comment Share on other sites More sharing options...
thezeus Posted February 6, 2011 Author Share Posted February 6, 2011 Excellent, yes it was the SendVitals that I did not include. Great work, thanks for your help on solving why it wasn't working! Appreciate it! Link to comment Share on other sites More sharing options...
Tvirus06 Posted February 6, 2011 Share Posted February 6, 2011 Yeah, thats what Robin needs to add, Running to EO xD. Link to comment Share on other sites More sharing options...
Fbu Posted February 6, 2011 Share Posted February 6, 2011 @Xlithan:> right ok….> > I've added this for you. To demonstrate it working I've added it to the attack system but I'll explain what to do to get it working for your run feature.> > Find this code in **Sub HandleAttack**> ```> ' Reduce energy> SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1> ```> Delete it or comment it out or whatever, also in that sub you will find:> ```> SendVital index, Energy> ```> You can delete that or comment it or whatever.> > It reduces your Energy when you attack, and if you have no Energy is should prevent you from attacking at all.> Again, if you don't want to use this for attacking, delete this code in that same sub also:> ```> ' can't attack if energy is 0> If GetPlayerVital(index, Energy) < 1 Then> PlayerMsg index, "You have no energy", vbRed> Exit Sub> End If> ```> –--------------------------------------------> > Right then. I don't have your running code, so here's the steps you need to take in order for it to work properly for you.> Remember that VB6 reads code in the order that you put it in, so you will need to add this in the beginning of your "Run" sub routine. It should prevent the player from running if they have 0 energy:> ```> ' can't run if energy is 0> If GetPlayerVital(index, Energy) < 1 Then Exit Sub> ```> Now then, while the player is in "run mode" or whatever, you need to add this code every time the player walks to a new grid:> ```> ' Reduce energy> SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1> ```> And at the end, you need to add this so that it updates the Energy vital on the client side:> ```> SendVital index, Energy> ```> –--------------------------------------------> > Now if you still don't want that energy feature to work with attacking, then you'll need to remove some code from the client.> > Find:> ```> If GetPlayerVital(MyIndex, Vitals.Energy) < 1 Then Exit Sub ' no energy, can't attack> ```> Delete it….> > ----------------------------------------------> > **MAKING ADJUSTMENTS**> > If you want to make adjustments to the max energy, and regen and all that stuff you'll need to edit these sub routines:> > **Function GetClassMaxVital**> > **Function GetPlayerVitalRegen**> > Energy in my system currently uses the Agility stat, but you can adjust this to whatever your preference.> > Here's the source code, nothing else was edited. I've added a bar for Energy in the clients main game form and also in the item editor.> > You'll need to test the item editor because I haven't :)> > You can adjust this code to work however way you want simply by adding those 2 bits of code (The reduce Energy and SendVital bits).> > Enjoy.> > _**Source Code (No exe files):**_ http://www.miragesource.draignet.com/EO1_5_1.rarWow nice post Link to comment Share on other sites More sharing options...
thezeus Posted February 6, 2011 Author Share Posted February 6, 2011 @SnowFox:> Yeah, thats what Robin needs to add, Running to EO xD.All you do is change the walk speed to a higher value than the run speed, or switch the variable names, pretty simple. Link to comment Share on other sites More sharing options...
Robin Posted February 6, 2011 Share Posted February 6, 2011 @SnowFox:> Yeah, thats what Robin needs to add, Running to EO xD.Go away. Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 6, 2011 Share Posted February 6, 2011 Ok Zeus this is what you need to try. I haven't tested this but I'm sure it's right.All server. Try not to handle things too much via the client.In **Sub HandlePlayerMove**Under:```' Prevent hacking If movement < 1 Or movement > 2 Then Exit Sub End If```Add:```' Check energy If movement = 2 Then If GetPlayerVital(index, energy) < 1 Then movement = 1 End If End If```In **Sub PlayerMove**Under:```' They tried to hack If Moved = NO Then Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)) End If```Add:```' Reduce energy SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1 SendVital index, Energy``` Link to comment Share on other sites More sharing options...
thezeus Posted February 6, 2011 Author Share Posted February 6, 2011 It appears that several of the sendvital's have errors within them. I believe you forgot to put Vitals.Energy instead of just Energy. Attempting to debug this as we speak.The man bug is within the SendVital in PlayerAttackNPC. I beleive it is due to index instead of the npc. Once I comment it out, it works as intended. Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 6, 2011 Share Posted February 6, 2011 I never full tested the whole thing out I just wrote stuff down as a guide for you. Link to comment Share on other sites More sharing options...
thezeus Posted February 9, 2011 Author Share Posted February 9, 2011 Now that I've had time to look at this, I've noticed a bug causing energy to be reduced regardless of running or walking due to' Reduce energy SetPlayerVital index, Energy, GetPlayerVital(index, Energy) - 1 SendVital index, Energy Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 13, 2011 Share Posted February 13, 2011 It will need adjusting. I never tested it fully. 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