Mirage Source
http://miragesource.net/forums/

Battle system
http://miragesource.net/forums/viewtopic.php?f=193&t=5357
Page 1 of 1

Author:  genusis [ Thu Apr 02, 2009 2:46 pm ]
Post subject:  Battle system

well the battle system and leveling system are a bit flawed in my understanding, it goes threw this giant loop with all of these different functions for both players and npc based on what they attack

OK lets start here

Public Sub AttackNpc

we got 11 dims for one we could decrease that by using 1 dim for more things rather than just one =.=.

check sub out of range looks ok.

Code:
MapNum = GetPlayerMap(Attacker)
    NpcNum = MapNpc(MapNum, MapNpcNum).Num
    Name = Trim$(Npc(NpcNum).Name)
   
    ' Send this packet so they can see the person attacking
    Call SendDataToMapBut(Attacker, MapNum, SAttack & SEP_CHAR & Attacker & END_CHAR)


Ok so here in ms4 we are just showing that the person is attacking fter it goes threw senddatatomapbut and determines it is a person or npc attacking .... Why would we have to set the player attacking animation here. and beside it shows the animation to soon. i can attack it shows the animation then have to wait for more than half of the attack sub to complete before the npc dies and respawns. slow

' Check for weapon is fine but we should make a private sub for it.

The party stuff could be redone and recalculated for better performance.

and we are setting the npc as dead before actually determining they are dead.

Then we call CheckPlayerLevelUp which should be a private sub.

' Check for level up
Call CheckPlayerLevelUp(Attacker)

' Check for level up party member
If TempPlayer(Attacker).InParty = YES Then
Call CheckPlayerLevelUp(TempPlayer(Attacker).PartyPlayer)
End If

We should check if there in a party first before checking if they leveled up.

then check to see if the npc is dead

' Check if target is npc that died and if so set target to 0
If TempPlayer(Attacker).TargetType = TARGET_TYPE_NPC Then
If TempPlayer(Attacker).Target = MapNpcNum Then
TempPlayer(Attacker).Target = 0
TempPlayer(Attacker).TargetType = TARGET_TYPE_NONE
End If
End If
Else

and if not dead we just do the damage.

Then we check for a weapon a second time.

then it checks to see if the npc has something to say to you after you attack it.

then it sets the target if the npc is still alive

then check for if its a guard AI

the does these
' Reduce durability of weapon
Call DamageEquipment(Attacker, Weapon)

' Reset attack timer
TempPlayer(Attacker).AttackTimer = GetTickCount. Why do we have to check things more than once.and why are we checking for things at the wrong time.

it should go

1 Sub attacknpc
2 Subscript
3 MapNum = GetPlayerMap(Attacker)
NpcNum = MapNpc(MapNum, MapNpcNum).Num
Name = Trim$(Npc(NpcNum).Name)
4 ' Check for weapon
5 calculate the damage to the npc vital
6 determine if we killed it or not
7 say if you killed the npc or not and how much damage you did.
8 Do the animation
9 determine if they are a guard AI
10 items droped
11 Calculate the EXP gained
12 levels
13 damage weapon if you have any
14 reset timer

much shorter and faster this way.

the other way uses like 20 steps.

pretty much the same for Sub AttackPlayer

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/