Author: grimsk8ter11
Difficulty: 1/5
Example of how you can change some variables in Mirage to get some new effects. The "Amulet of Speed" item:
:: CLIENT SIDE ::In modConstants, remove:
Code:
' Speed moving vars
Public Const WALK_SPEED = 4
Public Const RUN_SPEED = 8
In modGlobals, add:
Code:
' Speed moving vars
Public WALK_SPEED As Integer
Public RUN_SPEED As Integer
In modGameLogic, find UpdateInventory, and replace it with:
Code:
Public Sub UpdateInventory()
Dim i As Long
frmMirage.lstInv.Clear
' Show the inventory
For i = 1 To MAX_INV
If GetPlayerInvItemNum(MyIndex, i) > 0 And GetPlayerInvItemNum(MyIndex, i) <= MAX_ITEMS Then
If Item(GetPlayerInvItemNum(MyIndex, i)).Type = ITEM_TYPE_CURRENCY Then
frmMirage.lstInv.AddItem i & ": " & Trim(Item(GetPlayerInvItemNum(MyIndex, i)).Name) & " (" & GetPlayerInvItemValue(MyIndex, i) & ")"
Else
' Check if this item is being worn
If GetPlayerWeaponSlot(MyIndex) = i Or GetPlayerArmorSlot(MyIndex) = i Or GetPlayerHelmetSlot(MyIndex) = i Or GetPlayerShieldSlot(MyIndex) = i Then
frmMirage.lstInv.AddItem i & ": " & Trim(Item(GetPlayerInvItemNum(MyIndex, i)).Name) & " (worn)"
Else
frmMirage.lstInv.AddItem i & ": " & Trim(Item(GetPlayerInvItemNum(MyIndex, i)).Name)
'check for speed-boosting items
If Trim(Item(GetPlayerInvItemNum(MyIndex, i)).Name) = "Amulet of Speed" Then
WALK_SPEED = 8
RUN_SPEED = 16
Else
WALK_SPEED = 4
RUN_SPEED = 8
End If
End If
End If
Else
frmMirage.lstInv.AddItem "<free inventory slot>"
End If
Next i
frmMirage.lstInv.ListIndex = 0
SPOILER: (click to show)
Well, actually all that you have to REALLY do is add in this to the correct place (see above for the correct place):
Code:
'check for speed-boosting items
If Trim(Item(GetPlayerInvItemNum(MyIndex, i)).Name) = "Amulet of Speed" Then
WALK_SPEED = 8
RUN_SPEED = 16
Else
WALK_SPEED = 4
RUN_SPEED = 8
End If
Now, while in game type /edititem and edit an item, name it "Amulet of Speed," and set its picture.
Spawn the amulet on a map, pick it up, and your speed will be outstanding now. If you're really smart, you can change the code so that it has to be actually WORN before the effect takes place.