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

ScriptedSpell Case 1 will not work


drktemplar
 Share

Recommended Posts

I can get Case 0 to work, but once I add a second case neither of them work.  Anyone know what I'm doing wrong?

' Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
Select Case Script
' Teleport Spell (for testing)
Case 0
Dim pm
Dim pmm

pm = GetPlayerMp(Index)
pmm = GetPlayerMaxMp(Index)

Call PlayerMsg(Index, "Teleport Spell", WHITE)
Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)
        If pm > 500 Then
Call PlayerMsg(Index, "Mana is higher then 500", WHITE)
          Call PlayerWarp(index, 1, 10, 10)
          Call SetPlayerMP(index, pm - pm)
    Else
    Call PlayerMsg(Index, "Teleport Spell did not work, why?", WHITE)
    End If

Case 1
Dim pm
pm = GetPlayerMp(Index)
Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)

Case Else
Call PlayerMsg(Index, "Case Else Statemenet", WHITE)

Exit Sub
End Select
End Sub
Link to comment
Share on other sites

Ok now i have added to it and nothing works again.  =  (
I do have a Sub Buff that I got somewhere on these forums.  I posted it after my script.

Sub ScriptedSpell(Index, Script)
Select Case Script
' Teleport Spell (for testing)
Dim pm
Dim pmm
Dim ps
Case 0
pm = GetPlayerMp(Index)
pmm = GetPlayerMaxMp(Index)

Call PlayerMsg(Index, "Teleport Spell", WHITE)
Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)
        If pm > 500 Then
Call PlayerMsg(Index, "Mana is higher then 500", WHITE)
          Call PlayerWarp(index, 1, 10, 10)
          Call SetPlayerMP(index, pm - pm)
    Else
    Call PlayerMsg(Index, "Teleport Spell did not work, why?", WHITE)
    End If
        Exit Sub

Case 1
pm = GetPlayerMP(Index)
ps = GetPlayerStr(Index)
If GetPlayerTarget(Index) > 0 Then
    Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)
    Call Buff(GetPlayerTarget(Index), 0, 33, 60)
    Call PlayerMsg(Index, "Strength = "& ps,WHITE)
Else
    Call PlayerMsg(Index, "You do not have a target!", WHITE)
End If

Case Else
Call PlayerMsg(Index, "Case Else Statemenet", WHITE)

Exit Sub
End Select
End Sub

***********************************************
Sub Buff(index, stat, amount, duration)
If GetVar("Buff.ini", GetPlayerName(index), CStr(stat)) = "" Then
  Select Case stat
  Case 0
    Call SetPlayerStr(index, GetPlayerStr(index) + Int(Amount))
  Case 1
    Call SetPlayerDef(index, GetPlayerDef(index) + Int(Amount))
  Case 2
    Call SetPlayerMagi(index, GetPlayerMagi(index) + Int(Amount))
  Case 3
    Call SetPlayerSpeed(index, GetPlayerSpeed(index) + Int(Amount))
  Case Else
  Exit Sub
    End Select
    Call SendStats(index)
    Call PutVar("Buff.ini", GetPlayerName(index), CStr(stat), Cstr(amount))
    duration = duration * 1000
    Call SetTimer("Debuff " & index & ", " & CStr(stat), duration)
    Call SendHP(index)
    Call SendMP(index)
    Call SendSP(index)
  End If
End Sub

Sub Debuff(index, stat)
Amount = GetVar("Buff.ini", GetPlayerName(index), CStr(stat)) 
  Select Case stat
Case "0"
  Call SetPlayerStr(index, GetPlayerStr(index) - Int(Amount))
Case "1"
  Call SetPlayerDef(index, GetPlayerDef(index) - Int(Amount))
Case "2"
  Call SetPlayerMagi(index, GetPlayerMagi(index) - Int(Amount))
Case "3"
  Call SetPlayerSpeed(index, GetPlayerSpeed(index) - Int(Amount))
  End Select
Call SendStats(index)
Call PutVar("Buff.ini", GetPlayerName(index), CStr(stat), "")
Call RemoveTimer("Debuff " & index & ", " & CStr(stat))
Call SendHP(index)
Call SendMP(index)
Call SendSP(index)
End Sub
Link to comment
Share on other sites

OK Now I'm using the below script and it appears to be working, but i ran into another problem.  I have to re-memorize each spell everytime i switch back and forth to use them.  For example:  I use the "Teleport" spell and then if I try and use the "test" spell it actually tries to use the "Teleport" spell again.  I have to double click it in the spell list to re-memorize it and then I can use it.  I thought I read something about this being a bug and some fix out there for it,  but I'm not sure.  If there is a fix I can't find it.

Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
  Select Case Script
' Teleport Spell (for testing)
Case 0
Dim pm
Dim pmm

pm = GetPlayerMp(Index)
pmm = GetPlayerMaxMp(Index)

Call PlayerMsg(Index, "Teleport Spell", WHITE)
Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)
If pm > 500 Then
    Call PlayerMsg(Index, "Mana is higher then 500", WHITE)
    Call PlayerWarp(index, 1, 10, 10)
    Call SetPlayerMP(index, pm - pm)
Else
    Call PlayerMsg(Index, "Teleport Spell did not work, why?", WHITE)
End If

Case 1
pm = GetPlayerMp(Index)

Call PlayerMsg(Index, "Magic Points = "& pm, WHITE)
If pm >9 Then
    Call Buff(GetPlayerTarget(index), 0, 10, 60)
    Call SetPlayerMP(Index, pm - 10)
Else
    Call PlayerMsg(Index, "You do not have enough mana", WHITE)
End If

Case Else
Call PlayerMsg(Index, "Case Else Statemenet", WHITE)

      Exit Sub
  End Select
End Sub
Link to comment
Share on other sites

There's two ways to cast a spell in Eclipse:
After selecting your target…
1\. Double-click on it to memorize it, then press Insert.
2\. Select it on the Spells menu (single click), then click "Cast". 

If you're going to be switching spells a lot, it's probably better to keep the spell menu open so you can click on a new spell and click Cast a bit faster. 

Having more than one key to which you could assign spells would be nice, but it's not the way Eclipse normally functions. 

I hope that answers your question.
Link to comment
Share on other sites

Well it doesn't work that way for me.

If I single click a different spell in my spell list and double click cast, the last spell i had cast is the one that goes off.  Even though I single clicked a different one in the list.  If i double click and re-memorize the second spell then I can cast it.

If this is the way it's written then that's fine.  But Is there a way to write macros within EE 2.7?
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...