m4hud17
-
Posts
3 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Calendar
Posts posted by m4hud17
-
-
Thanks :D :D :D
-
Hei guys, this is my first post and also my first mod :D
This mod, allow you to targetting the enemy without click the enemy. This mod was tested in EO TFF(EO 3.0).
These all just edit the server
okay, there's three kind :
1\. auto-target Npc when it attack you.
First, in modCombat :
```
Sub NpcAttackPlayer
```
find,
```
TempPlayer(victim).stopRegenTimer = GetTickCount
```
under that, add :
```
If TempPlayer(victim).targetType = 0 And TempPlayer(victim).target = 0 Then
TempPlayer(victim).targetType = 2 'NPC
TempPlayer(victim).target = MapNpcNum
SendTarget victim
End If
```
2\. auto-target Npc when you use non AoE spell and don't have any target.
Find :
```
Public Sub BufferSpell(ByVal index As Long, ByVal spellslot As Long)
```
Then find :
```
If Not target > 0 Then
PlayerMsg index, "You do not have a target.", BrightRed
End If
```
Change it into :
```
If Not target > 0 Then
TempPlayer(index).targetType = TARGET_TYPE_NPC
TempPlayer(index).target = FindNPCInRange(index, mapnum, Range)
SendTarget index
targetType = TempPlayer(index).targetType
target = TempPlayer(index).target
'if it's still 0
If target = 0 Then
PlayerMsg index, "No enemies nearby.", BrightRed
SendClearSpellBuffer index
Exit Sub
End If
End If
```
3\. The last, it's auto-target when Npc targetting you
first, in modServerLoop find
```
Private Sub UpdateMapLogic()
```
Then, under it add :
```
Dim index As Long
```
then, find :
```
MapNpc(mapnum).NPC(x).targetType = 1 ' player
MapNpc(mapnum).NPC(x).target = I
End If
```
change it into :
```
MapNpc(mapnum).NPC(x).targetType = 1 ' player
MapNpc(mapnum).NPC(x).target = I
For index = 1 To MAX_PLAYERS
If TempPlayer(index).targetType = 0 And TempPlayer(index).target = 0 Then
TempPlayer(index).targetType = 2 'npc
TempPlayer(index).target = x
SendTarget index
End If
Next index
End If
```
Finish, Sorry for my bad english :P :P :P
You can auto target when you attack, it's also work with projectiles
first, in modCombat, CanPlayerAttackNpc find
```
If Map(GetPlayerMap(attacker)).Tile(GetPlayerX(attacker) + pX, GetPlayerY(attacker) + pY).Type <> TILE_TYPE_BLOCKED And Map(GetPlayerMap(attacker)).Tile(GetPlayerX(attacker) + pX, GetPlayerY(attacker) + pY).Type <> TILE_TYPE_RESOURCE Then
CanPlayerAttackNpc = True
End If
```
change it to
```
If Map(GetPlayerMap(attacker)).Tile(GetPlayerX(attacker) + pX, GetPlayerY(attacker) + pY).Type <> TILE_TYPE_BLOCKED And Map(GetPlayerMap(attacker)).Tile(GetPlayerX(attacker) + pX, GetPlayerY(attacker) + pY).Type <> TILE_TYPE_RESOURCE Then
If TempPlayer(attacker).target = 0 Then
TempPlayer(attacker).targetType = TARGET_TYPE_NPC
TempPlayer(attacker).target = MapNpcNum
SendTarget attacker
End If
CanPlayerAttackNpc = True
End If
```
For auto targeting player
in CanPlayerAttackPlayer, above the end function add
```
If TempPlayer(attacker).target = 0 Then
TempPlayer(attacker).targetType = TARGET_TYPE_PLAYER
TempPlayer(attacker).target = victim
SendTarget attacker
End If
If TempPlayer(victim).target = 0 Then
TempPlayer(victim).targetType = TARGET_TYPE_PLAYER
TempPlayer(victim).target = attacker
SendTarget victim
End If
```
Auto-Target NPC & Player
in Tutorials
Posted