aeronx Posted August 22, 2015 Author Share Posted August 22, 2015 Hello everybody! Looking on other forums, I found this script, working pretty neat, so i thought i share it.Note: Tested on skywyre engine, works fine Perfect! (Fixed by: **[abhi2011](http://www.eclipseorigins.com/user-35814.html)** )~~ Client Side~~Search for:```Public Const SPELL_TYPE_WARP As Byte = 4 ```After it add:```Public Const SPELL_TYPE_LINEAR As Byte = 5 ' or your next spell_type number```Open FrmEditor_Spell, click on cmbType and blow this:```Spell(EditorIndex).Type = cmbType.ListIndex ```Add this:```If cmbType.text = "Linear" Then scrlRange.Value = 0 chkAOE.Value = 1 End If ```Click cmbType properties and add Linear to the listClient side done.~~Server Side~~At Sub Public Sub CastSpell search for:```Dim x As LongDim y As Long```Under it add:```Dim Linear, Calculate As Long```At the same sub look for:```Case 2 ' targetted```On the End Select above Case 2, above it add:```Case SPELL_TYPE_LINEAR DidCast = True Linear = 1 Do While Linear < Spell(spellnum).AoE Select Case GetPlayerDir(index) Case DIR_UP Calculate = GetPlayerY(index) - Linear If Calculate <= 0 Then DidCast = True GoTo theEnd End If If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - Linear).Type = TILE_TYPE_BLOCKED Then DidCast = True GoTo theEnd End If SendAnimation GetPlayerMap(index), Spell(SpellNum).SpellAnim, GetPlayerX(index), GetPlayerY(index) - Linear IsUseLinear index, SpellNum, Vital, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index) - Linear Case DIR_DOWN Calculate = GetPlayerY(index) + Linear If Calculate <= 0 Then DidCast = True GoTo theEnd End If If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + Linear).Type = TILE_TYPE_BLOCKED Then DidCast = True GoTo theEnd End If SendAnimation GetPlayerMap(index), Spell(SpellNum).SpellAnim, GetPlayerX(index), GetPlayerY(index) + Linear IsUseLinear index, SpellNum, Vital, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index) + Linear Case DIR_LEFT Calculate = GetPlayerX(index) - Linear If Calculate <= 0 Then DidCast = True GoTo theEnd End If If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - Linear, GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then DidCast = True GoTo theEnd End If SendAnimation GetPlayerMap(index), Spell(SpellNum).SpellAnim, GetPlayerX(index) - Linear, GetPlayerY(index) IsUseLinear index, SpellNum, Vital, GetPlayerMap(index), GetPlayerX(index) - Linear, GetPlayerY(index) Case DIR_RIGHT Calculate = GetPlayerX(index) + Linear If Calculate <= 0 Then DidCast = True GoTo theEnd End If If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + Linear, GetPlayerY(index)).Type = TILE_TYPE_BLOCKED Then DidCast = True GoTo theEnd End If SendAnimation GetPlayerMap(index), Spell(SpellNum).SpellAnim, GetPlayerX(index) + Linear, GetPlayerY(index) IsUseLinear index, SpellNum, Vital, GetPlayerMap(index), GetPlayerX(index) + Linear, GetPlayerY(index)End Select Linear = Linear + 1 Loop```At the end of CastSpell sub find:```If DidCast then```Above it, add:```theEnd:```After whole Public Sub StunNPC add:```Function IsUseLinear(ByVal index As Integer, ByVal spellnum As Integer, ByVal Vital As Long, ByVal Mapa As Integer, ByVal x As Byte, ByVal y As Byte) Dim i As Long 'Loop Global Npc For i = 1 To MAX_MAP_NPCS If MapNpc(Mapa).NPC(i).Num > 0 And MapNpc(Mapa).NPC(i).x = x And MapNpc(Mapa).NPC(i).y = y And MapNpc(Mapa).NPC(i).Vital(HP) > 0 Then PlayerAttackNpc index, i, Vital, spellnum Next 'Loop Global Player For i = 1 To Player_HighIndex If GetPlayerMap(i) = Mapa And GetPlayerX(i) = x And GetPlayerY(i) = y Then PlayerAttackPlayer index, i, Vital, spellnum Next End Function```After:```Public Const SPELL_TYPE_WARP As Byte = 4 ```Add:```Public Const SPELL_TYPE_LINEAR As Byte = 5 'or whatever number you need```Aaand you are done!You just now need to create a new spell, set the animation, vital and range (from AOE range) and you have it.Thanks! I wish it helps somebody. Link to comment Share on other sites More sharing options...
aeronx Posted August 23, 2015 Author Share Posted August 23, 2015 Bump! Anyhelp on the bug of this code? Read the bottom of the threat please!Thanks for your time. Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted August 23, 2015 Share Posted August 23, 2015 Maybe try Exit Case or something? I don't know but it might work Link to comment Share on other sites More sharing options...
aeronx Posted August 23, 2015 Author Share Posted August 23, 2015 Tested, not working :/!I need to change the exit sub so it does something else, how? dunno Link to comment Share on other sites More sharing options...
SkywardRiver Posted August 23, 2015 Share Posted August 23, 2015 Try changing this:If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - Linear).Type = TILE_TYPE_BLOCKED Then Exit Subto this:If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - Linear).Type = TILE_TYPE_BLOCKED ThenDidCast = FalseExitSubEnd ifNo idea if it will work or not. Got smashed last night so I can't think too well without it hurting lol. Link to comment Share on other sites More sharing options...
aeronx Posted August 23, 2015 Author Share Posted August 23, 2015 Not working either :/ Been messing around with that logic sky, but nope. Maybe when you have time you can take a look at the whole code!Thanks @skywardriver @Baron Mohenjo Daro Link to comment Share on other sites More sharing options...
aeronx Posted August 24, 2015 Author Share Posted August 24, 2015 bump!Anyone with some knowledge on the code? :) Link to comment Share on other sites More sharing options...
BeNjO Posted August 24, 2015 Share Posted August 24, 2015 You are doing the 'did cast = false' in all cases, Or for testing purposes you are facing UP with the above fix correct? Link to comment Share on other sites More sharing options...
abhi2011 Posted August 24, 2015 Share Posted August 24, 2015 If you were to look at the end of the method you'll see the 'If DidCast = true then' part. This is where MP reduced. Basically, we want to jump to that point in code. Use a Code label along with a GoTo statement.```If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - Linear).Type = TILE_TYPE_BLOCKED Then didcast = truegoto theEndendif```That's what your problem line should be.Above```If DidCast Then```add a "theEnd: " line. This img should help if you didn't understand -> http://imgur.com/5PzfX9xEDIT:This line of code```If Calculate <= 0 Then Exit Sub```has the same problem. It calls Exit Sub from within a loop. Meaning, any damage done in a previous iteration will be handled but since the method is exited, mana won't be deducted. Exit sub should be called in only those instances where nothing has been done for a logical deduction to take place. (for eg. when no target has been selected, it'd be wrong to deduct mana without any damage happening) Link to comment Share on other sites More sharing options...
aeronx Posted August 25, 2015 Author Share Posted August 25, 2015 Thanks all for your help.I've tried something like this, but now if you face a blocked tile from 3 tiles, but it has range 4\. The spell wont cast, even if there is a NPC on the way.I've been trying some diferent ways but i havent been successfull.This is what i have now. (Doesnt work right)```Case DIR_UP Calculate = GetPlayerY(index) - Linear If Calculate <= 0 Then DidCast = True GoTo theEnd End If Exit Sub If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - Linear).Type = TILE_TYPE_BLOCKED Then DidCast = True GoTo theEnd End If Exit SubtheEnd: If DidCast Then SendAnimation GetPlayerMap(index), Spell(SpellNum).SpellAnim, GetPlayerX(index), GetPlayerY(index) - Linear IsUseLinear index, SpellNum, Vital, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index) - Linear End If``` Link to comment Share on other sites More sharing options...
abhi2011 Posted August 25, 2015 Share Posted August 25, 2015 Umm.. I'm not getting what you are trying to do.The 'theEnd' and 'If DidCast …' is at the end of the function. Not within the select case/loop. You just do a goto theEnd where you want to.Give your entire CastSpell or w/e it's called function here. Link to comment Share on other sites More sharing options...
aeronx Posted August 25, 2015 Author Share Posted August 25, 2015 Okey! Solved, i know what you mean now! Really thanks, giving you credits for the fix! You are great!Thanks everybody for your time and effort! Link to comment Share on other sites More sharing options...
abhi2011 Posted August 25, 2015 Share Posted August 25, 2015 No problem. I'm happy to help. 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