Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Teleport Spell
#1
This is an old school tutorial. I didn't make it, I just cleaned it up a little. There is still room for cleaning, particularly in the SpellEditorInit Sub and SpellEditorOk Sub, but I'm pretty sure it functions as is. Not sure if this is posted here already, didn't look too hard.

1>open up your client project and open up ModTypes.
2>Search for "Public Const SPELL_TYPE_GIVEITEM = 6" (without quotes)
3> add
Code:
Public Const SPELL_TYPE_TELEPORT= 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 to display each scroll bar's value "Mapnum", "lblMapX" and "lblMapY",
in the same order as the scroll bars
6> Paste this into frmSpellEditor

Code:
Private Sub scrlMapnum_Change()
    MapNum.Caption = scrlMapnum.Value
End Sub

Private Sub scrlMapX_Change()
    lblMapX.Caption = scrlMapX.Value
End Sub

Private Sub scrlMapY_Change()
    lblMapY.Caption = scrlMapY.Value
End Sub

Private Sub Form_Load()
    scrlMapnum.Max = MAX_MAPS
    scrlMapX.Max = MAX_MAPX
    scrlMapY.Max = MAX_MAPY
End Sub

In the "Private Sub cmbType_Click()"

Under:

Code:
If cmbType.ListIndex  SPELL_TYPE_GIVEITEM Then
        fraVitals.Visible = True
        fraGiveItem.Visible = False
    Else
        fraVitals.Visible = False
        fraGiveItem.Visible = True
    End If


Add:

Code:
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 and find the "List" property then press the arrow, under "Give item" type "Teleport"

7> open up modGameLogic and find "Public Sub SpellEditorOk()"

Under:

Code:
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:

Code:
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:

Code:
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:

Code:
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
Code:
Public Const SPELL_TYPE_TELEPORT= 7

Now open modGameLogic,
and search for: "If Spell(SpellNum).Type = SPELL_TYPE_GIVEITEM Then"
under that
add:

Code:
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
Reply
#2
why cant we warp npcs?
Reply
#3
Because you touch yourself at night.
Reply
#4
Put your hand up if you want Labmonkey banned.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
Good enough reason for me.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#6
-raises hand- More of a reason!
Reply
#7
Hey, let's go ban him from OGCore as well! Go go go!
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#8
DONE!
Reply
#9
Yeah, we're awesome!
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#10
Is he really banned?
Reply
#11
Hikaru Wrote:Is he really banned?

Are you calling me and Robin liars? :roll:
Reply
#12
GIAKEN Wrote:Are you calling me and Robin liars? :roll:

Blasphemy.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)