![]() |
Battle system - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +----- Thread: Battle system (/showthread.php?tid=2677) |
Battle system - genusis - 02-04-2009 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) 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 |