tslusny Posted May 3, 2012 Author Share Posted May 3, 2012 Hello this is my fisrt tutorial so i hope you like it :cheesy:What it does? When you attack npc or player your projectile damage is like "true damage", you always hitting same amount and damage dont calculates from npc def. And beware i have custom damage scalling formula in my game so you must change it to sort your needs. Just find Getplayerdamge and copy that formula from getplayerdamage =This is Server side editSo….Go to ModGameLogic and Find```Sub HandleProjectile```At top of the sub add```Dim Damage as longDim NpcNum as LongDim MapNum as LongDim BlockAmount as LongDamage = 0```Replace entire section from right under```' check if hit player```to right above (still in Sub HandleProjectlie```' hit a block```with this```'Projectile scaling formulaFor i = 1 To Player_HighIndex ' make sure they're actually playing If IsPlaying(i) Then ' check coordinates If x = Player(i).x And y = GetPlayerY(i) Then ' make sure it's not the attacker If Not x = Player(Index).x Or Not y = GetPlayerY(Index) Then ' check if player can attack If CanPlayerAttackPlayer(Index, i, False, True) = True Then ' attack the player and kill the project tile If CanPlayerDodge(i) Then SendActionMsg MapNum, "Dodge!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32) Exit Sub End If If CanPlayerParry(i) Then SendActionMsg MapNum, "Parry!", Pink, 1, (GetPlayerX(i) * 32), (GetPlayerY(i) * 32) Exit Sub End If Damage = TempPlayer(Index).ProjecTile(PlayerProjectile).Damage + GetPlayerStat(Index, Agility) + GetPlayerLevel(Index) blockAmount = CanPlayerBlock(i) Damage = Damage - blockAmount ' take away armour Damage = Damage - RAND(1, (GetPlayerStat(i, Agility) * 2)) ' randomise from 1 to max hit Damage = RAND(1, Damage) ' * 1.5 if it's a crit! If CanPlayerCrit(Index) Then Damage = Damage * 1.5 SendActionMsg MapNum, "Critical!", BrightCyan, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32) End If If Damage > 0 Then Call PlayerAttackPlayer(Index, i, Damage) Else Call PlayerMsg(Index, "Your attack is too weak.", BrightRed) End If ClearProjectile Index, PlayerProjectile Exit Sub Exit Sub Else ClearProjectile Index, PlayerProjectile Exit Sub End If End If End If End If Next ' check for npc hit For i = 1 To MAX_MAP_NPCS MapNum = GetPlayerMap(Index) npcNum = MapNpc(MapNum).NPC(i).Num If x = MapNpc(GetPlayerMap(Index)).NPC(i).x And y = MapNpc(GetPlayerMap(Index)).NPC(i).y Then ' they're hit, remove it and deal that damage ;) If CanPlayerAttackNpc(Index, i, True) Then If CanNpcDodge(npcNum) Then SendActionMsg MapNum, "Dodge!", Pink, 1, (MapNpc(MapNum).NPC(i).x * 32), (MapNpc(MapNum).NPC(i).y * 32) Exit Sub End If If CanNpcParry(npcNum) Then SendActionMsg MapNum, "Parry!", Pink, 1, (MapNpc(MapNum).NPC(i).x * 32), (MapNpc(MapNum).NPC(i).y * 32) Exit Sub End If Damage = TempPlayer(Index).ProjecTile(PlayerProjectile).Damage + GetPlayerStat(Index, Agility) + GetPlayerLevel(Index) blockAmount = CanNpcBlock(i) Damage = Damage - blockAmount ' take away armour Damage = Damage - RAND(1, (NPC(npcNum).stat(Stats.Agility) * 2)) ' randomise from 1 to max hit Damage = RAND(1, Damage) ' * 1.5 if it's a crit! If CanPlayerCrit(Index) Then Damage = Damage * 1.5 SendActionMsg MapNum, "Critical!", BrightCyan, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32) End If If Damage > 0 Then Call PlayerAttackNpc(Index, i, Damage) Else Call PlayerMsg(Index, "Your attack is too weak.", BrightRed) End If ClearProjectile Index, PlayerProjectile Exit Sub Else ClearProjectile Index, PlayerProjectile Exit Sub End If End If Next'Projectile scaling formula```The custom damage formula isDamage = TempPlayer(Index).ProjecTile(PlayerProjectile).Damage + GetPlayerStat(Index, Agility) + GetPlayerLevel(Index)just change it 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