07-07-2007, 09:40 PM
Just something small I made for my game, and.. I've never written a tutorial yet, so I figured I should try and actually contribute something. This should work in a vanilla MSE, I can't see why it wouldn't.
Client Side:
Add this to your Constants, under the other tiles:
Find:
Under it add:
Find:
Under it add:
Now: Of course you need to go into frmMirage and add OptGravity to the other attributes for the map editor.
Server Side:
In your Server constants, add this under the other tiles:
Finally, Find:
Then Dim these:
In the Sub, find these lines:
And right under them add this block of code:
And... you're done.
If a player tries to drop an object onto a gravity tile, it will move it down one space, if that tile is also gravity type, it will keep being pulled until it hits a non-gravity tile.
I used these for ladders in my game, becasue I thought it looked stupid when people dropped items floating on a ladder.
Now the itmes fall straight to the bottom of the ladder's base.
This can be expanded on easily too..
Maybe make NPCs fall down them, or something.
EDIT:
Client Side:
Add this to your Constants, under the other tiles:
Code:
Public Const TILE_TYPE_GRAVITY = 7
Find:
Code:
If .Type = TILE_TYPE_KEYOPEN Then Call DrawText
Under it add:
Code:
If .Type = TILE_TYPE_GRAVITY Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "Grav", QBColor(Magenta))
Find:
Code:
If frmMirage.optKeyOpen.Value = True Then
.Type = TILE_TYPE_KEYOPEN
.Data1 = KeyOpenEditorX
.Data2 = KeyOpenEditorY
.Data3 = 0
End If
Under it add:
Code:
If frmMirage.OptGravity.Value = True Then
.Type = TILE_TYPE_GRAVITY
.Data1 = 0
.Data2 = 0
.Data3 = 0
End If
Now: Of course you need to go into frmMirage and add OptGravity to the other attributes for the map editor.
Server Side:
In your Server constants, add this under the other tiles:
Code:
Public Const TILE_TYPE_GRAVITY = 7
Finally, Find:
Code:
Sub PlayerMapDropItem
Then Dim these:
Code:
Dim Yloc As Long, x As Long, y As Long
In the Sub, find these lines:
Code:
' Send inventory update
Call SendInventoryUpdate(Index, InvNum)
And right under them add this block of code:
Code:
' Apply Gravity
Yloc = GetPlayerY(Index)
For y = 0 To MAX_MAPY
For x = 0 To MAX_MAPX
If Map(GetPlayerMap(Index)).Tile(x, Yloc).Type = TILE_TYPE_GRAVITY Then
Yloc = Yloc + 1
End If
Next x
Next y
And... you're done.
If a player tries to drop an object onto a gravity tile, it will move it down one space, if that tile is also gravity type, it will keep being pulled until it hits a non-gravity tile.
I used these for ladders in my game, becasue I thought it looked stupid when people dropped items floating on a ladder.
Now the itmes fall straight to the bottom of the ladder's base.
This can be expanded on easily too..
Maybe make NPCs fall down them, or something.
EDIT:
Cruzn Wrote:In Sub PlayerMapDropItem, Find:
Replace With:Code:Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
Code:Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), Yloc)