Scorpious2k Posted November 5, 2009 Author Share Posted November 5, 2009 I have given the spell code a rewriting, and added a number of new features and some new spell types. The version I am working with, and therefore the one with which these changes will work, is Eclipse Stable. It shouldn't be too difficult to change it to work with svn or 2.7, but be aware these changes are for the Eclipse Stable version.Here is a summary…**Spell types** (* indicates new type of spell):Cure - Adds HP, reducing damage from attack.Warmth - Adds MP, restoring used manaBurst - Adds SP.* Shield - Adds DEF, increasing protection and reducing the impact of attacks* Strengthen - Adds STR, increasing impact of attacksDeath - subtracts HP, used for attack.Physche - subtracts MP, reducing the target's ability to attack with magicSlow - Subtracts SP.* Expose - Subtracts DEF, making attacks have a greater impact* Weaken - Subtracts STR, making attacks on others have less impact* Root - Makes target unable to move* Stun - Stuns target, making it unable to move or attack* Warp - moves to predefined location (player only)* Summon - moves target to castor* Bind - changes location where target respawns after death to current (player only)Scripted - calls script to handle spell**Limited spells:**Spells can now have a limited duration, after which it "wears off" and the effects of the spell are removed and reversed.NOTES: Only stats changes are reversed. Changes of MP, HP, and SP are not reversed.Spells cast where target and castor are on arena tiles and are still active when arena is left by target are removed no matter how much time remains**DoT/BoT - Damage over Time/Buff over Time**A spell with a duration set, can also optionally have a frequency set. Frequency means that the spell effect is repeated after every [frequency value] seconds.Example: Death type spell, vital mod = 5, duration = 120, frequency = 10\.Once cast, this spell would subtract 5 HP, then subtract another 5 HP every 10 seconds until 2 minutes (120 seconds) have passed.**Effects:*** Castor only - spell only affects castor, ignores target* Target - spell only affects target (player can target himself)* Area - spell affects all in range of castor (castor is immune to detrimental effects, NPCs are immune to Warp & Bind)* Party - spell affects all party members no matter where they are in the gameThis is an EXTENSIVE change. It isn't a little patch here and line change there. **The player character record has to be changed to make this work.** That means unless converted, all current player characters will be broken. I have my usual "dynamic fix" code in that fixes records when players login, but this may not be right for you.I have rewritten castspell() and replaced it with a 1200+ line module modSpells.bas. This new module will have to be added to your project.I have modified the spell editor to include these changes. This new frmSpellEditor.frm and frmSpellEditor.frx will need to replace the ones you have.The rest of the changes involve plugging all this in so that it works. If you are still with me and still want to add this to your game, don't forget to back everything up. Make a copy of everything and save it.Once you have made your backup, download the two attached files. Link to comment Share on other sites More sharing options...
evilbunnie Posted November 5, 2009 Share Posted November 5, 2009 Nice! Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 5, 2009 Author Share Posted November 5, 2009 ************************** SERVER CHANGES **************************To start with, we need to add the new spells module to he project. The unzip the file modSpells.zip, that you downloaded above, into the source directory of the server.Start VB6, load the server project, open the project menu at the top and select **Add Module**. Select the "Existing" tab. Find the file modSpells.bas, and select it. Click the open button.Now for the code changes:In **frmServer.bas Timer1Timer()**, at the bottom, after``` If SCRIPTING = 1 Then MyScript.ExecuteStatement "Scripts\main.ess", "TimedEvent " & Hours & "," & Minutes & "," & Seconds End If```add``` Call CheckAllExpiredSpells ' check for limited spells that expired```In **modDatabas.bas** In **AddChar()** after``` Player(index).Char(CharNum).Map = ClassData(ClassNum).Map Player(index).Char(CharNum).X = ClassData(ClassNum).X Player(index).Char(CharNum).Y = ClassData(ClassNum).Y```add``` Player(index).Char(CharNum).BindMap = Player(index).Char(CharNum).Map Player(index).Char(CharNum).BindX = Player(index).Char(CharNum).X Player(index).Char(CharNum).BindY = Player(index).Char(CharNum).Y```after``` Player(index).Char(CharNum).Head = headc Player(index).Char(CharNum).Body = bodyc Player(index).Char(CharNum).Leg = logc```add``` Call ClearSpellsPlayer(index, CharNum)``` In **ClearPlayer()** after``` For I = 1 To MAX_CHARS```add``` Call ClearSpellsPlayer(index, I)``` In **ClearChar()** after``` Dim n As Long```add``` Call ClearSpellsPlayer(index, CharNum)```after```Function GetClassMAGI(ByVal ClassNum As Long) As Long GetClassMAGI = ClassData(ClassNum).MagiEnd Function```add```Function GetPlayerSTRonly(ByVal index As Long) As Long GetPlayerSTRonly = Player(index).Char(Player(index).CharNum).STREnd Function```after```Sub SetPlayerSTR(ByVal index As Long, ByVal STR As Long) Player(index).Char(Player(index).CharNum).STR = STREnd Sub```add```Sub SetPlayerBind(ByVal index As Long, ByVal mapid As Integer, ByVal X As Integer, ByVal Y As Integer) Player(index).Char(Player(index).CharNum).BindMap = mapid Player(index).Char(Player(index).CharNum).BindX = X Player(index).Char(Player(index).CharNum).BindY = YEnd SubFunction GetPlayerDEFonly(ByVal index As Long) As Long GetPlayerDEFonly = Player(index).Char(Player(index).CharNum).DEFEnd Function```after```Function GetPlayerTargetNpc(ByVal index As Long) As Long GetPlayerTargetNpc = Player(index).TargetNPCEnd Function```add```Sub WarpToBind(index As Long) Dim CharNum As Long CharNum = Player(index).CharNum If Player(index).Char(CharNum).BindMap > 0 Then Call PlayerWarp(index, Player(index).Char(CharNum).BindMap, Player(index).Char(CharNum).BindX, Player(index).Char(CharNum).BindY) Else If Map(GetPlayerMap(index)).BootMap > 0 Then Call PlayerWarp(index, Map(GetPlayerMap(index)).BootMap, Map(GetPlayerMap(index)).BootX, Map(GetPlayerMap(index)).BootY) Else Call PlayerWarp(index, START_MAP, START_X, START_Y) End If End IfEnd Sub```In **modTypes.bas**after```Type ElementRec Name As String * NAME_LENGTH Strong As Integer Weak As IntegerEnd Type```add```Type LimitedSpells Castor As Integer SpellID As Integer ' spell number expires As Integer ' number of seconds remaining nextCast As Integer ' time until next effect (seconds) freq As Integer ' frequency of casts restoreAmt As Integer ' amt to restore when spell expiresEnd Type```find```Public Type PlayerRec```scroll down to``` ' Worn equipment ArmorSlot As Integer WeaponSlot As Integer HelmetSlot As Integer ShieldSlot As Integer LegsSlot As Integer RingSlot As Integer NecklaceSlot As Integer```and add after it``` hasBuffs As Boolean hasCurses As Boolean isStunned As Boolean isRooted As Boolean inArena As Boolean Buff(1 To MAX_BUFFS) As LimitedSpells Curse(1 To MAX_CURSES) As LimitedSpells ' Bind Info BindMap As Integer BindX As Integer BindY As Integer```after```Type MapNpcRec num As Long Target As Long HP As Long MP As Long SP As Long```add``` STR As Long DEF As Long Speed As Long Magi As Long hasBuffs As Boolean hasCurses As Boolean isStunned As Boolean isRooted As Boolean Buff(1 To MAX_BUFFS) As LimitedSpells Curse(1 To MAX_CURSES) As LimitedSpells```In **clsCommands.bas**, scroll to the bottom and add```Sub WarpToBind(index As Long) Dim CharNum As Long CharNum = Player(index).CharNum If Player(index).Char(CharNum).BindMap > 0 Then Call PlayerWarp(index, Player(index).Char(CharNum).BindMap, Player(index).Char(CharNum).BindX, Player(index).Char(CharNum).BindY) Else If Map(GetPlayerMap(index)).BootMap > 0 Then Call PlayerWarp(index, Map(GetPlayerMap(index)).BootMap, Map(GetPlayerMap(index)).BootX, Map(GetPlayerMap(index)).BootY) Else Call PlayerWarp(index, START_MAP, START_X, START_Y) End If End IfEnd Sub```In **modGameLogic.bas** In **SpawnNPC()**after``` MapNPC(MapNum, MapNpcNum).HP = GetNpcMaxHP(NPCnum) MapNPC(MapNum, MapNpcNum).MP = GetNpcMaxMP(NPCnum) MapNPC(MapNum, MapNpcNum).SP = GetNpcMaxSP(NPCnum) MapNPC(MapNum, MapNpcNum).Dir = Int(Rnd * 4)```add``` MapNPC(MapNum, MapNpcNum).STR = GetNpcSTR(NPCnum) MapNPC(MapNum, MapNpcNum).DEF = GetNpcDEF(NPCnum) MapNPC(MapNum, MapNpcNum).Speed = GetNpcSpeed(NPCnum) MapNPC(MapNum, MapNpcNum).Magi = GetNpcMagi(NPCnum) Call ClearSpellsNPC(MapNum, MapNpcNum)``` In **AttackPlayer()**after``` If Map(GetPlayerMap(Attacker)).Tile(GetPlayerX(Attacker), GetPlayerY(Attacker)).Type <> TILE_TYPE_ARENA And Map(GetPlayerMap(Victim)).Tile(GetPlayerX(Victim), GetPlayerY(Victim)).Type <> TILE_TYPE_ARENA Then If Damage >= GetPlayerHP(Victim) Then```add``` Call ClearSpellsPlayer(Victim, Player(Victim).CharNum)```replace``` If Map(GetPlayerMap(Victim)).BootMap > 0 Then Call PlayerWarp(Victim, Map(GetPlayerMap(Victim)).BootMap, Map(GetPlayerMap(Victim)).BootX, Map(GetPlayerMap(Victim)).BootY) Else Call PlayerWarp(Victim, START_MAP, START_X, START_Y) End If```with``` WarpToBind (Victim)``` In **NPCAttackPlayer()**after``` ' Warp player away If SCRIPTING = 1 Then MyScript.ExecuteStatement "Scripts\main.ess", "OnDeath " & Victim Else```replace``` If Map(GetPlayerMap(Victim)).BootMap > 0 Then Call PlayerWarp(Victim, Map(GetPlayerMap(Victim)).BootMap, Map(GetPlayerMap(Victim)).BootX, Map(GetPlayerMap(Victim)).BootY) Else Call PlayerWarp(Victim, START_MAP, START_X, START_Y) End If```with``` Call WarpToBind(Victim)``` In **AttackNPC()**after``` ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range) MapNPC(MapNum, MapNpcNum).num = 0 MapNPC(MapNum, MapNpcNum).SpawnWait = GetTickCount MapNPC(MapNum, MapNpcNum).HP = 0```add``` Call ClearSpellsNPC(MapNum, MapNpcNum)```scroll down and find```Function GetNpcMaxSP(ByVal NPCnum As Long) As Long If NPCnum < 1 Or NPCnum > MAX_NPCS Then Exit Function End If GetNpcMaxSP = NPC(NPCnum).Speed * 2End Function```and after it add```Function GetNpcSTR(ByVal NPCnum As Long) As Long If NPCnum < 1 Or NPCnum > MAX_NPCS Then Exit Function End If GetNpcSTR = NPC(NPCnum).STREnd FunctionFunction GetNpcDEF(ByVal NPCnum As Long) As Long If NPCnum < 1 Or NPCnum > MAX_NPCS Then Exit Function End If GetNpcDEF = NPC(NPCnum).DEFEnd FunctionFunction GetNpcSpeed(ByVal NPCnum As Long) As Long If NPCnum < 1 Or NPCnum > MAX_NPCS Then Exit Function End If GetNpcSpeed = NPC(NPCnum).SpeedEnd FunctionFunction GetNpcMagi(ByVal NPCnum As Long) As Long If NPCnum < 1 Or NPCnum > MAX_NPCS Then Exit Function End If GetNpcMagi = NPC(NPCnum).MagiEnd Function``` In **CanNPCAttackPlayert()**after``` ' Make sure that the NPC isn't already dead. If MapNPC(MapNum, MapNpcNum).HP < 1 Then Exit Function End If```add``` ' If stunned, the NPC can't attack If MapNPC(MapNum, MapNpcNum).isStunned Then Exit Function End If```In **CanNPCMove()**after``` ' Check for sub-script out of range. If MapNpcNum < 1 Or MapNpcNum > MAX_MAP_NPCS Then Exit Function End If```add``` ' NPC can't move if stunned or rooted If MapNPC(MapNum, MapNpcNum).isRooted Or MapNPC(MapNum, MapNpcNum).isStunned Then CanNpcMove = False Exit Function End If```Finally, find **CastSpell()** and remove the entire sub!In **modHandleData.bas HandleData()**after``` Case "checkchar" Call Packet_CheckChar(index, Parse(1), Parse(2), Parse(3), Parse(4)) Exit Sub```add``` Case "inarena" Player(index).Char(Player(index).CharNum).inArena = True Exit Sub Case "outarena" Player(index).Char(Player(index).CharNum).inArena = False Call CheckArenaSpells(index) Exit Sub```In **modConstants.bas** Declarationsafter```Public Const MAX_NPC_DROPS = 10Public Const MAX_SHOP_ITEMS = 25```add```Public Const MAX_BUFFS = 7Public Const MAX_CURSES = 7```These are the maximum number of buffs and curses that can be on players/NPC's at any given time. You may adjust these numbers if you would like more or less than the default 7.after```' Spell Constants.Public Const SPELL_TYPE_ADDHP = 0Public Const SPELL_TYPE_ADDMP = 1Public Const SPELL_TYPE_ADDSP = 2Public Const SPELL_TYPE_SUBHP = 3Public Const SPELL_TYPE_SUBMP = 4Public Const SPELL_TYPE_SUBSP = 5Public Const SPELL_TYPE_GIVEITEM = 6Public Const SPELL_TYPE_SCRIPTED = 6```add```Public Const SPELL_TYPE_ADDDEF = 10Public Const SPELL_TYPE_ADDSTR = 11Public Const SPELL_TYPE_SUBDEF = 12Public Const SPELL_TYPE_SUBSTR = 13Public Const SPELL_TYPE_ROOT = 14Public Const SPELL_TYPE_STUN = 15Public Const SPELL_TYPE_WARP = 16Public Const SPELL_TYPE_BIND = 17Public Const SPELL_TYPE_SUMMON = 18```That concludes the server changes. Next I will post the client changes. Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 5, 2009 Author Share Posted November 5, 2009 ************************** CLIENT CHANGES **************************Get the second file you downloaded, frmSpellEditor.zip, and unzip it into your client source directory, replacing the files by the same name that are there.In **modTypes.bas**find **Type PlayerRec**after``` ' Worn equipment ArmorSlot As Long WeaponSlot As Long HelmetSlot As Long ShieldSlot As Long LegsSlot As Long RingSlot As Long NecklaceSlot As Long```add``` isRooted As Boolean isStunned As Boolean inArena As Boolean```In **modClientTCP.bas SendPlayerMove()**after```x = GetPlayerX(MyIndex)y = GetPlayerY(MyIndex)```add``` If x < 0 Or x > MAX_MAPX Or y < 0 Or y > MAX_MAPY Then If Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If ElseIf Map(GetPlayerMap(MyIndex)).Tile(x, y).Type = TILE_TYPE_ARENA Then If Player(MyIndex).inArena = False Then Player(MyIndex).inArena = True Call SendData("inarena" & END_CHAR) End If ElseIf Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If```In **modGameLogic** In **CheckAttack()**after``` Dim AttackSpeed As Long```add``` If Player(MyIndex).isStunned Then Call AddText("Cannot attack while stunned!", BRIGHTRED) Exit Sub End If``` In **CanMove()**after``` Dim I As Long Dim x As Long Dim y As Long CanMove = True```add``` If Player(MyIndex).isRooted Or Player(MyIndex).isStunned Then CanMove = False Exit Function End If```In **modHandleData.bas HandleData()**at the end _before_```End SubPublic Sub Packet_MainEditor(ByVal FileName As String, ByVal Text As String)```add``` If (casestring = "stun") Then Player(MyIndex).isStunned = True Exit Sub End If If (casestring = "unstun") Then Player(MyIndex).isStunned = False Exit Sub End If If (casestring = "root") Then Player(MyIndex).isRooted = True Exit Sub End If If (casestring = "unroot") Then Player(MyIndex).isRooted = False Exit Sub End If```In **modGameEditor.bas** In **SpellEditorInit()**after``` Dim I As Long```add``` Dim typ As Integer```replace``` frmSpellEditor.cmbType.ListIndex = Spell(EditorIndex).Type```with``` Select Case Spell(EditorIndex).Type Case SPELL_TYPE_ADDHP Case SPELL_TYPE_ADDMP Case SPELL_TYPE_ADDSP typ = Spell(EditorIndex).Type Case SPELL_TYPE_ADDDEF typ = 3 Case SPELL_TYPE_ADDSTR typ = 4 Case SPELL_TYPE_SUBHP typ = 5 Case SPELL_TYPE_SUBMP typ = 6 Case SPELL_TYPE_SUBSP typ = 7 Case SPELL_TYPE_SUBDEF typ = 8 Case SPELL_TYPE_SUBSTR typ = 9 Case SPELL_TYPE_ROOT typ = 10 Case SPELL_TYPE_STUN typ = 11 Case SPELL_TYPE_WARP typ = 12 Case SPELL_TYPE_SUMMON typ = 13 Case SPELL_TYPE_BIND typ = 14 Case SPELL_TYPE_SCRIPTED typ = 15 End Select frmSpellEditor.cmbType.ListIndex = typ```after``` frmSpellEditor.scrlVitalMod.Value = Spell(EditorIndex).Data1```add``` frmSpellEditor.scrlDuration.Value = Spell(EditorIndex).Data2 frmSpellEditor.scrlFrequency.Value = Spell(EditorIndex).Data3```replace``` frmSpellEditor.chkArea.Value = Spell(EditorIndex).AE```with``` If Spell(EditorIndex).AE = 1 Then frmSpellEditor.chkArea.Value = Checked ElseIf Spell(EditorIndex).AE = 2 Or Spell(EditorIndex).AE = 0 Then frmSpellEditor.chkTarget.Value = Checked ElseIf Spell(EditorIndex).AE = 3 Then frmSpellEditor.chkCastor.Value = Checked ElseIf Spell(EditorIndex).AE = 4 Then frmSpellEditor.chkParty.Value = Checked End If``` In **SpellEditorOk()**replace``` Spell(EditorIndex).Type = frmSpellEditor.cmbType.ListIndex```with``` Spell(EditorIndex).Type = frmSpellEditor.cmbType.ItemData(frmSpellEditor.cmbType.ListIndex)```replace``` Spell(EditorIndex).Data3 = 0```with``` Spell(EditorIndex).Data2 = frmSpellEditor.scrlDuration.Value '090828 Scorpious2k Spell(EditorIndex).Data3 = frmSpellEditor.scrlFrequency.Value '090828 Scorpious2k```replace``` Spell(EditorIndex).AE = frmSpellEditor.chkArea.Value```with``` If frmSpellEditor.chkArea.Value = Checked Then Spell(EditorIndex).AE = 1 ElseIf frmSpellEditor.chkTarget.Value = Checked Then Spell(EditorIndex).AE = 2 ElseIf frmSpellEditor.chkCastor.Value = Checked Then Spell(EditorIndex).AE = 3 ElseIf frmSpellEditor.chkParty.Value = Checked Then Spell(EditorIndex).AE = 4 End If```In **modConstants.bas**after```Public Const MAX_ARROWS = 100Public Const MAX_PLAYER_ARROWS = 100Public Const MAX_BUBBLES = 20Public Const MAX_BANK = 50Public Const MAX_INV = 24Public Const MAX_MAP_NPCS = 30Public Const MAX_PLAYER_SPELLS = 20Public Const MAX_TRADES = 66Public Const MAX_PLAYER_TRADES = 8Public Const MAX_NPC_DROPS = 10Public Const MAX_SHOP_ITEMS = 25```add```Public Const MAX_BUFFS = 7Public Const MAX_CURSES = 7```If you changed these values on the server, be sure to change it here to the same number.after```' Spell constantsPublic Const SPELL_TYPE_ADDHP = 0Public Const SPELL_TYPE_ADDMP = 1Public Const SPELL_TYPE_ADDSP = 2Public Const SPELL_TYPE_SUBHP = 3Public Const SPELL_TYPE_SUBMP = 4Public Const SPELL_TYPE_SUBSP = 5Public Const SPELL_TYPE_SCRIPTED = 6Public Const SPELL_TYPE_TEMP = 7```add```Public Const SPELL_TYPE_ADDDEF = 10Public Const SPELL_TYPE_ADDSTR = 11Public Const SPELL_TYPE_SUBDEF = 12Public Const SPELL_TYPE_SUBSTR = 13Public Const SPELL_TYPE_ROOT = 14Public Const SPELL_TYPE_STUN = 15Public Const SPELL_TYPE_WARP = 16Public Const SPELL_TYPE_BIND = 17Public Const SPELL_TYPE_SUMMON = 18```That should do it. All the changes are in.If you are interested in my dynamic fix code, I will gladly post it. What it does is fix player character records from an earlier version to match what this needs. Link to comment Share on other sites More sharing options...
azure Posted November 6, 2009 Share Posted November 6, 2009 Party spells should only work on that map, not the whole game. <_< Past that, this is sexy, I will surely use it. ^_^ Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 6, 2009 Author Share Posted November 6, 2009 @[SB:> Azure link=topic=53792.msg570991#msg570991 date=1257474341]> Party spells should only work on that map, not the whole game. <_< Past that, this is sexy, I will surely use it. ^_^What about summon? Wouldn't it be great to be able to summon all members of your party to the same place?Anyway, thanks for the nice words. Link to comment Share on other sites More sharing options...
azure Posted November 6, 2009 Share Posted November 6, 2009 I meant with Party buffs and such. Summoning is fine. Link to comment Share on other sites More sharing options...
varinyc Posted November 6, 2009 Share Posted November 6, 2009 you haven't put the sub for CheckAllExpiredSpells() in the tut.EDIT: whoops nevermind.EDIT 2: WEWT! Added it to the SVN version with a few minor changes, yey! I'm happy ^_^ Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 6, 2009 Author Share Posted November 6, 2009 @varinyc:> EDIT 2: WEWT! Added it to the SVN version with a few minor changes, yey! I'm happy ^_^Glad to hear it! I thought it should be fairly simple.Would you be willing to share the changes here for others who would like to do the same? Link to comment Share on other sites More sharing options...
varinyc Posted November 7, 2009 Share Posted November 7, 2009 @Scorpious2k:> Glad to hear it! I thought it should be fairly simple.> > Would you be willing to share the changes here for others who would like to do the same?Sure thing ^_^!1\. The "ckeched" and "unchecked" have to be "vbchecked" and "vbunchecked" in your code although I think thats unversal (Client Side)<<<<<<<<< SERVER SIDE >>>>>>>>>2\. In the PlayerMove Sub you will need to:```Dim X, Y as bytex = getplayerx(index)y = getplayery(index)```3.Find:```Public Type ServicePackIn```and add this to the bottom of the Type:```InArena As ByteOutArena As Byte```4\. Find:```Public Type ServicePackIn```and add this to the bottom of the Type:```Stun As ByteUnStun As ByteRoot As ByteUnRoot As Byte```5.Find:```With PIn```And add this at the bottom of the With:```.InArena = 117.OutArena = 118```5.Find:```With POut```And add this at the bottom of the With:```.Stun = 125.UnStun = 126.Root = 127.UnRoot = 128```6\. Change the HandleData from If Statements to Case:```Case PIn.InArena Player(index).Char(Player(index).CharNum).InArena = True Exit SubCase PIn.OutArena Player(index).Char(Player(index).CharNum).InArena = False Call CheckArenaSpells(index) Exit Sub```7\. Change all the SendData statements from Strings to the Packet Bytes (Example):BEFORE:```Call SendDataTo(Target, "UnRoot" & END_CHAR)```AFTER:```Call SendDataTo(Target, POut.UnRoot & END_CHAR)```<<<<<<<<<< CLIENT SIDE >>>>>>>>>>1.Find:```Public Type ServicePackOut```and add this to the bottom of the Type:```InArena As ByteOutArena As Byte```4\. Find:```Public Type ServicePackIn```and add this to the bottom of the Type:```Stun As ByteUnStun As ByteRoot As ByteUnRoot As Byte```5.Find:```With POut```And add this at the bottom of the With:```.InArena = 117.OutArena = 118```5.Find:```With PIn```And add this at the bottom of the With:```.Stun = 125.UnStun = 126.Root = 127.UnRoot = 128```6\. Change the HandleData from If Statements to Case and put it in the very top case statement:``` Case PIn.Stun Player(MyIndex).isStunned = True Exit Sub Case PIn.UnStun Player(MyIndex).isStunned = False Exit Sub Case PIn.Root Player(MyIndex).isRooted = True Exit Sub Case PIn.UnRoot Player(MyIndex).isRooted = False Exit Sub```7\. Change all the SendData statements from Strings to the Packet Bytes (Example):BEFORE:```Call SendData("OutArena" & END_CHAR)```AFTER:```Call SendData(POut.OutArena & END_CHAR)``` Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 7, 2009 Author Share Posted November 7, 2009 Thanks varinyc. This means everyone with 2.7/stable/svn can now use this. Link to comment Share on other sites More sharing options...
aster Posted November 7, 2009 Share Posted November 7, 2009 i keep getting an error with``` Call SetPlayerPK(Victim, NO) Call SendPlayerData(Victim) Call GlobalMsg(GetPlayerName(Victim) & " has paid the price for being a player killer!", BRIGHTRED) End If Else Call SetPlayerHP(Victim, GetPlayerHP(Victim) - Damage) Call SendHP(Victim) End If```the Else on that now in AttackPlayer. Any fix? do i need to add an End If to the WarpToBind (Victim)?Error: Else without IfHuza fixed for ppl that are getting that error add an End If after WarpToBind(Victim) and a Call Before it so it'd look like this```Call WarpToBind(Victim)End If```K now when i try to edit a spell i get the error 380Ok now i get an error when i try to pick things up, fix my stun,DoT,HoT spells. Need help asap Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 Are you using a char that was created before you made the changes? Link to comment Share on other sites More sharing options...
aster Posted November 8, 2009 Share Posted November 8, 2009 no i wiped the char database im using 2.7 if thats the problem.Can u go through mine and see whats wrong? Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 Have you tried running it in VB6 so you can see where it is crashing?My first thought is that something didn't get editted/copied right. Maybe a line missing or something added twice.EDIT: I say this because you say it is affecting things that haven't been touched. Link to comment Share on other sites More sharing options...
aster Posted November 8, 2009 Share Posted November 8, 2009 ```Public Sub SpellEditorInit() Dim i As Long Dim typ As Integer Select Case Spell(EditorIndex).Type Case SPELL_TYPE_ADDHP Case SPELL_TYPE_ADDMP Case SPELL_TYPE_ADDSP typ = Spell(EditorIndex).Type Case SPELL_TYPE_ADDDEF typ = 3 Case SPELL_TYPE_ADDSTR typ = 4 Case SPELL_TYPE_SUBHP typ = 5 Case SPELL_TYPE_SUBMP typ = 6 Case SPELL_TYPE_SUBSP typ = 7 Case SPELL_TYPE_SUBDEF typ = 8 Case SPELL_TYPE_SUBSTR typ = 9 Case SPELL_TYPE_ROOT typ = 10 Case SPELL_TYPE_STUN typ = 11 Case SPELL_TYPE_WARP typ = 12 Case SPELL_TYPE_BIND typ = 13 Case SPELL_TYPE_SCRIPTED typ = 14 End Select frmSpellEditor.iconn.Picture = LoadPicture(App.Path & "\GFX\Icons.bmp") frmSpellEditor.cmbClassReq.addItem "All Classes" For i = 0 To Max_Classes frmSpellEditor.cmbClassReq.addItem Trim$(Class(i).Name) Next i frmSpellEditor.txtName.Text = Trim$(Spell(EditorIndex).Name) frmSpellEditor.cmbClassReq.ListIndex = Spell(EditorIndex).ClassReq frmSpellEditor.scrlLevelReq.Value = Spell(EditorIndex).LevelReq frmSpellEditor.cmbType.ListIndex = typ frmSpellEditor.scrlVitalMod.Value = Spell(EditorIndex).Data1 frmSpellEditor.scrlCost.Value = Spell(EditorIndex).MPCost frmSpellEditor.scrlSound.Value = Spell(EditorIndex).Sound If Spell(EditorIndex).Range = 0 Then Spell(EditorIndex).Range = 1 End If frmSpellEditor.scrlRange.Value = Spell(EditorIndex).Range frmSpellEditor.scrlSpellAnim.Value = Spell(EditorIndex).SpellAnim frmSpellEditor.scrlSpellTime.Value = Spell(EditorIndex).SpellTime frmSpellEditor.scrlSpellDone.Value = Spell(EditorIndex).SpellDone If Spell(EditorIndex).AE = 1 Then frmSpellEditor.chkArea.Value = Checked ElseIf Spell(EditorIndex).AE = 2 Then frmSpellEditor.chkTarget.Value = Checked ElseIf Spell(EditorIndex).AE = 3 Then frmSpellEditor.chkCastor.Value = Checked ElseIf Spell(EditorIndex).AE = 4 Then frmSpellEditor.chkParty.Value = Checked End If frmSpellEditor.chkArea.Value = Spell(EditorIndex).AE frmSpellEditor.chkBig.Value = Spell(EditorIndex).Big frmSpellEditor.scrlElement.Value = Spell(EditorIndex).Element frmSpellEditor.scrlElement.Max = MAX_ELEMENTS frmSpellEditor.Show vbModalEnd Sub```says frmSpellEditor.chkArea.Value = Spell(EditorIndex).AE is wrong and zultars chest attribute quit working for me after i added this also in```Function CanMove() As Boolean Dim i As Long Dim X As Long Dim y As Long CanMove = True If Player(MyIndex).Moving <> 0 Then CanMove = False Exit Function End If ' Make sure they haven't just casted a spell If Player(MyIndex).CastedSpell = YES Then If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then Player(MyIndex).CastedSpell = NO Else CanMove = False Exit Function End If End If X = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) If DirUp Then Call SetPlayerDir(MyIndex, DIR_UP) y = y - 1 ElseIf DirDown Then Call SetPlayerDir(MyIndex, DIR_DOWN) y = y + 1 ElseIf DirLeft Then Call SetPlayerDir(MyIndex, DIR_LEFT) X = X - 1 Else Call SetPlayerDir(MyIndex, DIR_RIGHT) X = X + 1 End If If y < 0 Then If Map(GetPlayerMap(MyIndex)).Up > 0 Then Call SendPlayerRequestNewMap(DIR_UP) GettingMap = True End If CanMove = False Exit Function ElseIf y > MAX_MAPY Then If Map(GetPlayerMap(MyIndex)).Down > 0 Then Call SendPlayerRequestNewMap(DIR_DOWN) GettingMap = True End If CanMove = False Exit Function ElseIf X < 0 Then If Map(GetPlayerMap(MyIndex)).Left > 0 Then Call SendPlayerRequestNewMap(DIR_LEFT) GettingMap = True End If CanMove = False Exit Function ElseIf X > MAX_MAPX Then If Map(GetPlayerMap(MyIndex)).Right > 0 Then Call SendPlayerRequestNewMap(DIR_RIGHT) GettingMap = True End If CanMove = False Exit Function End If If Not GetPlayerDir(MyIndex) = LAST_DIR Then LAST_DIR = GetPlayerDir(MyIndex) Call SendPlayerDir End IfIf Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_BLOCKED Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_SIGN Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_ROOFBLOCK Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_CHEST Then CanMove = False Exit Function End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_CBLOCK Then If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data1 = Player(MyIndex).Class Then Exit Function End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data2 = Player(MyIndex).Class Then Exit Function End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data3 = Player(MyIndex).Class Then Exit Function End If CanMove = False End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_GUILDBLOCK And Map(GetPlayerMap(MyIndex)).Tile(X, y).String1 <> GetPlayerGuild(MyIndex) Then CanMove = False End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_KEY Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_DOOR Then If TempTile(X, y).DoorOpen = NO Then CanMove = False Exit Function End If End If If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_WALKTHRU Then Exit Function Else For i = 1 To MAX_PLAYERS If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then If GetPlayerX(i) = X Then If GetPlayerY(i) = y Then CanMove = False Exit Function End If End If End If End If Next i End If For i = 1 To MAX_MAP_NPCS If MapNpc(i).num > 0 Then If MapNpc(i).X = X Then If MapNpc(i).y = y Then CanMove = False Exit Function End If End If End If Next iEnd Function```just cant figure out what Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 @EclipseStalker:> says frmSpellEditor.chkArea.Value = Spell(EditorIndex).AE is wrongit is, that line should have been removed. It is handled differently now.> and zultars chest attribute quit working for me after i added this also in> > ```> Function CanMove() As Boolean> Dim i As Long> Dim X As Long> Dim y As Long> > CanMove = True> > If Player(MyIndex).Moving <> 0 Then> CanMove = False> Exit Function> End If> > ' Make sure they haven't just casted a spell> If Player(MyIndex).CastedSpell = YES Then> If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then> Player(MyIndex).CastedSpell = NO> Else> CanMove = False> Exit Function> End If> End If> > X = GetPlayerX(MyIndex)> y = GetPlayerY(MyIndex)> > If DirUp Then> Call SetPlayerDir(MyIndex, DIR_UP)> y = y - 1> ElseIf DirDown Then> Call SetPlayerDir(MyIndex, DIR_DOWN)> y = y + 1> ElseIf DirLeft Then> Call SetPlayerDir(MyIndex, DIR_LEFT)> X = X - 1> Else> Call SetPlayerDir(MyIndex, DIR_RIGHT)> X = X + 1> End If> > If y < 0 Then> If Map(GetPlayerMap(MyIndex)).Up > 0 Then> Call SendPlayerRequestNewMap(DIR_UP)> GettingMap = True> End If> CanMove = False> Exit Function> ElseIf y > MAX_MAPY Then> If Map(GetPlayerMap(MyIndex)).Down > 0 Then> Call SendPlayerRequestNewMap(DIR_DOWN)> GettingMap = True> End If> CanMove = False> Exit Function> ElseIf X < 0 Then> If Map(GetPlayerMap(MyIndex)).Left > 0 Then> Call SendPlayerRequestNewMap(DIR_LEFT)> GettingMap = True> End If> CanMove = False> Exit Function> ElseIf X > MAX_MAPX Then> If Map(GetPlayerMap(MyIndex)).Right > 0 Then> Call SendPlayerRequestNewMap(DIR_RIGHT)> GettingMap = True> End If> CanMove = False> Exit Function> End If> > If Not GetPlayerDir(MyIndex) = LAST_DIR Then> LAST_DIR = GetPlayerDir(MyIndex)> Call SendPlayerDir> End If> > If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_BLOCKED Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_SIGN Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_ROOFBLOCK Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_CHEST Then> CanMove = False> Exit Function> End If> > If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_CBLOCK Then> If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data1 = Player(MyIndex).Class Then> Exit Function> End If> If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data2 = Player(MyIndex).Class Then> Exit Function> End If> If Map(GetPlayerMap(MyIndex)).Tile(X, y).Data3 = Player(MyIndex).Class Then> Exit Function> End If> CanMove = False> End If> > If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_GUILDBLOCK And Map(GetPlayerMap(MyIndex)).Tile(X, y).String1 <> GetPlayerGuild(MyIndex) Then> CanMove = False> End If> > If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_KEY Or Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_DOOR Then> If TempTile(X, y).DoorOpen = NO Then> CanMove = False> Exit Function> End If> End If> > If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_WALKTHRU Then> Exit Function> Else> For i = 1 To MAX_PLAYERS> If IsPlaying(i) Then> If GetPlayerMap(i) = GetPlayerMap(MyIndex) Then> If GetPlayerX(i) = X Then> If GetPlayerY(i) = y Then> CanMove = False> Exit Function> End If> End If> End If> End If> Next i> End If> > For i = 1 To MAX_MAP_NPCS> If MapNpc(i).num > 0 Then> If MapNpc(i).X = X Then> If MapNpc(i).y = y Then> CanMove = False> Exit Function> End If> End If> End If> Next i> End Function> ```just cant figure out whatI don't know anything about zultars chest, but if you review the changes I list above you will see> In **CanMove()**> > after> > ```> Dim I As Long> Dim x As Long> Dim y As Long> > CanMove = True> > ```> add> > ```> If Player(MyIndex).isRooted Or Player(MyIndex).isStunned Then> CanMove = False> Exit Function> End If> > ```in what you quote, this wasn't done Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 Did that solve it? Link to comment Share on other sites More sharing options...
aster Posted November 8, 2009 Share Posted November 8, 2009 ill make the client real quick and see, will update post asapYour a duckin genius! removing that one line fixed the whole problem, chest work again i can talk, and edit spells.Now im getting a new error subscript out of range error 9i placed something wrong somewhere i just cant figure out where[my Server+Client](http://www.mediafire.com/?5ziu54whltn) can u fix and tell me what was wrong? Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 I have the code, but could you run it under VB6 and see where the error is happening? Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 In the client, in **modClientTCP.bas** you missedafter```Sub SendPlayerMove()```insert```Dim x As IntegerDim y As Integerx = GetPlayerX(MyIndex)y = GetPlayerY(MyIndex) If x < 0 Or x > MAX_MAPX Or y < 0 Or y > MAX_MAPY Then If Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If ElseIf Map(GetPlayerMap(MyIndex)).Tile(x, y).Type = TILE_TYPE_ARENA Then If Player(MyIndex).inArena = False Then Player(MyIndex).inArena = True Call SendData("inarena" & END_CHAR) End If ElseIf Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If``` Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 In he server you missed:In **frmServer.bas Timer1Timer()**, at the bottom, after``` If SCRIPTING = 1 Then MyScript.ExecuteStatement "Scripts\main.ess", "TimedEvent " & Hours & "," & Minutes & "," & Seconds End If```add``` Call CheckAllExpiredSpells ' check for limited spells that expired``` Link to comment Share on other sites More sharing options...
aster Posted November 8, 2009 Share Posted November 8, 2009 ```Sub SendPlayerMove()Dim x As IntegerDim y As Integerx = GetPlayerX(MyIndex)y = GetPlayerY(MyIndex) If x < 0 Or x > MAX_MAPX Or y < 0 Or y > MAX_MAPY Then If Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If ElseIf Map(GetPlayerMap(MyIndex)).Tile(x, y).Type = TILE_TYPE_ARENA Then If Player(MyIndex).inArena = False Then Player(MyIndex).inArena = True Call SendData("inarena" & END_CHAR) End If ElseIf Player(MyIndex).inArena = True Then Player(MyIndex).inArena = False Call SendData("outarena" & END_CHAR) End If Call SendData("playermove" & SEP_CHAR & GetPlayerDir(MyIndex) & SEP_CHAR & Player(MyIndex).Moving & END_CHAR)End Sub```i think something is wrong with how i placed this now the error is with an armor slot, its never happened since i put this code in though. I love the features though so ill keep trying. Can you just put the code in for me? Link to comment Share on other sites More sharing options...
Scorpious2k Posted November 8, 2009 Author Share Posted November 8, 2009 EclipseStalker: that looks right to me.Once again, I suggest running it under VB6 and find out what line it is, Link to comment Share on other sites More sharing options...
aster Posted November 9, 2009 Share Posted November 9, 2009 can u just add the code and upload it for me. the errors are completley unrelated to any thing ive ever touched Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now