akash47 Posted February 20, 2013 Author Share Posted February 20, 2013 First post. Hello touchofdeath ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)This code was written in/for DragonEclipse. I'm not sure how compatability with different versions is, so if anyone knows how this would go with other versions, please comment so more people can use the code. Thank you.This code alters the warp spell already in-place. It makes it so that if you set the map of the warp to 0, the x value becomes how far forward you warp on the same map, and the y value becomes how far backwards you warp on the same map. This works like a jump/blink/teleport. If an object is in the way, or you would jump off the maps edge, the jump is shortened so that you can still jump to the tile before that point.WARNING: You may need to add many new "Blocked" attributes to the tiles on your maps , so that players can't simply jump over one row of blocked squares into a place where they shouldn't be able to walk. If you're trying to tweak this in any way and have troubles with it just send me a message and I'll try and help if I can (though I'm not even close to pro).All server-side.1) In modCombat, under this:```Public Sub CastSpell(ByVal Index As Long, ByVal spellslot As Long, ByVal target As Long, ByVal targetType As Byte)Dim spellnum As LongDim MPCost As LongDim LevelReq As LongDim mapnum As LongDim Vital As LongDim DidCast As BooleanDim ClassReq As LongDim AccessReq As LongDim i As LongDim AoE As LongDim Range As LongDim VitalType As ByteDim increment As BooleanDim x As Long, y As Long```add```Dim xt As LongDim yt As Long```2) Then in the same Module, directly under this:``` Case SPELL_TYPE_WARP SendAnimation mapnum, Spell(spellNum).SpellAnim, GetPlayerX(Index), GetPlayerY(Index) PlayerWarp Index, Spell(spellNum).Map, Spell(spellNum).x, Spell(spellNum).y```add this``` 'Code to warp short distances, using x as forward and y as backwards, while map is set to 0 (in warp spells). If Spell(spellNum).Map = 0 Then If Player(Index).Dir = 0 Then xt = Player(Index).x yt = Player(Index).y - (Spell(spellNum).x) + (Spell(spellNum).y) If xt > Map(mapnum).MaxX Then xt = Map(mapnum).MaxX If yt > Map(mapnum).MaxY Then yt = Map(mapnum).MaxY If xt < 1 Then xt = 1 If yt < 1 Then yt = 1 If Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index Else If yt < Player(Index).y Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE yt = yt + 1 Loop If yt < Player(Index).y Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If Else If yt > Player(Index).y Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE yt = yt - 1 Loop If yt > Player(Index).y Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If End If End If End If End If If Player(Index).Dir = 1 Then xt = Player(Index).x yt = Player(Index).y + (Spell(spellNum).x) - (Spell(spellNum).y) If xt > Map(mapnum).MaxX Then xt = Map(mapnum).MaxX If yt > Map(mapnum).MaxY Then yt = Map(mapnum).MaxY If xt < 1 Then xt = 1 If yt < 1 Then yt = 1 If Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index Else If yt < Player(Index).y Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE yt = yt + 1 Loop If yt < Player(Index).y Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If Else If yt > Player(Index).y Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE yt = yt - 1 Loop If yt > Player(Index).y Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If End If End If End If End If If Player(Index).Dir = 2 Then xt = Player(Index).x - (Spell(spellNum).x) + (Spell(spellNum).y) yt = Player(Index).y If xt > Map(mapnum).MaxX Then xt = Map(mapnum).MaxX If yt > Map(mapnum).MaxY Then yt = Map(mapnum).MaxY If xt < 1 Then xt = 1 If yt < 1 Then yt = 1 If Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index Else If xt < Player(Index).x Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE xt = xt + 1 Loop If xt < Player(Index).x Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If Else If xt > Player(Index).x Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE xt = xt - 1 Loop If xt > Player(Index).x Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If End If End If End If End If If Player(Index).Dir = 3 Then xt = Player(Index).x + (Spell(spellNum).x) - (Spell(spellNum).y) yt = Player(Index).y If xt > Map(mapnum).MaxX Then xt = Map(mapnum).MaxX If yt > Map(mapnum).MaxY Then yt = Map(mapnum).MaxY If xt < 1 Then xt = 1 If yt < 1 Then yt = 1 If Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index Else If xt < Player(Index).x Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE xt = xt + 1 Loop If xt < Player(Index).x Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If Else If xt > Player(Index).x Then Do Until Map(mapnum).Tile(xt, yt).Type = TILE_TYPE_WALKABLE xt = xt - 1 Loop If xt > Player(Index).x Then SetPlayerX Index, xt SetPlayerY Index, yt SendPlayerXYToMap Index End If End If End If End If End If End If```and that's it. Hopefully it helps someone on the way to making their dream game, or at least helps someone on the way to understanding Eclipse a little better. I gained most of my understanding so far from the tutorials made by this community, so I'm glad I can finally pay a little back ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Link to comment Share on other sites More sharing options...
Wortel Angels Posted February 20, 2013 Share Posted February 20, 2013 Looks nice but wrong place…The post should be in Source ;-) Link to comment Share on other sites More sharing options...
akash47 Posted February 20, 2013 Author Share Posted February 20, 2013 Knew I'd stuff it up somehow ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) sorry for that guys. Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 20, 2013 Share Posted February 20, 2013 Nice, might add this in to my Engine but as a separate option xD Did you rip this from dragon eclipse then? Link to comment Share on other sites More sharing options...
akash47 Posted February 20, 2013 Author Share Posted February 20, 2013 ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) no, the warp spell is part of dragon eclipse, and it sends you to a new map at a set x and y. I wanted a jump spell, so I made this, and added it to warp because i felt it would be better to make the already-existing spell-type more versatile rather than create a new spell-type and leave warp with limited functionality. Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 20, 2013 Share Posted February 20, 2013 Nice, is this wrote for a dx7 or dx8 engine? Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 20, 2013 Share Posted February 20, 2013 Oh wait nevermind xD Link to comment Share on other sites More sharing options...
akash47 Posted February 20, 2013 Author Share Posted February 20, 2013 I think dragon eclipse is directx8 Link to comment Share on other sites More sharing options...
akash47 Posted February 20, 2013 Author Share Posted February 20, 2013 Just had to fix up the final block of code. Had a little error at the bottom. I included this:``` SendAnimation GetPlayerMap(Index), Spell(spellNum).SpellAnim, 0, 0, TARGET_TYPE_PLAYER, Index DidCast = True```which means the animation would've happened twice. Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 21, 2013 Share Posted February 21, 2013 It is but looking over the code quickly it looks like it should work for dx7 with small changes and what not, I'll try it today xD Link to comment Share on other sites More sharing options...
Wortel Angels Posted February 21, 2013 Share Posted February 21, 2013 xD its working on both… that has nothing to do with the graphic drawing just the sending animation but thats an fast change ;-) Link to comment Share on other sites More sharing options...
boyesjs03 Posted February 21, 2013 Share Posted February 21, 2013 Beat me too it once again ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) Are you ever off your computer? XD Link to comment Share on other sites More sharing options...
Wortel Angels Posted February 21, 2013 Share Posted February 21, 2013 No ;-)I work from my home haha Link to comment Share on other sites More sharing options...
akash47 Posted February 23, 2013 Author Share Posted February 23, 2013 yeah, I'd love a more fluid jump for physical skill, but I need to take a closer look at how movement works first, and find a way to get tickcount in there…. for the moment I'm just settling for covering up with a fancy jump animation ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png) Link to comment Share on other sites More sharing options...
hedgy Posted February 24, 2013 Share Posted February 24, 2013 Thanks a lot! Will be using this.It would be nice if you could get an image (which could be a shade or something) going through the path you're jumping. Link to comment Share on other sites More sharing options...
Khronos85 Posted April 16, 2013 Share Posted April 16, 2013 it is c++? Link to comment Share on other sites More sharing options...
Matt Posted April 16, 2013 Share Posted April 16, 2013 > it is c++?No. Dragon Eclipse is written in VB6, as are most engine here. Link to comment Share on other sites More sharing options...
Link Posted April 16, 2013 Share Posted April 16, 2013 > No. Drachen Eclipse is written in VB6, as are most engine here.You mean Dragon Eclipse? Link to comment Share on other sites More sharing options...
Matt Posted April 17, 2013 Share Posted April 17, 2013 > You mean Dragon Eclipse?Gah ._. 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