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

My very first script - Scripted Spell - Teleport


Drummerpete
 Share

Recommended Posts

this is the whole sub, did I do everything right?

```
' Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
      Select Case Script
                Case 0
                  If GetPlayerMP(index) >=10 Then
                      Call PlayerWarp(index, 5, 25, 25) ' on a scrolling map of 50x50, Player would be in the middle?
                      Call SetPlayerMP(index, int(GetPlayerMP - 10))
                  End If
            Exit Sub
    End Select
End Sub
```
Link to comment
Share on other sites

you need to use these two commands i believe so that it will update your character

```
Sub SendMP(ByVal index As Long)
Sub SendMap(ByVal mapper As Long)

```
Here try this

```
' Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
      Select Case Script
                Case 0
                  If GetPlayerMP(index) >=10 Then
                      Call PlayerWarp(index, 5, 25, 25) ' on a scrolling map of 50x50, Player would be in the middle?
                      Call SetPlayerMP(index, int(GetPlayerMP - 10))
                      call SendMP(index)
                      Call SendMap(index)
                  End If
            Exit Sub
    End Select
End Sub

```
i believe that should work

here is the link to the topic explaining the update commands
[http://www.touchofdeathforums.com/smf/index.php/topic,29208.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,29208.0.html)

hope that helps.
Link to comment
Share on other sites

```
Sub ScriptedSpell(Index, Script)
      Select Case Script
                Case 0
                  If GetPlayerMP(index) >=10 Then
                      Call PlayerWarp(index, 5, 25, 25)
                      Call SetPlayerMP(index, int(GetPlayerMP - 10))
                      Call SendPlayerData(index)
                  End If
            Exit Sub
Case Else
Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
    End Select
End Sub
```Lucifer, that could very well work, but mine is simpler. It only uses 1 command whereas yours uses two.
Desiderium, you might want to make a case else at the end, in case no scripting spell is found. I added that for you.
Link to comment
Share on other sites

SendPlayerData refresh Stats I assume (at least that's what I use it for)

Use SendMP only if you modify the ammount of MP cuz as for now, there is absolutely no change in the player's MP, there is only a check if player's MP is at 10 or more (at least in the original script)…
Link to comment
Share on other sites

Sub SendMP(ByVal index As Long) - Updates MP
Sub SendMap(ByVal mapper As Long) - Updates the map
Sub SendPlayerData(ByVal index As Long) - Updates index, name, sprite, map, x, y, direction, access level, PK status, guild, guild access level, class, head picture, body picture, leg picture, paperdoll information, and hardcoded skills

as you can see the sen player data sub does not update mp so i decided on using all that was need for it instead of using mp and Pdata i just used mp and map update. so i think i got a touchdown on this.
No Offence

Thank Balliztik for these otherwise i would never know….
Link to comment
Share on other sites

@lucifer1101:

> Sub SendMP(ByVal index As Long) - Updates MP
> Sub SendMap(ByVal mapper As Long) - Updates the map
> Sub SendPlayerData(ByVal index As Long) - Updates index, name, sprite, map, x, y, direction, access level, PK status, guild, guild access level, class, head picture, body picture, leg picture, paperdoll information, and hardcoded skills
>
> as you can see the sen player data sub does not update mp so i decided on using all that was need for it instead of using mp and Pdata i just used mp and map update. so i think i got a touchdown on this.
> No Offence
>
> Thank Balliztik for these otherwise i would never know….

Knew that list would come in handy one day.

I liked how SendPaperdoll refreshed the map. Good fun.
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...