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

[EO] Transformation spell


Qazek
 Share

Recommended Posts

Tested, working 100%

CLIENT SIDE

Open Spell Editor and add:

label:
name - lblSprite
caption - Transformation sprite:

scroll bar:
name - scrlSprite

Add to your scrollbar:
```
    lblSprite.Caption = "Transformation sprite: " & scrlSprite.Value
    Spell(EditorIndex).Sprite = scrlSprite.Value
```
Go to modGameEditors, find sub:
SpellEditorInit

In this sub find:
```
        .scrlStun.Value = Spell(EditorIndex).StunDuration
```
Add:
```
        .scrlSprite.Value = Spell(EditorIndex).Sprite
```
Go to modTypes, find:
```
Private Type SpellRec
```
Add to this type:
```
    Sprite As Long
```
SERVER SIDE

Go to modTypes, find:
```
Private Type SpellRec
```
Add to this type:
```
    Sprite As Long
```
In modPlayer in Sub CastSpell find:
```
        Case 0 ' self-cast target
            Select Case Spell(spellnum).Type
                Case SPELL_TYPE_HEALHP
                    SpellPlayer_Effect Vitals.HP, True, Index, Vital, spellnum
                    DidCast = True
                Case SPELL_TYPE_HEALMP
                    SpellPlayer_Effect Vitals.MP, True, Index, Vital, spellnum
                    DidCast = True
                Case SPELL_TYPE_WARP
                    SendAnimation MapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                    PlayerWarp Index, Spell(spellnum).Map, Spell(spellnum).x, Spell(spellnum).y
                    SendAnimation GetPlayerMap(Index), Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                    DidCast = True
            End Select
```
Change for this:
```
        Case 0 ' self-cast target
            Select Case Spell(spellnum).Type
                Case SPELL_TYPE_HEALHP
                    SpellPlayer_Effect Vitals.HP, True, Index, Vital, spellnum
                    If Spell(spellnum).Sprite > 0 Then
                        SendAnimation MapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                        SetPlayerSprite Index, Spell(spellnum).Sprite
                        Call SendPlayerData(Index)
                    End If
                    DidCast = True
                Case SPELL_TYPE_HEALMP
                    SpellPlayer_Effect Vitals.MP, True, Index, Vital, spellnum
                    If Spell(spellnum).Sprite > 0 Then
                        SendAnimation MapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                        SetPlayerSprite Index, Spell(spellnum).Sprite
                        Call SendPlayerData(Index)
                    End If
                    DidCast = True
                Case SPELL_TYPE_WARP
                    SendAnimation MapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                    PlayerWarp Index, Spell(spellnum).Map, Spell(spellnum).x, Spell(spellnum).y
                    SendAnimation GetPlayerMap(Index), Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                    DidCast = True
            End Select
```
It is all! Now when you use addhp and addmp spell and if you set sprite in spell editor > than 0 your sprite change to this what is in spell editor ;)
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
You could edit it to work as a completely different spell, and have classes transform and get buffs from it, really it could be used for lots of things, as can any code. You could turn it into a system where you transform into an animal and move faster, etc.

~Urame
Link to comment
Share on other sites

  • 10 months later...
@Reflow:

> this code works great but i see one problem. well not really a problem, once u use the spell you do not return back to your original sprite

create a way to save the player's sprite number and a counter.
Link to comment
Share on other sites

  • 3 weeks later...
Thnx erwin , found the code compiled the server file but im having trouble with the client side.

If frmEditor_Conv.Visible = False Then Exit Sub

Compile Error Variable not Defined
Did i mess up on the label and scrollbar?

Nevermind , this is for the conversation system i believe , ill post the question there if i cant figure it out. XD
Link to comment
Share on other sites

  • 1 month later...
I finished client side, and as I was compiling ".scrlSprite" got highlighted and I got an error. "Compile error: method or data member not found". I looked around and can't seem to realize why it wouldn't recognize the variable. Thoughts?
Link to comment
Share on other sites

  • 3 months later...
Client Side

Go to PlayerRec and find

    Sprite As Long

add below it

    Spriteold As Long

Server Side

Go to PlayerRec and find

    Sprite As Long

add below it

    Spriteold As Long

Go to Sub JoinGame Place

    SetPlayerSpriteOld index, Player(index).Sprite

after

    Call SendHotbar(index)

Search for

Sub SetPlayerSprite(ByVal index As Long, ByVal Sprite As Long)

after that sub paste

Sub SetPlayerSpriteOld(ByVal index As Long, ByVal Sprite As Long)
    Player(index).Spriteold = Sprite
End Sub

replace all the

                    If Spell(spellnum).Sprite > 0 Then
                        SendAnimation MapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index
                        SetPlayerSprite Index, Spell(spellnum).Sprite
                        Call SendPlayerData(Index)
                    End If

with

                    If Spell(spellNum).Sprite > 0 Then
                        If Player(index).Sprite = Player(index).Spriteold Then
                            SetPlayerSpriteOld index, Player(index).Sprite
                            SetPlayerSprite index, Spell(spellNum).Sprite
                            Call SendPlayerData(index)
                        Else
                            SetPlayerSprite index, Player(index).Spriteold
                            Call SendPlayerData(index)
                        End If
                    End If

Now when you cast the spell the second time it'll return you to your previous sprite.

Works for me let me know if it works for you guys… might not being as I have Transform set as a different spell type.
Link to comment
Share on other sites

        Place
SetPlayerSprite index, Player(index).Spriteold
        Before
' Check if player was the only player on the map and stop npc processing if so

So it sets your sprite back to what it was when you logged in, when you log out.

Only problem I can think of is multiple transformations will mess with it. xD

Edit: never mind its easy enough to fix have it so you change back to normal sprite before changing to next one and so it records your normal sprite before you transform - and as far as i know it now works. :)
Link to comment
Share on other sites

  • 3 months later...
If anyone has added the buff debuff spells and wants to use the timer to change back i figured it out!
All serverside
in mod player at the bottom add
```
Public Sub transback(ByVal index As Long)
              SetPlayerSprite (index), Player(index).SpriteOld
                            Call SendPlayerData(index)
End Sub

```
then go to mod serverloop
find ```
If TempPlayer(i).BuffTimer(x) > 0 Then
                        TempPlayer(i).BuffTimer(x) = TempPlayer(i).BuffTimer(x) - 1
                        If TempPlayer(i).BuffTimer(x) = 0 Then
```
and paste this right after
```
Call transback(i)
```
Link to comment
Share on other sites

@or3o:

> If anyone has added the buff debuff spells and wants to use the timer to change back i figured it out!
> All serverside
> in mod player at the bottom add
> ```
> Public Sub transback(ByVal index As Long)
>               SetPlayerSprite (index), Player(index).SpriteOld
>                             Call SendPlayerData(index)
> End Sub
>
> ```
> then go to mod serverloop
> find ```
> If TempPlayer(i).BuffTimer(x) > 0 Then
>                         TempPlayer(i).BuffTimer(x) = TempPlayer(i).BuffTimer(x) - 1
>                         If TempPlayer(i).BuffTimer(x) = 0 Then
> ```
> and paste this right after
> ```
> Call transback(i)
> ```

Why make a whole sub for that?
Link to comment
Share on other sites

yes you have to add the stuff Whitepinkbun posted also. and sorry i wasnt exactly sure how else to go about this so i made another sub :/ if you know a more efficient way please feel free to tell me. im still a noob
Link to comment
Share on other sites

Its useless to make a whole sub if you only use code one time.
Just do it like this:

> then go to mod serverloop
> find
> ```
> If TempPlayer(i).BuffTimer(x) > 0 Then
> TempPlayer(i).BuffTimer(x) = TempPlayer(i).BuffTimer(x) - 1
> If TempPlayer(i).BuffTimer(x) = 0 Then
> ```
>
> and paste this right after
> ```
> SetPlayerSprite (index), Player(index).SpriteOld
> Call SendPlayerData(index)
> ```
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...