Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO 2.0] Map Animations


Broojo02
 Share

Recommended Posts

Note: Animations don't show perfectly in Eclipse Origins, they tend to miss out the first frame or so.

==Client Side==

Open up frmEditor_Map and at the bottom of the attributes add an option button, name it optAnimation. Double click on it and add the following code to the new sub:
```
    ClearAttributeDialogue
    picAttributes.Visible = True
    fraAnimation.Visible = True
    scrlAnimation.Max = MAX_ANIMATIONS
    scrlAnimation.Min = 1
    scrlAnimation.Value = 1
    lblAnimation.Caption = "Animation: "
```
On the right of the attributes you will see a bunch of frames for setting things like map items and NPCs. Add a new frame and name it fraAnimation, set its caption to Animation and its visibility to false. Inside this frame add a label, name it lblAnimation. Below that label add a Horizontal Scroll Bar, name it scrlAnimation, double click it and add in:
```
lblAnimation.Caption = "Animation: " & Trim$(Animation(scrlAnimation.Value).Name)
```
Finally add a command button below the scroll bar and name it cmdAnimation, set the caption to "Okay". Double click it and add in this code:
```
    AnimationNumber = scrlAnimation.Value
    picAttributes.Visible = False
    fraAnimation.Visible = False
```
Now, in modConstants, under "Public Const TILE_TYPE_SLIDE As Byte = 14" add:
```
Public Const TILE_TYPE_ANIMATION As Byte = 15
```
In modGlobals, under "Public EditorShop As Long" add:
```
Public AnimationNumber As Long
```
In modGameEditors, search for:
```
                ' slide
                If frmEditor_Map.optSlide.Value Then
                    .Type = TILE_TYPE_SLIDE
                    .Data1 = MapEditorSlideDir
                    .Data2 = 0
                    .Data3 = 0
                End If
```
Underneath this block of code add another block for the animation:
```
                ' animation
                If frmEditor_Map.optAnimation.Value Then
                    .Type = TILE_TYPE_ANIMATION
                    .Data1 = AnimationNumber
                    .Data2 = 0
                    .Data3 = 0
                End If
```
In modText, search for "DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)", under this add:
```
Case TILE_TYPE_ANIMATION
                                DrawText TexthDC, tX, tY, "A", QBColor(Brown)
```
==Server Side==

In modConstants search for "Public Const TILE_TYPE_SLIDE As Byte = 14", under that add:
```
Public Const TILE_TYPE_ANIMATION As Byte = 15
```
Finally, in modServerLoop you need to do two things.

1\. In "Sub ServerLoop()" add the following declarations to the top of the sub:
```
Dim mapNum, x1, y1, Anim, playerNumber As Long
```
2\. In the same sub, search for:
```
        ' Checks to update player vitals every 5 seconds - Can be tweaked
        If Tick > LastUpdatePlayerVitals Then
            UpdatePlayerVitals
            LastUpdatePlayerVitals = GetTickCount + 5000
        End If
```
Underneath this code block add:
```
' Anim every 1 sec
          If Tick > Anim Then
            Anim = GetTickCount + 1000
            For mapNum = 1 To MAX_MAPS
                For x1 = 0 To Map(mapNum).MaxX
                    For y1 = 0 To Map(mapNum).MaxY
                        If Map(mapNum).Tile(x1, y1).Type = TILE_TYPE_ANIMATION Then
                            For playerNumber = 1 To Player_HighIndex
                                If IsPlaying(playerNumber) Then
                                    If GetPlayerMap(playerNumber) = mapNum Then
                                        SendAnimation mapNum, Map(mapNum).Tile(x1, y1).Data1, x1, y1
                                    End If
                                End If
                            Next
                        End If
                    Next
                Next
            Next
        End If
```
==How it works==

When you click the Animation attribute in the map editor you get to choose which animation to set, after clicking the okay button you can click on the map to set an animation there. This animation, along with any other animations on any other map will be drawn every 1 second, this can be changed to any value by changing the "+ 1000" to any other value.

I get the feeling I have missed something out, tell me if there are any problems.
Link to comment
Share on other sites

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Wow, I've waited a long time for this, but, like Beast already said, you really need to fix that bug..
And in my opinion its better to make map layer(s), because now you can't do Block on Animation, and people would sometimes need that ;)
Link to comment
Share on other sites

Another good thing about this is that you can still have multi layered animations, as animations have a layer for below and above the player. So you could have running water for underneath the player and water dripping down over the player. You can also have sounds, although it would be a bit annoying playing the same sound over and over again.
Link to comment
Share on other sites

i did the same thing…

look carefully, this is a very bad way of doing it im afraid :/

your bombarding the client with packets for animation ever frikking second...

and thats just the start of things that are wrong.

sorry, dont mean to be a asshole, just telling the truth

Dami
Link to comment
Share on other sites

@Broojo, I've a nice idea how you (possible) can fix this :
@Erkro1:

> In my opinion its better to make map layer(s), because now you can't do Block on Animation, and people would sometimes need that ;)

Make in the Animation window a checkbox called 'Blocked', and if its checked make it block the player ;)
Link to comment
Share on other sites

@Damian666:

> i did the same thing…
>
> look carefully, this is a very bad way of doing it im afraid :/
>
> your bombarding the client with packets for animation ever frikking second...
>
> and thats just the start of things that are wrong.
>
> sorry, dont mean to be a asshole, just telling the truth
>
> Dami

Thats fair enough, I was worried about this myself, how much of a performance hit do you think this would give?
Link to comment
Share on other sites

@Erkro1:

> @Broojo, I've a nice idea how you (possible) can fix this :
> Make in the Animation window a checkbox called 'Blocked', and if its checked make it block the player ;)

Yeah, but you can just use the directional blocking that comes with the engine.
Link to comment
Share on other sites

sending packets like hell like that? depends on how much players, 1 player you wont notice jack,

up that too 10 and more and i think it will be very noticeable.

no, best way of doing this, imho, is indeed saving it as a tile atribute, but handle the animation client side.

so only if a tile is set to tiletype animation, blt the animation.

how? i have no clue, welcome to my world, this is where i am currently at xd

Dami
Link to comment
Share on other sites

XD Yeah, I looked around the client but couldn't find an easy way to blt an animation, its annoying because it would be best to have it client side and completely remove the need for packets as all the data would be stored locally in the map and animation files.

After I found the SendAnimation sub thing I just got a little excited :P
Link to comment
Share on other sites

um when you check animation fra animation doesn't show up so i edited the code alittle

>! ClearAttributeDialogue
    picAttributes.Visible = True
    fraAnimation.Visible = True
    scrlAnimation.Max = MAX_ANIMATIONS
    scrlAnimation.Min = 1
    scrlAnimation.Value = 1
    lblAnimation.Caption = "Animation: "
Link to comment
Share on other sites

@Wat!The!Waffles...:

> um when you check animation fra animation doesn't show up so i edited the code alittle
>
> >! ClearAttributeDialogue
>     picAttributes.Visible = True
>     fraAnimation.Visible = True
>     scrlAnimation.Max = MAX_ANIMATIONS
>     scrlAnimation.Min = 1
>     scrlAnimation.Value = 1
>     lblAnimation.Caption = "Animation: "

Thanks very much, added it in. I must have set its value to visible and never tried any other attributes :P
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...