RyokuHasu Posted July 14, 2011 Author Share Posted July 14, 2011 Ok the armor, sheild, and helmet all have the same problem… none of them have any real defence. Robin said to just give it "damage" and that will give it defence. This was not entirely true, it is stored but never calculated. There is no defence calc function.To add defence follow the simple steps bellow.**SERVER**In modCombatFind "Function GetNpcMaxVital" and add above it```Function GetPlayerDef(ByVal index As Long) As Long Dim DefNum As Long Dim Def As Long GetPlayerDef = 0 Def = 0 ' Check for subscript out of range If IsPlaying(index) = False Or index <= 0 Or index > MAX_PLAYERS Then Exit Function End If If GetPlayerEquipment(index, Armor) > 0 Then DefNum = GetPlayerEquipment(index, Armor) Def = Def + Item(DefNum).Data2 End If If GetPlayerEquipment(index, Helmet) > 0 Then DefNum = GetPlayerEquipment(index, Helmet) Def = Def + Item(DefNum).Data2 End If If GetPlayerEquipment(index, Shield) > 0 Then DefNum = GetPlayerEquipment(index, Shield) Def = Def + Item(DefNum).Data2 End If If Not GetPlayerEquipment(index, Armor) > 0 And Not GetPlayerEquipment(index, Helmet) > 0 And Not GetPlayerEquipment(index, Shield) > 0 Then GetPlayerDef = 0.085 * GetPlayerStat(index, Endurance) + (GetPlayerLevel(index) / 5) Else GetPlayerDef = 0.085 * GetPlayerStat(index, Endurance) * Def + (GetPlayerLevel(index) / 5) End IfEnd Function```now find "Public Sub TryNpcAttackPlayer"above``` If Damage > 0 Then Call NpcAttackPlayer(mapNpcNum, index, Damage) End If```add```Damage = Damage - GetPlayerDef(index)```find "TryPlayerAttackPlayer"above``` If Damage > 0 Then Call PlayerAttackPlayer(attacker, Victim, Damage) Else Call PlayerMsg(attacker, "Your attack does nothing.", BrightRed) End If```add```Damage = Damage - GetPlayerDef(Victim)```**DONE*** * ***Just like a weapon change the Damage value on defence equipment to set the defence value.***Tips**-Player Defence is pretty much calculated the same way as attack, EXCEPT its adding up 3 diffrent values for the defence. (and its using END instead of STR)-Keep the defence values of each item about 4-5 times lower than the matching weapon.-Make sure NPCs and Players can still attack when the defending player is at the generaly the same level.-If you need to lower the outcome of the defence only lower the bolded number or raise the red numberGetPlayerDef = **0.085** * GetPlayerStat(index, Endurance) * Def + (GetPlayerLevel(index) / 5) Link to comment Share on other sites More sharing options...
Justn Posted July 14, 2011 Share Posted July 14, 2011 lol awesome man u read my mind i was tryin to get something like this…Already added it and it was very simple to add my extra equipment slots :cheesy: Link to comment Share on other sites More sharing options...
RyokuHasu Posted July 14, 2011 Author Share Posted July 14, 2011 @Justn:> lol awesome man u read my mind i was tryin to get something like this…> > Already added it and it was very simple to add my extra equipment slots :cheesy:=D thats great… >.< but in your case I would either lower the equation like i showed how, or lower defence for each item.if you have more items with difence you are gona rack up an invincible guy if you dont lower somthing. lol but , good luck with the DEF function glad you like it. Link to comment Share on other sites More sharing options...
Justn Posted July 14, 2011 Share Posted July 14, 2011 yes i figured i would lower my items defense just because all ur equations ~~give me a stiffy~~ make me smile thanks bro Link to comment Share on other sites More sharing options...
GKO Posted July 14, 2011 Share Posted July 14, 2011 Instead of the defence always taking down some damage delt, it should have a 1/3 change or even 1/2 chance the take it down instead. Just would balance some things out a little more. Link to comment Share on other sites More sharing options...
RyokuHasu Posted July 14, 2011 Author Share Posted July 14, 2011 Thats a great Idea, OR we can follow the guide lines made simple.@RyokuHasu:> -If you need to lower the outcome of the defence only lower the bolded number or raise the red number> > GetPlayerDef = **0.085** * GetPlayerStat(index, Endurance) * Def + (GetPlayerLevel(index) / 5)Now im not saying your idea isnt great, but the variables I've given allow for precise control of exactly how much is taken off per attack. It might not be the most "noob-friendly" way but those give great control on fine tuning the defence to everyone's individual needs.=3 but you free to do any editing to it you wish after instalation ^_^ no credit is needed. Link to comment Share on other sites More sharing options...
Savents Posted July 17, 2011 Share Posted July 17, 2011 Thanks a lot, I was looking/trying to do something like this, you saved me a lot of time, thanks again. Link to comment Share on other sites More sharing options...
RyokuHasu Posted July 21, 2011 Author Share Posted July 21, 2011 Your quite welcome. ^_^ Link to comment Share on other sites More sharing options...
mmearrccii Posted July 21, 2011 Share Posted July 21, 2011 Like Robin have pointed it out, it is much easier if you just do it with for loop.Like this:```Function GetPlayerDefense(ByVal index As Long) As Long Dim i As Long GetPlayerDefense = 0 ' Check for subscript out of range If IsPlaying(index) = False Or index <= 0 Or index > Player_HighIndex Then Exit Function End If GetPlayerDefense = GetPlayerStat(index, Endurance) For i = 2 To 4 If GetPlayerEquipment(index, i) > 0 Then GetPlayerDefense = GetPlayerDefense + Item(GetPlayerEquipment(index, i)).Data2 End If NextEnd Function``` Link to comment Share on other sites More sharing options...
kahnival Posted April 4, 2012 Share Posted April 4, 2012 This is probably a stupid question…And bare in mind I'm still learning this coding thing...But having now implemented this code I've thought of a question lol.Is this saying that the higher the players Endurance is then the higher the defence...So for example if an NPC was set to do 40 damage and you're shield is set to 10 damage and 10 endurance should it be deducting 20 damage? And is the damage deducting 100% of the time or just every other shot or what not? Link to comment Share on other sites More sharing options...
RyokuHasu Posted April 4, 2012 Author Share Posted April 4, 2012 kinda, It had to be scaled somehow. so yes it pretty much adds extra defense for endurance. Link to comment Share on other sites More sharing options...
kahnival Posted April 4, 2012 Share Posted April 4, 2012 Ah ok cool :)Now to work my way through some of your other tutorials to get my little game ready for work. Link to comment Share on other sites More sharing options...
Matt Posted April 23, 2012 Share Posted April 23, 2012 Will i still have this?>! strenght adds to your max melee hit at str/2adds to your base melee damage reduction from a successful block at str/2adds to your base parry rate at str *0.25>! endurance adds to your max health at end*5>! intelligence adds to your max mana at int*10>! agillity adds to your base armour rating at agi*2adds to your base dodge rate at agi/83.3adds to your base critical rate at agi/52.08>! willpower adds to yur health regen rate at (will*0.8) +6adds to your mana regen ratae at (will/4)+12.5 Link to comment Share on other sites More sharing options...
Snoozey Posted April 23, 2012 Share Posted April 23, 2012 Lets say I don't want endurance to scale. I just want armor only coming from the actual armor pieces.``` If Not GetPlayerEquipment(index, Armor) > 0 And Not GetPlayerEquipment(index, Helmet) > 0 And Not GetPlayerEquipment(index, Shield) > 0 Then GetPlayerDef = 0.085 * GetPlayerStat(index, Endurance) + (GetPlayerLevel(index) / 5) Else GetPlayerDef = 0.085 * GetPlayerStat(index, Endurance) * Def + (GetPlayerLevel(index) / 5) End If```I would change this line``` GetPlayerDef = 0.085 * GetPlayerStat(index, Endurance) * Def + (GetPlayerLevel(index) / 5)```I would delete GetPlayerStat ect. Or am I misreading this code? I believe this would be the only change with your code correct? Link to comment Share on other sites More sharing options...
RyokuHasu Posted April 23, 2012 Author Share Posted April 23, 2012 yes get rid of getplayerstat then =P Link to comment Share on other sites More sharing options...
UzGo Posted July 27, 2012 Share Posted July 27, 2012 Ohhh man !!! First time i try it on EO 3.0 and it didn't work. I was so sad ;;( but i didnt give up and i try it on EO 2.0 and it worked i'm so so so happy thanks to you man!!! Thank you for share !!! Link to comment Share on other sites More sharing options...
DMF Posted April 7, 2013 Share Posted April 7, 2013 ^ UzGo …. hows dat improvment?? as far as ik there shouldnt be a reason for it not to work or subs arnt the same. either way as far as ik this dont got anything todo with rendering, Link to comment Share on other sites More sharing options...
IFX Posted January 16, 2015 Share Posted January 16, 2015 Seems kinda op. The more the health and endurance you have the less damage you take, the faster you level up, the more health and endurance you have the less damage you take, the faster you level up goto start Link to comment Share on other sites More sharing options...
UnGod Posted January 16, 2015 Share Posted January 16, 2015 > Seems kinda op. The more the health and endurance you have the less damage you take, the faster you level up, the more health and endurance you have the less damage you take, the faster you level up goto startwhen you include needing more exp for each level and needing to kill stronger monsters that do more damage to get that exp it makes more sense Link to comment Share on other sites More sharing options...
IFX Posted January 16, 2015 Share Posted January 16, 2015 > when you include needing more exp for each level and needing to kill stronger monsters that do more damage to get that exp it makes more senseI guess you're correct. I still added this system. 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