Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Server Side] GetPlayerProtection does not work?


My Brave Shine
 Share

Recommended Posts

Hey darlings Eclipcians… i stay working in my owne project.. and.. making tests and more tests... 

when I encounter one situation.. In ModCombat [Server Side] the calcule of "damage" 

Npc and Player 

[Npc x Player] and … [ Player x Player ~ ] 

This not add GetPlayerProtection in reduction of damage total '-' 

that cause a slots of equipaments.. helmet… armor.. and etc.. does nothing work '-' use or not use is whatever... :x ???

i test modific the values (in game) .. values of.. possible Armor of Helmet and Armor... not reduce the damage of Npcs or Player...

Therefore, use equipment is useless.

=====================

I have add in ModCombat, i think.. Sub TryNpcAttackPlayer and TryPlayerAttackPlayer.. on last 

"Damage = Damage"

After all calcules and process of blockamount, and etc... i add...

"Damage = Damage - GetPlayerProtection" 

its correct? has worked, but have cases of the Npc Attacker give HitKill and kill the player '-' 

Anyone can you help me put a calculation that actually works? or, teach my to add in my code one calcule where work.

Att ~ 

(srry my bad english... )
Link to comment
Share on other sites

```

Function GetPlayerProtection(ByVal index As Long) As Long
Dim Armor As Long
Dim Helm As Long
GetPlayerProtection = 0

' Check for subscript out of range
If isPlaying(index) = False Or index <= 0 Or index > Player_HighIndex Then
Exit Function
End If

Armor = GetPlayerEquipment(index, Armor)
Helm = GetPlayerEquipment(index, Helmet)
GetPlayerProtection = (GetPlayerStat(index, Stats.Endurance) \ 3)

If Armor > 0 Then
GetPlayerProtection = GetPlayerProtection + Item(Armor).Data2
End If

If Helm > 0 Then
GetPlayerProtection = GetPlayerProtection + Item(Helm).Data2
End If

End Function

```

GetPlayerProtection : 3
Link to comment
Share on other sites

no… Npc Damage is igual of EO 3\. I not edit..

my only edit is put

is..

In Sub TryNpcAttackPlayer

```

' * 1.5 if crit hit
If CanNpcCrit(npcNum) Then
Damage = Damage * 1.5
SendActionMsg mapnum, "Critical!", BrightCyan, 1, (MapNpc(mapnum).NPC(mapNpcNum).x * 32), (MapNpc(mapnum).NPC(mapNpcNum).y * 32)
End If

If Damage > 0 Then
Call NpcAttackPlayer(mapNpcNum, index, Damage)
End If
End If
End Sub

```
before If Damage > 0 Then..

I add...

Damage  =  Damage - GetPlayerProtection

index in the case...
Link to comment
Share on other sites

```

Function GetPlayerDefense(ByVal index As Long) As Long
Dim Armor As Long
Dim Helm As Long
Dim Shield 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

Armor = GetPlayerEquipment(index, Armor)
Helm = GetPlayerEquipment(index, Helmet)
Shield = GetPlayerEquipment(index, Shield)
GetPlayerDefense = (GetPlayerStat(index, Stats.Endurance) \ 3)

FullArmor = GetPlayerEquipment(index, Armor) + GetPlayerEquipment(index, Helmet)

If Armor > 0 Then
GetPlayerDefense = GetPlayerDefense + Item(Armor).Data2
End If

If Helm > 0 Then
GetPlayerDefense = GetPlayerDefense + Item(Helm).Data2
End If

If Shield > 0 Then
GetPlayerDefense = GetPlayerDefense + Item(Shield).Data2

If Armor > 0 < Helm Then
GetPlayerDefense = GetPlayerDefense + FullArmor
End If

End Function

```
and it? if i add this in modCombat, and add call of sub in formule damage in TryNpcAttackPlayer??

ex:

![](https://scontent-b-iad.xx.fbcdn.net/hphotos-xfp1/t1.0-9/10394593_478566292274380_2535201481087108480_n.jpg)

My Sub GetPlayerDefense, would be very high defense items?

Work?

And

```

If Armor > 0 < Helm Then
GetPlayerDefense = GetPlayerDefense + FullArmor
End If
```
Work? '-' i never test , and I am new to programming ù.ù

#Edit

Not Work. I desist. rs.
Link to comment
Share on other sites

Yep, i understand this.. 

But, i think, in my test.

In ServerSide, ModCombat, have one code…

"+/- this…

"Damage = rand(1,Damage)"

the damage "total" randomize the damage for 1 util damage total valor… the chances of damage low appaer is high.. '-' but this create a big variable of damage.

if add the "getplayerdefense" or "getplayerprotection" after this, the damage is impaired sharply...

i add th code

"Damage = Damage - GetPlayerDefense(index)"

or.

"Damage = Damage - GetPlayerProtection(index)"

but, i Think, the SUB (TryNpcAttackPlayer), not understand What is the defense of the target player '-' i make change in data items, add more , or add other equipment.. and the calcule not change.. the damage of npc is egual. '-'

simplifying ... 

I think the SUB'' can not understand that GetPlayerDefense or GetPlayerProtection is the player.

and now?
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...