troglodite Posted April 12, 2013 Author Share Posted April 12, 2013 Can somebody post again this tutorial named Adding Real Defense??[This was the link](http://www.touchofdeathforums.com/smf/index.php/topic,73579.0.html) but does not exist anymore ![:(](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/sad.png) Link to comment Share on other sites More sharing options...
escfoe2 Posted April 12, 2013 Share Posted April 12, 2013 Well as clearly as possible, explain what you want to know and I'll see if I can't just make you a quick tutorial. I'm afraid the one you're requesting is gone forever. Link to comment Share on other sites More sharing options...
Zopto Posted April 12, 2013 Share Posted April 12, 2013 [EO] adding REAL defence [SERVER ONLY]« on: July 14, 2011, 12:27:35 PM »• QuoteOk 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.SERVERIn 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 IfIf 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 number–-------------------------------------------------------------------------------------------------------------------------i have saved this tutorial in world FROM 2011 xDHope it help you Link to comment Share on other sites More sharing options...
escfoe2 Posted April 12, 2013 Share Posted April 12, 2013 Way to go Zopto. You're the man. Link to comment Share on other sites More sharing options...
troglodite Posted April 12, 2013 Author Share Posted April 12, 2013 Thank you so much!! ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)I will try to make an inteligence defense for damage spells with the help of this codeSolved ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Zopto Posted April 12, 2013 Share Posted April 12, 2013 np any time 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