zidsal Posted June 5, 2009 Author Share Posted June 5, 2009 The code will only check to see if your not on a ground area and then warp you. + hurt the player if he falls for more then 1 tile. ( just in case the title is not a clear enough hint for you.)I would like to thank V rage who helped me make the function on checking how close someone is to a blocked tile (what I used as ground).I'm no longer going to use this so here yo guys go ALL SERVER SIDE:I will not spoon feed you here only supply the code up to you to choose where to place it.make PULLINGDELAY a global variable``` 'gravity for npcs If MapNPC(MapNum, MapNpcNum).num > 0 Then If CheckNpcGroundDistance(MapNum, MapNpcNum) <> 0 Then Do While CheckNpcGroundDistance(MapNum, MapNpcNum) <> 0 Call SetMapNpcY(MapNum, MapNpcNum, GetNpcY(MapNum, MapNpcNum) + 1) If CheckNpcGroundDistance(MapNum, MapNpcNum) = 0 Then Exit Do End If Loop End If End If```that will make it so if a npc is not on a block tile (what I use for ground) or he fall until he hits a ground tile.``` 'gravity players For I = 1 To MAX_PLAYERS If IsPlaying(I) Then If CheckGroundDistance(I) <> 0 Then 'calculate fall damage Call SetPlayerHP(I, ((GetPlayerHP(I) - CheckGroundDistance(I)) + 1)) Call SendHP(I) If GetPlayerHP(I) = 0 Then Call KillPlayer(I) End If 'drop the player (and sometimes to his doom :D) Do While CheckGroundDistance(I) <> 0 If GetTickCount > PULLINGDELAY + 150 Then 'delay for jumping This will build up per tile makes it alot easier to double jump Call PlayerWarp(I, GetPlayerMap(I), GetPlayerX(I), GetPlayerY(I) + 1) PULLINGDELAY = GetTickCount End If Loop End If End If Next I```will do the same thing for playersadd this functions```Function CheckGroundDistance(ByVal index As Long)Dim GroundDistance As IntegerDim Y As Integer For Y = 0 To 20 Dim var3 As Integer Dim distancey As Integer var3 = Map(GetPlayerMap(index)).Tile(GetPlayerX(index), Y).Type If var3 = TILE_TYPE_BLOCKED Then GroundDistance = ((Y - GetPlayerY(index)) - 1) If GroundDistance >= 0 Then CheckGroundDistance = GroundDistance Exit For End If End If Next YEnd Function``````Function CheckNpcGroundDistance(ByVal MapNum As Long, ByVal MapNpcNum As Long)Dim GroundDistance As IntegerDim Y As Integer For Y = 0 To 20 Dim var3 As Integer Dim distancey As Integer var3 = Map(MapNum).Tile(GetNpcX(MapNum, MapNpcNum), Y).Type If var3 = TILE_TYPE_BLOCKED Then GroundDistance = ((Y - GetNpcY(MapNum, MapNpcNum) - 1)) If GroundDistance >= 0 Then CheckNpcGroundDistance = GroundDistance Exit For End If End If Next YEnd Function``````Public Function KillPlayer(index) If IsPlaying(index) Then Call SetPlayerHP(index, 0) If SCRIPTING = 1 Then MyScript.ExecuteStatement "Scripts\Main.txt", "OnDeath " & index 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 If Call SetPlayerHP(index, GetPlayerMaxHP(index)) Call SetPlayerMP(index, GetPlayerMaxMP(index)) Call SetPlayerSP(index, GetPlayerMaxSP(index)) Call SendHP(index) Call SendMP(index) Call SendSP(index) End IfEnd Function``` Link to comment Share on other sites More sharing options...
ddunit Posted June 5, 2009 Share Posted June 5, 2009 Is this laggy? Link to comment Share on other sites More sharing options...
zidsal Posted June 5, 2009 Author Share Posted June 5, 2009 @DDuÃ˜à ¼Ât:> Is this laggy?depends how you use it. it will be laggy if you put the check in a vb6 timer as the timers are off by a bit *cought* use gettickcount *cought*. The code its self is not laggy. Link to comment Share on other sites More sharing options...
mrmiguu Posted June 5, 2009 Share Posted June 5, 2009 @zidsal:> depends how you use it. it will be laggy if you put the check in a vb6 timer as the timers are off by a bit *cought* use gettickcount *cought*. The code its self is not laggy.Wow, why would you release this? It's not even complete… trying to get credit? Link to comment Share on other sites More sharing options...
zidsal Posted June 5, 2009 Author Share Posted June 5, 2009 it does everything I said in the title and did I ever say credit me in the post no?. There's nothing wrong with realising it. I will put a declaimers in first post after thinking about it about how its not up to your perfect coding skills.all you would need to do is add jumping which would be adding to player rec and then when he jumps set the players jumping value to 1 and in the falling code check to see if the the jumping value is 0 and if it is 0 carry on the code else the player must be jumping so leave him to it. Link to comment Share on other sites More sharing options...
mrmiguu Posted June 5, 2009 Share Posted June 5, 2009 @zidsal:> it does everything I said in the title and did I ever say credit me in the post no?. There's nothing wrong with realising it. I will put a declaimers in first post after thinking about it about how its not up to your perfect coding skills.> > all you would need to do is add jumping which would be adding to player rec and then when he jumps set the players jumping value to 1 and in the falling code check to see if the the jumping value is 0 and if it is 0 carry on the code else the player must be jumping so leave him to it.When did I say I had perfect coding skills? Link to comment Share on other sites More sharing options...
zidsal Posted June 5, 2009 Author Share Posted June 5, 2009 @MrMiguuâ„¢:> When did I say I had perfect coding skills?http://www.thefreedictionary.com/patronizingNow unless you have anything to add to the conversation I would appreciate it you left as this is only going to end in flaming. Link to comment Share on other sites More sharing options...
vrage Posted June 5, 2009 Share Posted June 5, 2009 what this do to my game :O Link to comment Share on other sites More sharing options...
dao Posted June 6, 2009 Share Posted June 6, 2009 lol v-rage.. and zidsal if this isnt your code and it's mostly mrmiguu's i doubt you have any business releasing this. unless you made this by yourself Link to comment Share on other sites More sharing options...
ddunit Posted June 6, 2009 Share Posted June 6, 2009 @Zultar:> lol v-rage.. and zidsal if this isnt your code and it's mostly mrmiguu's i doubt you have any business releasing this. unless you made this by yourselfHe himself has done it, don't put up accusations witouth proof. Link to comment Share on other sites More sharing options...
dao Posted June 6, 2009 Share Posted June 6, 2009 i said:unless you made this by yourselfi didnt say he did i was just saying if he didnt he has no business posting it Link to comment Share on other sites More sharing options...
mrmiguu Posted June 6, 2009 Share Posted June 6, 2009 Please guys… refrain from the flame wars. To clarify the situation: it was mostly my fault for causing this "flame-war" due to the fact that I was upset for him releasing code relevant to gravity and jump. I don't care anymore but I was mad at the time that I posted because I wanted to be the only person to release any sort of side-scrolling features for Eclipse on the forums. He beat me to it, that's all. Link to comment Share on other sites More sharing options...
ddunit Posted June 6, 2009 Share Posted June 6, 2009 Is this even tested? Link to comment Share on other sites More sharing options...
mrmiguu Posted June 6, 2009 Share Posted June 6, 2009 @DDuÃ˜à ¼Ât:> Is this even tested?Not from what I know of. Link to comment Share on other sites More sharing options...
dao Posted June 6, 2009 Share Posted June 6, 2009 k mr miguu lol you were i believe the first who made it just no who released it, and v-rage lol xD Link to comment Share on other sites More sharing options...
mrmiguu Posted June 6, 2009 Share Posted June 6, 2009 @Zultar:> k mr miguu lol you were i believe the first who made it just no who released it, and v-rage lol xDCorrection, we were to first get it working and tested. ;) Link to comment Share on other sites More sharing options...
dao Posted June 6, 2009 Share Posted June 6, 2009 yeah so you have that, at least you know you guys did it before anyone else. which is a 10/10 in my book Link to comment Share on other sites More sharing options...
zidsal Posted June 6, 2009 Author Share Posted June 6, 2009 here are the facts:1.MrMiguu SS was created way before this. This is just the simple basics all you would need is some form of jumping to finish the basics.2\. I did test this currently:it is possible to jump over 1 square and if running 2 squares but thats only if you put it in a sub like GameAi because vb6 timers are shit.I would suggest putting this in a function that activates when gravity needs to happen e.g playermove sub or another sub that is constanly running.If your going to go about this using playermove sub and you are NOT going to use a jump button you will need to extend gettickcount (currently set to 150ms I thing). Otherwise it will be impossible to move up :D.3\. There is currently 1 error that can crash the server. If a player is below block tiles he will fall. If there are no bock tiles to fall onto he will fall off the map and crash the server. Should not be too hard to fix just add a check on the x axis to see if going to fall off the map aka.```if player(i) <= 29 (map ends at 30 I thing) thenexit doend if```4\. **I did forget to mention I would like to thank V rage who helped me work out how to calculate how close someone is to a blocked tile.** I will update the first post now.5\. Although I had some help fomr Vrage this is my work. 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