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

(EO 2.0) Buff Transformation


tslusny
 Share

Recommended Posts

This tutorial is required [http://www.touchofdeathforums.com/smf2/index.php/topic,78666.0.html](http://www.touchofdeathforums.com/smf2/index.php/topic,78666.0.html)

Thx to Ryoku Hasu for making Buff system.
And thx to Qazek for Transformation spell base
Some parts of this tutorial are from Qazeks tutorial
Credits to Ryoku Hasu and Qazek

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
```
Go to PlayerRec and find

```
    Sprite As Long
```
add below it

```
    Spriteold As Long
```
SERVER SIDE

Go to modTypes, find:
```
Private Type SpellRec
```
Add to this type:
```
    Sprite As Long
```
Go to PlayerRec and find

```
    Sprite As Long
```
add below it

```
    Spriteold As Long
```
Again in PlayerRec

Search for

```
Equipment(1 To Equipment.Equipment_Count - 1) As Long
```
Add below it

```
EquipmentOld(1 To Equipment.Equipment_Count - 1) As Long
```
And finnaly still in PlayerRec add to bottom of PlayerRec

```
Transformed As Boolean
```
Go to Sub JoinGame Place

```
    SetPlayerSpriteOld index, Player(index).Sprite
              SetPlayerEquipmentOld index, Player(index).Equipment(1), Weapon
              SetPlayerEquipmentOld index, Player(index).Equipment(2), Armor
              SetPlayerEquipmentOld index, Player(index).Equipment(3), Shield
              SetPlayerEquipmentOld index, Player(index).Equipment(4), Helmet
```
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
```
Search for

```
Sub SetPlayerEquipment(ByVal index As Long, ByVal InvNum As Long, ByVal EquipmentSlot As Equipment)
```
after that sub paste

```
Sub SetPlayerEquipmentOld(ByVal index As Long, ByVal InvNum As Long, ByVal EquipmentSlot As Equipment)
    Player(index).EquipmentOld(EquipmentSlot) = InvNum
End Sub
```
Search for

```
' Check if player was the only player on the map and stop npc processing if so
```
Above place

```
SetPlayerSprite index, Player(index).Spriteold
          SetPlayerEquipment index, Player(index).EquipmentOld(1), Weapon
          SetPlayerEquipment index, Player(index).EquipmentOld(2), Armor
          SetPlayerEquipment index, Player(index).EquipmentOld(3), Shield
          SetPlayerEquipment index, Player(index).EquipmentOld(4), Helmet
```
In Sub CastSpell
Search for

```
Case 0 ' self-cast target
```
Here find

```
Case SPELL_TYPE_BUFF
```
Above
```
DidCast = true
```
Paste

```
If Player(index).Transformed = False Then
                    If Spell(SpellNum).Sprite > 0 Then
                        SetPlayerSpriteOld index, Player(index).Sprite
                        SetPlayerSprite index, Player(index).Spriteold
                        SetPlayerSprite index, Spell(SpellNum).Sprite
                        SetPlayerEquipmentOld index, Player(index).Equipment(1), Weapon
                        SetPlayerEquipmentOld index, Player(index).Equipment(2), Armor
                        SetPlayerEquipmentOld index, Player(index).Equipment(3), Shield
                        SetPlayerEquipmentOld index, Player(index).Equipment(4), Helmet

                        SetPlayerEquipment index, Player(index).EquipmentOld(1), Weapon
                        SetPlayerEquipment index, Player(index).EquipmentOld(2), Armor
                        SetPlayerEquipment index, Player(index).EquipmentOld(3), Shield
                        SetPlayerEquipment index, Player(index).EquipmentOld(4), Helmet

                        SetPlayerEquipment index, 0, Weapon
                        SetPlayerEquipment index, 0, Armor
                        SetPlayerEquipment index, 0, Shield
                        SetPlayerEquipment index, 0, Helmet

                        Player(index).Transformed = True
                        Call SendWornEquipment(index)
                        Call SendMapEquipment(index)
                        Call SendVital(index, Vitals.HP)
                        Call SendVital(index, Vitals.MP)
                        ' send vitals to party if in one
                        If TempPlayer(index).inParty > 0 Then SendPartyVitals TempPlayer(index).inParty, index
                        Call SendPlayerData(index)
                    End If
                    Else
                        PlayerMsg index, "You can not transform this player!", BrightRed
                    End If
```
Now search for (still in Sub CastSpell)

```
Case 1, 3 ' self-cast AOE & targetted AOE
```
Here find

```
Case SPELL_TYPE_BUFF
```
Above
```
DidCast = true
```
Add

```
If Player(Target).Transformed = False Then
                            If Spell(SpellNum).Sprite > 0 Then
                                SetPlayerSpriteOld Target, Player(Target).Sprite
                                SetPlayerSprite Target, Player(Target).Spriteold
                                SetPlayerSprite Target, Spell(SpellNum).Sprite
                                SetPlayerEquipmentOld Target, Player(Target).Equipment(1), Weapon
                                SetPlayerEquipmentOld Target, Player(Target).Equipment(2), Armor
                                SetPlayerEquipmentOld Target, Player(Target).Equipment(3), Shield
                                SetPlayerEquipmentOld Target, Player(Target).Equipment(4), Helmet

                                SetPlayerEquipment Target, Player(Target).EquipmentOld(1), Weapon
                                SetPlayerEquipment Target, Player(Target).EquipmentOld(2), Armor
                                SetPlayerEquipment Target, Player(Target).EquipmentOld(3), Shield
                                SetPlayerEquipment Target, Player(Target).EquipmentOld(4), Helmet

                                SetPlayerEquipment Target, 0, Weapon
                                SetPlayerEquipment Target, 0, Armor
                                SetPlayerEquipment Target, 0, Shield
                                SetPlayerEquipment Target, 0, Helmet

                                Player(Target).Transformed = True
                                Call SendWornEquipment(Target)
                                Call SendMapEquipment(Target)
                                Call SendVital(Target, Vitals.HP)
                                ' send vitals to party if in one
                                If TempPlayer(Target).inParty > 0 Then SendPartyVitals TempPlayer(Target).inParty, Target
                                Call SendPlayerData(Target)
                            End If
                            Else
                            PlayerMsg index, "You can not transform this player!", BrightRed
                            End If
```
And this same code add to

```
Case 2 ' targetted
```
In

```
Case SPELL_TYPE_BUFF
```
Above
```
DidCast = true
```
Now  in Sub ServerLoop search for

```
TempPlayer(i).Buffs(x) = 0
```
Add above that

```
                  SetPlayerSprite (i), Player(i).Spriteold
                            SetPlayerEquipment (i), Player(i).EquipmentOld(1), Weapon
                            SetPlayerEquipment (i), Player(i).EquipmentOld(2), Armor
                            SetPlayerEquipment (i), Player(i).EquipmentOld(3), Shield
                            SetPlayerEquipment (i), Player(i).EquipmentOld(4), Helmet

                            Player(i).Transformed = False
                            Call SendPlayerData(i)
                            Call SendWornEquipment(i)
                            Call SendMapEquipment(i)
                            Call SendVital(i, Vitals.HP)
                            Call SendVital(i, Vitals.MP)
                            ' send vitals to party if in one
                            If TempPlayer(i).inParty > 0 Then SendPartyVitals TempPlayer(i).inParty, i
```
Now go to Sub UseItem

Here search for

```
ItemNum = GetPlayerInvItemNum(index, InvNum)
```
Add below it

     ```
If Player(index).Transformed = True Then
            If Item(ItemNum).Type >= ITEM_TYPE_WEAPON And Item(ItemNum).Type <= ITEM_TYPE_SHIELD Then
                PlayerMsg index, "Cant equip items while transformed.", BrightRed
                Exit Sub
            End If
        End If
```
And now u have working Buff Transformation in your game. I tested this in my game and it working.

Please report any bugs you will found.
Link to comment
Share on other sites

it unequip your equipped items but it dont give them to your inventory they just disappear from equipped slots and after time it reapear ,but stats from items disappear and reapear too. So it just unequip items but dont give them to inventory.
Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...
  • 1 month later...
  • 2 years later...

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...