ulquial Posted August 4, 2013 Author Share Posted August 4, 2013 I really need someone experimented to help me with that. Its a serious major part of my project, i really need a resource type that we can pass thru like herbs or plants.Ty ! And It will help a lot of pplz too.Thanks in advance, and sorry i made a similar topic about something else, but i was in wrong place, so i make it here.Ty. Link to comment Share on other sites More sharing options...
jcsnider Posted August 4, 2013 Share Posted August 4, 2013 Go into frmEditor_Resources in the client, right click on the list of resource types hit properties. In the properties window go down and look for the list property and add your resource types to the list.Then in the client (Sub CheckDirection) find```' Check to see if the map tile is tree or not If Map.Tile(X, Y).type = TILE_TYPE_RESOURCE Then CheckDirection = True Exit Function End If```and replace it with```' Check to see if the map tile is tree or not If Map.Tile(X, Y).type = TILE_TYPE_RESOURCE Then 'Checks to see if it is a certain resource type. I am using 4 because it is Herb is the fifth item ' on my list. (5 - 1). If Resource(Map.Tile(X, Y).Data1).ResourceType = 4 Then 'Do nothing Else 'It is not walkable, block it. CheckDirection = True Exit Function End If End If```Then in the server in Sub PlayerMove you have it check the 4 directions that the player can move. The part that stops the player from moving looks like this.```If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_RESOURCE Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type = TILE_TYPE_KEY And temptile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If```You need to rewrite the line regarding resources to look like this (long but works)```If (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_RESOURCE) Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type = TILE_TYPE_RESOURCE And Resource(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1).ResourceType = 4) Then```^^ All one line. Notice how I am still using the 4?And you will need to do that for the up, down, left and right cases changing the coordinates in that line correctly. Notice the GetPlayerY(index) -1? That means I just did the line for the up direction leaving you with only 3 more ;)Everything above will work if you install it correctly. It is a quick edit but messy and not very proper. Someone else may come around and give a better code sample but this is all I can give in my limited time, best of luck :P Link to comment Share on other sites More sharing options...
ulquial Posted August 4, 2013 Author Share Posted August 4, 2013 Thanks it works, but now the resource is not under me when i walk thru. ![](http://img29.imageshack.us/img29/306/lw39.png)how do i fix that? Have a line that make the resource to show under player? Link to comment Share on other sites More sharing options...
jcsnider Posted August 4, 2013 Share Posted August 4, 2013 n sub DrawMapResource add a parameter (belowPlayer as boolean) then in sub Render_Graphics find the loop where it does map graphics, copy and paste it above where it draws the Y based rendering and then add a ,true or false to match the parameter. Finally go back into Sub DrawMapResource you will have to do the type check again and draw or not draw it based on the type and the belowPlayer boolean Link to comment Share on other sites More sharing options...
ulquial Posted August 4, 2013 Author Share Posted August 4, 2013 I crash with error 9 every time i load client and start moving. (Maybe an error with ur line code ? ) Link to comment Share on other sites More sharing options...
jcsnider Posted August 5, 2013 Share Posted August 5, 2013 ``` ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_UP + 1) Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type = TILE_TYPE_KEY And temptile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).type = TILE_TYPE_KEY And temptile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If End IfAgain messy and such but replace the chunks in up/down/left/right server side with that and it will not error.``` Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 error 9 –-> If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_RESOURCE ThenIs it normal you have twice the same bloc of codes ? One in purple ? Or i dont copy the right one ??? Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 I success, but i cant move….... its blocked. Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 ```Case DIR_RIGHT ' Check to make sure not outside of boundries If GetPlayerX(Index) < Map(mapnum).MaxX Then ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).DirBlock, DIR_RIGHT + 1) Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(Index)).DoorOpen(GetPlayerX(Index), GetPlayerY(Index) - 1) = YES) Then Call SetPlayerY(Index, GetPlayerY(Index) - 1) SendPlayerMove Index, movement, sendToSelf Moved = YES End If End If End If End If Else``` Link to comment Share on other sites More sharing options...
or3o Posted August 5, 2013 Share Posted August 5, 2013 if im not mistaken your trying to make it so you can walk over some resources? shouldnt you add something to this bit of code to allow that to happen? Link to comment Share on other sites More sharing options...
or3o Posted August 5, 2013 Share Posted August 5, 2013 in player move does it check what kind of tile your currently on before you walk? if so mabye thats the problem Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 i have been helped. just look from the beginning : [http://www.eclipseorigins.com/community/index.php?/topic/134010-resource-type-that-is-walkable-serious-help/#entry906215](http://www.eclipseorigins.com/community/index.php?/topic/134010-resource-type-that-is-walkable-serious-help/#entry906215)and now with the last part it doesnt work. I cant move. it blockes when i move. Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 5, 2013 Share Posted August 5, 2013 could you specify as to what you are trying to acomplish? Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 A resource type that is walkable. If you look the link, you will see that with help, i success passing thru a resource type, but i got error 9\. And that person gived me a code to change and supposed to fix the error 9\. But instead, it would not let me move my character in all directions. I wanted to make a resource type like plants to gather or herbs. There is 2 problems now:->Cant move.-> The resource appears on top of me. Not under player. (not important for now, i just want to fix the cant move first).Thanks if you can help ! :) Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 5, 2013 Share Posted August 5, 2013 1\. im working on it right now.2\. in Sub Render_Graphics, there's a small section at the top that draws all the graphics to the screen. look for the Resources. above is the Player and NPCs, being as how they are first, the players get rendered first, which means anything will be above it after that render. to fix this, just copy/paste the resource drawing to somewhere above the player drawing. Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 Ok thx for your help :) Link to comment Share on other sites More sharing options...
jcsnider Posted August 5, 2013 Share Posted August 5, 2013 As for your current code block that you posted you are not listening to me. I gave you a chunk of code for DIR_UP but you have to modifiy it for DIR_DOWN, left and right.In DIR_RIGHT the players position is X + 1 not Y - 1\. You need to change your code to reflect that. Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 5, 2013 Share Posted August 5, 2013 yea was about to post that. Link to comment Share on other sites More sharing options...
jcsnider Posted August 5, 2013 Share Posted August 5, 2013 Merged the 2 topics together. Do not make multiple topics for the same issue XD Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 I dont understand Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 5, 2013 Share Posted August 5, 2013 ```Select Case Dir Case DIR_UP ' Check to make sure not outside of boundries If GetPlayerY(index) > 0 Then ' Check to make sure that the tile is walkable ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_UP + 1) Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerY(index, GetPlayerY(index) - 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerY(index, GetPlayerY(index) - 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If End If End If End If Case DIR_DOWN ' Check to make sure not outside of boundries If GetPlayerY(index) < Map(mapnum).MaxY Then ' Check to make sure that the tile is walkable ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_DOWN + 1) Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + 1).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + 1).Type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerY(index, GetPlayerY(index) + 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) + 1).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerY(index, GetPlayerY(index) + 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If End If End If End If Case DIR_LEFT ' Check to make sure not outside of boundries If GetPlayerX(index) > 0 Then ' Check to make sure that the tile is walkable ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).DirBlock, DIR_LEFT + 1) Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerX(index, GetPlayerX(index) - 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) - 1, GetPlayerY(index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerX(index, GetPlayerX(index) - 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If End If End If End If Case DIR_RIGHT ' Check to make sure not outside of boundries If GetPlayerX(index) < Map(mapnum).MaxX Then ' Check to make sure that the tile is walkable ' Check to make sure not outside of boundries ' Check to make sure that the tile is walkable If Not isDirBlocked(Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).DirBlock, DIR_RIGHT + 1) Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type <> TILE_TYPE_BLOCKED Then If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type = TILE_TYPE_RESOURCE Then If Resource(Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Data1).ResourceType = 4 Then ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerX(index, GetPlayerX(index) + 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If Else ' Check to see if the tile is a key and if it is check if its opened If Map(GetPlayerMap(index)).Tile(GetPlayerX(index) + 1, GetPlayerY(index)).Type <> TILE_TYPE_KEY Or (Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index) - 1).Type = TILE_TYPE_KEY And temptile(GetPlayerMap(index)).DoorOpen(GetPlayerX(index), GetPlayerY(index) - 1) = YES) Then Call SetPlayerX(index, GetPlayerX(index) + 1) SendPlayerMove index, movement, sendToSelf Moved = YES End If End If End If End If End If End Select``` Link to comment Share on other sites More sharing options...
jcsnider Posted August 5, 2013 Share Posted August 5, 2013 The code you are editing is the code that finds the tile the player is trying to walk to, it makes sure the tile is clear and then it finally moves the player. The problem is, is that it checks the direction the player is going so it has the code for all four directions.Notice how in my code I had "GetPlayerX(Index), GetPlayerY(Index) - 1" several times? It is because it is checking the tile **above** the player in this grid. So the code will only work for the DIR_UP case.When you get down to the DIR_RIGHT that you posted the code should have "GetPlayerX(Index) + 1, GetPlayerY(Index)" instead and you need to change that yourself to make it work.Edit: Or growlith can just do it all for ya lol. Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 Thanks growlith ! But you made a mistake, i fixed it . ^^ Thanks for your help. it works perfectly :)Now fo drawing the resource under the player? Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 5, 2013 Share Posted August 5, 2013 For the resource drawing. i already went over that. Link to comment Share on other sites More sharing options...
ulquial Posted August 5, 2013 Author Share Posted August 5, 2013 I know, but doing that will not make trees under me? Or can i setup it only for a specific resource? 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