Difficulty: Medium 4/5
Originaly Posted By: Sonire
Not sure who Xtreme984 is, I don't remember him from the forums, but I found this tut on my PC and I thought I would share.
Source Author: Xtreme984 Source Name: Warp Spell
Ok, this is my tutorial on adding a warp spell type
1>open up your client project and open up ModTypes. 2>Search for "Public Const SPELL_TYPE_GIVEITEM = 6" (without quotes) 3> add "Public Const SPELL_TYPE_WARP = 7" (or the next number, if you allready added more types)
then goto frmSpelleditor and make a frame called "fraWarp" Set the .visible of "fraWarp" to False on there make 3 Horizontal scroll bars.
4> name the first "scrlMapnum", the second "scrlMapX" and the third "scrlMapY". 5> make labels behind them with the names "Mapnum", "lblMapX" and "lblMapY", in the same order as the scroll bars 6> doubleclick on each of the scrollbars and add this code: for scrlMapnum: MapNum.Caption = scrlMapnum.Value for scrlMapX: lblMapX.Caption = scrlMapX.Value for scrlMapY: lblMapY.Caption = scrlMapY.value
After you finish this step you should have 3 subs like the following:
ScrlMapnum Private Sub scrlMapnum_Change() MapNum.Caption = scrlMapnum.Value End Sub
scrlMapX Private Sub scrlMapX_Change() lblMapX.Caption = scrlMapX.Value End Sub
scrlMapY Private Sub scrlMapY_Change() lblMapY.Caption = scrlMapY.Value End Sub
7> make a Form_load sub in there put the following:
scrlMapnum.Max = MAX_MAPS scrlMapnum.Min = 1 scrlMapX.Max = MAX_MAPX scrlMapY.Max = MAX_MAPY MapNum.Caption = scrlMapnum.Value lblMapX.Caption = scrlMapX.Value lblMapY.Caption = scrlMapY.Value In the "Private Sub cmbType_Click()"
Under:
If cmbType.ListIndex <> SPELL_TYPE_GIVEITEM Then fraVitals.Visible = True fraGiveItem.Visible = False Else fraVitals.Visible = False fraGiveItem.Visible = True End If Add:
If cmbType.ListIndex <> SPELL_TYPE_WARP Then fraVitals.Visible = True fraWarp.Visible = False Else fraVitals.Visible = False fraWarp.Visible = True End If Then goto the properties window of cmbType goto the "Itemdata" and press the arrow to see a dropdown with 7 0's. add a 8th 0 beneath it. goto "List" and press the arrow, under "Give item" type "Warp"
8> open up modGameLogic and find "Public Sub SpellEditorOk()" (without quotes)
Under:
If Spell(EditorIndex).Type <> SPELL_TYPE_GIVEITEM Then Spell(EditorIndex).Data1 = frmSpellEditor.scrlVitalMod.Value Else Spell(EditorIndex).Data1 = frmSpellEditor.scrlItemNum.Value Spell(EditorIndex).Data2 = frmSpellEditor.scrlItemValue.Value Spell(EditorIndex).Data3 = 0 (the data3 may not be here, but outside the End If) End If Add:
If Spell(EditorIndex).Type = SPELL_TYPE_WARP Then Spell(EditorIndex).Data1 = frmSpellEditor.scrlMapnum.Value Spell(EditorIndex).Data2 = frmSpellEditor.scrlMapX.Value Spell(EditorIndex).Data3 = frmSpellEditor.scrlMapY.Value End If 8> then search for "Public Sub Spelleditorinit()"
Under:
If Spell(EditorIndex).Type <> SPELL_TYPE_GIVEITEM Then frmSpellEditor.fraVitals.Visible = True frmSpellEditor.fraGiveItem.Visible = False frmSpellEditor.scrlVitalMod.Value = Spell(EditorIndex).Data1 Else frmSpellEditor.fraVitals.Visible = False frmSpellEditor.fraGiveItem.Visible = True frmSpellEditor.scrlItemNum.Value = Spell(EditorIndex).Data1 frmSpellEditor.scrlItemValue.Value = Spell(EditorIndex).Data2 End If Add:
If Spell(EditorIndex).Type = SPELL_TYPE_WARP Then frmSpellEditor.fraVitals.Visible = False frmSpellEditor.fraGiveItem.Visible = False frmSpellEditor.fraWarp.Visible = True frmSpellEditor.scrlMapnum.Value = Spell(EditorIndex).Data1 frmSpellEditor.scrlMapX.Value = Spell(EditorIndex).Data2 frmSpellEditor.scrlMapY.Value = Spell(EditorIndex).Data3 frmSpellEditor.MapNum.Caption = frmSpellEditor.scrlMapnum.Value frmSpellEditor.lblMapX.Caption = frmSpellEditor.scrlMapX.Value frmSpellEditor.lblMapY.Caption = frmSpellEditor.scrlMapY.Value End If
Now you're done for the client side.
Now open up your server project and again just like the client side add the type in modTypes
Now open modGameLogic, and search for:
"If Spell(SpellNum).Type = SPELL_TYPE_GIVEITEM Then" under thatadd:
If Spell(SpellNum).Type = SPELL_TYPE_WARP Then Dim Moved As Byte n = Player(Index).Target If Player(Index).TargetType = TARGET_TYPE_PLAYER Then If IsPlaying(n) Then Call PlayerWarp(n, Spell(SpellNum).Data1, Spell(SpellNum).Data2, Spell(SpellNum).Data3) Call PlayerMsg(Index, "You have teleported " & GetPlayerName(n), BrightBlue) Call PlayerMsg(n, "You have been teleported by " & GetPlayerName(Index), BrightBlue) Moved = YES Else Call PlayerMsg(Index, GetPlayerName(n) & " is not online", BrightRed) End If Else Call PlayerMsg(Index, "You can't teleport NPC'S", BrightRed) End If Casted = True Exit Sub End If
[Edit] I have edited this post to make the tutorial easier to read
|