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

Help Please - Scriptedspell breaks when I do this.


Kite
 Share

Recommended Posts

    Sub ScriptedSpell(Index, Script)
  Select Case Script

        Case 0
    Dim Target
  Dim Map
  If GetPlayerTarget(Index) > 0 Then
      ' Target is a player, exit.
      Exit Sub
  Else
      Target = GetPlayerTargetNpc(Index)
      Map = GetPlayerMap(Index)
      If GetMapNpcHP(Map, Target) = 10 Then
        Call dmgspell(index, 5, 20, 8, 2, "magic1.wav")
      End If
  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

This is what breaks it.

If GetMapNpcHP(Map, Target) = 10 Then

Idk what it could be, that if statement works everywhere but in my scriptedspells
Link to comment
Share on other sites

Okay.. here i go XD

```

    Sub ScriptedSpell(Index, Script)
  Select Case Script

        Case 0
    Dim Target
  If GetPlayerMp(index) < 10 Then
  Exit Sub
  End If
  If GetPlayerTarget(Index) > 0 Then
      ' Target is a player, exit.
      Exit Sub
  Else
      Target = GetPlayerTargetNpc(Index)
      I = 1
Do While I < 50
If IsPlaying(I) Then
If GetPlayerMap(I) = GetPlayerMap(index) Then
Call PlaySound(I, "magic1.wav")
End If
End If
I = I + 1
Loop
      If GetMapNpcHP(GetPlayerMap(Index), Target) = 10 Then
            Call SpellAnim(2, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), target), GetNpcY(GetPlayerMap(index), Target))
        Call SetMapNpcHp(GetPlayerMap(index), Target, GetMapNpcHp(GetPlayerMap(index),Target) - 20)
  Call SetPlayerMp(index, GetPlayerMp(index) - 5)
      End If
  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

```
Sub DmgSpell doesnt exists?

Let me know how that goes :0
Link to comment
Share on other sites

@[THE-KRIS:

> link=topic=51270.msg537932#msg537932 date=1251916036]
> Okay.. here i go XD
>
> ```
>       I = 1
> Do While I < 50
> If IsPlaying(I) Then
> If GetPlayerMap(I) = GetPlayerMap(index) Then
> Call PlaySound(I, "magic1.wav")
> End If
> End If
> I = I + 1
> Loop
>
> ```

Just use:
Call PlaySoundToMap(Index, "magic1.wav")

@Tsukasa:

> It has 30 hp, the point of it being, I cant kill it anymore when it hits 10 hp.
> So thats why I need a scriptedspell called Data Drain.
>
> And Admiral set that up for me.

When testing it, test it on an NPC with exactly 10hp as default.
Link to comment
Share on other sites

@Tsukasa:

> I tried, and still failed.
> I can't give up, cause ther's got to be a reason the if does not work there.
> It works everywhere else I put it.

You're using the main that Bobosk* uploaded now, right?
If you have the source on hand, think you can check the clsCommands or w/e it's called, and paste the GetMapNpcHP function for me?

*Ballie not upload that  ;)
Link to comment
Share on other sites

I replaced it all, it does it on all monsters, but it's the only thing to kill data bugs.
I made it a random numbers system, -hp, -mp, death, Infected, ect….
If your not on amap I put, it stops it from being used, and sets the random number above what it goes.

Anyway all I working good.
Locked now
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...