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

[EO2.x] Roof System


Justn
 Share

Recommended Posts

Ok this is a simple roof system. Basically it adds a new layer, the roof. When I player steps on the new threshold tile attribute the roof layer is invisible.. This was ripped from Alatar’s house system so all credits to him..

**Server-**

**modConstants**

Add this to the bottom of your tile constants:

```
Public Const TILE_TYPE_THRESHOLD As Byte = 15
```

**modEnumerations**

Find : **Public Enum MapLayer** and add this before the layer count:

```
Roof
```

**Client-**

**modEnumerations**

Find : **Public Enum MapLayer** and add this before the layer count:

```
Roof
```

**modDirectDraw7**

Find: **' blit out upper tiles**

Under: Call **BltMapFringeTile(X, Y)** add this:

```
Call BltRoof(X, Y)
```

Next add this to the bottom of **modDirectDraw7**:

```
Public Sub BltRoof(ByVal X As Long, ByVal Y As Long)

Dim rec As DxVBLib.RECT

Dim i As Long

With Map.Tile(X, Y)

i = MapLayer.Roof

If .Layer(i).tileset > 0 Then

rec.Top = .Layer(i).Y * PIC_Y

rec.Bottom = rec.Top + PIC_Y

rec.Left = .Layer(i).X * PIC_X

rec.Right = rec.Left + PIC_X

If Not Threshold = True Then

Call Engine_BltFast(ConvertMapX(X * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Tileset(.Layer(i).tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

End If

End If

End With

End Sub
```
**modText**

Find:

```
Case TILE_TYPE_SLIDE

DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)
```

Under it add this:

```
Case TILE_TYPE_THRESHOLD

DrawText TexthDC, tX, tY, "T", QBColor(BrightCyan)
```

**modGameLogic**

Find this:

```
' Check to see if the map tile is blocked or not

If Map.Tile(X, Y).Type = TILE_TYPE_BLOCKED Then

CheckDirection = True

Exit Function

End If
```

**Above** it add this:

```
If Map.Tile(X, Y).Type = TILE_TYPE_THRESHOLD Then

Threshold = Not Threshold

Exit Function

End If
```

**modConstants**

Add this to the bottom of your tile constants:

```
Public Const TILE_TYPE_THRESHOLD As Byte = 15
```

**modGlobals**

Add this to the bottom:

```
Public Threshold As Boolean
```

**modGameEditors**

Find this:

```
' slide

If frmEditor_Map.optSlide.Value Then

.Type = TILE_TYPE_SLIDE

.Data1 = MapEditorSlideDir

.Data2 = 0

.Data3 = 0

End If
```

**Below** it add this:

```
' Threshold

If frmEditor_Map.optThreshold.Value Then

.Type = TILE_TYPE_THRESHOLD

.Data1 = 0

.Data2 = 0

.Data3 = 0

End If
```

**Form Work-**

**frmEditor_Map**

First add this code to the bottom of **frmEditor_Map**:

```
Private Sub cmdRoof_Click()

Threshold = Not Threshold

End Sub

Private Sub optThreshold_Click()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

ClearAttributeDialogue

picAttributes.Visible = False

' Error handler

Exit Sub

errorhandler:

HandleError "optThreshold_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub
```

1.Now in the frame: **fraLayers.** Copy and paste one of the map layer radio buttons (make sure to paste inside of fraLayers) and set the index to 6 (or the next number if u have more layers).

2.Next create a **command button** in **fraLayers** and name it: **cmdRoof**

Set the caption to: **Roof**

3.Find the **map attributes** and create a new radio button on **fraAttribs**. Name it: **optThreshold**

And that should be it.. Its pretty basic and the only issue I can think of is one found here:

[my one issue](http://www.touchofdeathforums.com/community/index.php?/topic/128934-function-for-getting-the-players-last-position/)

If anyone has a solution for that it would be perfect but still works well as is….
Link to comment
Share on other sites

Of course this is from house system right? ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) But gj i was always too lazy to rip it ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
Link to comment
Share on other sites

> Damn, I programmed one from scratch into Cinder. Oh well, I guess you can't make something unique anymore these days.

Believe it or not there are about 9000 other games that also have the same system.

Also I think that instead of completely making the layer invisible, putting its alpha down would look much better.
Link to comment
Share on other sites

i suggest to make 2 attribute for roof system , so there will be no issue , AnonMica did 2 Attribute 1 attribute is to remove the roof layer and the second is to make back what it really looks like , And we also add a saveoptions system on the roof system , So when they are inside the house and log out , the roof will be on what it looks like before you log out..

sorry for my english
Link to comment
Share on other sites

> It makes a layer over other layers, that when you step on a certian tile, it makes it look like you stepped inside the house, or makes that tile disappear.

I'm confused are u asking a question? ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
Link to comment
Share on other sites

Yea i know having another tile type is a waste thats just how it is in sherwins project…

I know its not a huge deal but with the way it is now u can step on the tile type turn back around and walk out of the house and since u didnt step on tile a second time the roof layer is still gone yet ur outside or if u did it the other way ur in the house with the roof on.. just alittle unrealistic ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
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...