| Mirage Source http://miragesource.net/forums/ |
|
| Npc Walking Alterations (Based off Advocate's tut) http://miragesource.net/forums/viewtopic.php?f=210&t=798 |
Page 1 of 1 |
| Author: | Forte [ Tue Dec 05, 2006 11:59 pm ] |
| Post subject: | Npc Walking Alterations (Based off Advocate's tut) |
First off im giving credit to Advocate since its his code this is based off. This is walking alterations for NPCs. It is easy but just posting it here to help the community. Credit to Advocate. sub bltnpc replace Code: ' Check for animation Anim = 0 If MapNpc(MapNpcNum).Attacking = 0 Then Select Case MapNpc(MapNpcNum).Dir Case DIR_UP If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2) Then Anim = 1 Case DIR_DOWN If (MapNpc(MapNpcNum).YOffset < PIC_Y / 2 * -1) Then Anim = 1 Case DIR_LEFT If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2) Then Anim = 1 Case DIR_RIGHT If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 1 End Select Else If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then Anim = 2 End If End If withhhhh Code: ' Check for animation
Anim = 0 If MapNpc(MapNpcNum).Attacking = 0 Then Select Case MapNpc(MapNpcNum).Dir Case DIR_UP If (MapNpc(MapNpcNum).YOffset < PIC_Y / 3) Then Anim = 1 ElseIf (MapNpc(MapNpcNum).YOffset > PIC_Y / 3) And ((MapNpc(MapNpcNum).YOffset > PIC_Y / 3 * 2)) Then Anim = 2 End If Case DIR_DOWN Anim = 1 If (MapNpc(MapNpcNum).YOffset < PIC_X / 4 * -1) Then Anim = 0 If (MapNpc(MapNpcNum).YOffset < PIC_X / 2 * -1) Then Anim = 2 Case DIR_LEFT Anim = 0 If (MapNpc(MapNpcNum).XOffset < PIC_Y / 3) Then Anim = 1 ElseIf (MapNpc(MapNpcNum).XOffset > PIC_Y / 3) And ((MapNpc(MapNpcNum).XOffset > PIC_Y / 3 * 2)) Then Anim = 2 End If Case DIR_RIGHT Anim = 0 If (MapNpc(MapNpcNum).XOffset < PIC_Y / 4 * -1) Then Anim = 1 If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 2 End Select Else If MapNpc(MapNpcNum).AttackTimer + 500 > GetTickCount Then Anim = 2 End If End If im pretty sure it works =P |
|
| Author: | Tony [ Wed Dec 06, 2006 2:00 am ] |
| Post subject: | |
It would be nice if you typed up on what you updated from advo's code. :: Pando |
|
| Author: | Forte [ Wed Dec 06, 2006 5:17 am ] |
| Post subject: | |
alrighty pando sure its not really much Code: If Player(Index).Attacking = 0 Then Select Case GetPlayerDir(Index) Case DIR_UP Anim = 0 If (Player(Index).YOffset < PIC_Y / 3) Then Anim = 1 ElseIf (Player(Index).YOffset > PIC_Y / 3) And ((Player(Index).YOffset > PIC_Y / 3 * 2)) Then Anim = 2 End If Case DIR_DOWN Anim = 1 If (Player(Index).YOffset < PIC_X / 4 * -1) Then Anim = 0 If (Player(Index).YOffset < PIC_X / 2 * -1) Then Anim = 2 Case DIR_LEFT Anim = 0 If (Player(Index).XOffset < PIC_Y / 3) Then Anim = 1 ElseIf (Player(Index).XOffset > PIC_Y / 3) And ((Player(Index).XOffset > PIC_Y / 3 * 2)) Then Anim = 2 End If Case DIR_RIGHT Anim = 0 If (Player(Index).XOffset < PIC_Y / 4 * -1) Then Anim = 1 If (Player(Index).XOffset < PIC_Y / 2 * -1) Then Anim = 2 End Select Else If Player(Index).AttackTimer + 500 > GetTickCount Then Anim = 2 End If End If thats Advocates code. All i really did was change the (Player(Index)'s to MapNpc(MapNpcNum). so case dir right would be like Code: Case DIR_RIGHT i would have explained more but there really isnt much to explain Anim = 0 If (MapNpc(MapNpcNum).XOffset < PIC_Y / 4 * -1) Then Anim = 1 If (MapNpc(MapNpcNum).XOffset < PIC_Y / 2 * -1) Then Anim = 2 |
|
| Author: | Rian [ Wed Dec 06, 2006 5:20 am ] |
| Post subject: | |
Nothing's really updated. Just show's how to modify it for use with NPCs. |
|
| Author: | Tony [ Wed Dec 06, 2006 6:14 am ] |
| Post subject: | |
Oh! Dumb me. :: Pando |
|
| Author: | Matt [ Wed Dec 06, 2006 2:32 pm ] |
| Post subject: | |
I was planning on getting around to this sooner or later. Much appreciated for saving me the time! ^_^ |
|
| Author: | Xlithan [ Wed Jan 03, 2007 10:11 pm ] |
| Post subject: | |
So what does this do, exactly? |
|
| Author: | Tony [ Wed Jan 03, 2007 10:16 pm ] |
| Post subject: | |
Well why don't you read the code? It changes the walking system for NPCS. |
|
| Author: | one [ Wed Jan 03, 2007 10:19 pm ] |
| Post subject: | |
not the system, just the animation. it uses all 3 animations for waking and looks smoother |
|
| Author: | Tony [ Wed Jan 03, 2007 10:26 pm ] |
| Post subject: | |
oh whatever, same shit. -_____-" |
|
| Author: | Matt [ Thu Jan 04, 2007 12:53 am ] |
| Post subject: | |
No, it's not the same. There's a bug of sorts with this system, well, for players. It seems if you're running, it will only blit 2 frames. =\ |
|
| Author: | Forte [ Thu Jan 04, 2007 8:26 am ] |
| Post subject: | |
Advocate wrote: No, it's not the same. There's a bug of sorts with this system, well, for players. It seems if you're running, it will only blit 2 frames. =\
What do you mean..? |
|
| Author: | Matt [ Thu Jan 04, 2007 1:53 pm ] |
| Post subject: | |
When holding shift to run, it won't use three frames like walking. It will look like how it did before you add the new system. Though this doesn't apply to this tut, it applies to my tut. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|