Fbu Posted February 8, 2011 Author Share Posted February 8, 2011 Largely based off what I learn from [Richy's code.](http://www.touchofdeathforums.com/smf/index.php/topic,68426.0.html) It will add an attribute that will change the player's sprite (according to what # you want) when they walk over it.Both Client and Server:Under modules in modConstants search for:```Public Const TILE_TYPE_SLIDE As Byte = 14```Add this under it:```Public Const TILE_TYPE_SPRITE As Byte = 16```Server Only:Under modules in modPlayer in PlayerMove search for:```If .Type = TILE_TYPE_TRAP Then amount = .Data1 SendActionMsg GetPlayerMap(index), "-" & amount, BrightRed, ACTIONMSG_SCROLL, GetPlayerX(index) * 32, GetPlayerY(index) * 32, 1 If GetPlayerVital(index, HP) - amount <= 0 Then KillPlayer index PlayerMsg index, "You died.", BrightRed Else SetPlayerVital index, HP, GetPlayerVital(index, HP) - amount PlayerMsg index, "You were hurt.", BrightRed Call SendVital(index, HP) End If Moved = YES End If```Add this under it:``` 'Checks for sprite tile If .Type = TILE_TYPE_SPRITE Then amount = .Data1 Call SetPlayerSprite(index, amount) Call SendPlayerData(index) Moved = YES End If```–-----------------Optional-------------------If you want to make your sprites cost money then follow these intructions.Thanks to Alatar for [his code](http://www.touchofdeathforums.com/smf/index.php/topic,65616.0.html) which this is based off of.Go back to this code:``` 'Checks for sprite tile If .Type = TILE_TYPE_SPRITE Then amount = .Data1 Call SetPlayerSprite(index, amount) Call SendPlayerData(index) Moved = YES End If```And change it to this:``` 'Checks for sprite tile If .Type = TILE_TYPE_SPRITE Then amount = .Data1 If CheckCash(Index, x, y) = True Then 'x=itemnum of your cash y=amount you want sprites to cost TakeInvItem (Index, x, y) 'x=itemnum of your cash y=amount you want sprites to cost Call SetPlayerSprite(index, amount) Call SendPlayerData(index) Else Call PlayerMsg(index, "You don't have enough cash!", Yellow) End If Else Moved = YES End If```Replace x and y with the itemnum of your currency(x) and the amount of currency you want to take away(y).Then add this to the bottom of modPlayer:```Function CheckCash(ByVal Index As Long, ByVal CashItemNum As Long, ByVal CashAmount As Long) As Boolean Dim I As Long For I = 1 To MAX_INV If GetPlayerInvItemNum(Index, I) = CashItemNum Then If Item(CashItemNum).Type = ITEM_TYPE_CURRENCY Then If CashAmount <= GetPlayerInvItemValue(Index, I) Then CheckCash = True Else CheckCash = False End If End If End If NextEnd Function```–--------------------------------------------Client Only:Under modules in modGlobals search for:```' Used for map editor heal & trap & slide tilesPublic MapEditorHealType As LongPublic MapEditorHealAmount As LongPublic MapEditorSlideDir As Long```Add this underneath it:```Public TileSprite As Long```Under modules in modText in BltMapAttributes search for:``` Case TILE_TYPE_SLIDE DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)```Add this underneath it:``` Case TILE_TYPE_SPRITE DrawText TexthDC, tX, tY, "S", QBColor(Pink)```Under modules in modGameEditors in MapEditorMouseDown search for:``` ' slide If frmEditor_Map.optSlide.Value Then .Type = TILE_TYPE_SLIDE .Data1 = MapEditorSlideDir .Data2 = 0 .Data3 = 0 End If```Add this underneath it:``` 'sprite If frmEditor_Map.optSprite.Value Then .Type = TILE_TYPE_SPRITE .Data1 = TileSprite .Data2 = 0 .Data3 = 0 End If```Now open up the frmEditorMap.Create an option box in the Attributes frame. Name it optSprite and then Caption it as Sprite.![](http://img.photobucket.com/albums/v15/BFU22/1-5.png)Now create a frame in the picAttributes picturebox. Name this fraSprite and then caption it as Sprite. Make sure the visible is set to **false**.Now create two labels within the frame. Name one Label3 and caption it as Sprite Number:.Name the second label SpriteNum and then caption it as 0.Now create a HScrollBar under the two labels. Name it HScroll2.Finally create a CommandButton under the scroll bar. Name it cmdSprite and caption it as Okay.![](http://img.photobucket.com/albums/v15/BFU22/2-5.png)Double click on the HScroll2\. It should pop-up with this:```Private Sub HScroll2_Change()End Sub```Change it to this:```Private Sub HScroll2_Change()frmEditor_Map.SpriteNum = HScroll2.ValueEnd Sub```Double click your cmdSprite. It should look like this:```Private Sub cmdSprite_Click()End Sub```Change it to this:```Private Sub cmdSprite_Click() ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler TileSprite = HScroll2.Value picAttributes.Visible = False fraSprite.Visible = False ' Error handler Exit Suberrorhandler: HandleError "cmdSprite_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```Now double click on your optSprite. It should show this:```Private Sub optSprite_Click()End Sub```Replace it with this:```Private Sub optSprite_Click() ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler ClearAttributeDialogue picAttributes.Visible = True fraSprite.Visible = True ' Error handler Exit Suberrorhandler: HandleError "optSprite_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```Compile both the server and the client.If all goes well you should now be able to add the sprite tile in your game. (:Example Screenie:![](http://img.photobucket.com/albums/v15/BFU22/3-7.png) Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2011 Share Posted February 8, 2011 Hold on so this tile just puts a sprite from your characters folder onto the map? Link to comment Share on other sites More sharing options...
damian666 Posted February 8, 2011 Share Posted February 8, 2011 no…it changes your players sprite to the one defined in the editor xdnice tut, I missed that feature from old eclipse, was gonna add it myself too :)Damiedit, i am adding money cost to the tile, i suggest you do that too, and add it to tut.that way players can buy the sprites :) Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2011 Share Posted February 8, 2011 @Dami:> no…> > it changes your players sprite to the one defined in the editor xd> > nice tut, I missed that feature from old eclipse, was gonna add it myself too :)> > Dami> > edit, I am adding money cost to the tile, I suggest you do that too, and add it to tut.> > that way players can buy the sprites :)Orite! Thanks for releasing this then, Fbu <3. Link to comment Share on other sites More sharing options...
Fbu Posted February 8, 2011 Author Share Posted February 8, 2011 @Dami:> I am adding money cost to the tile, I suggest you do that too, and add it to tut.> > that way players can buy the sprites :)Great idea! I don't need it for my game but I can see a lot of people wanting it.Thanks to Alatar for [his code](http://www.touchofdeathforums.com/smf/index.php/topic,65616.0.html) which this is based off of.To add price to sprites go back here:``` 'Checks for sprite tile If .Type = TILE_TYPE_SPRITE Then amount = .Data1 Call SetPlayerSprite(index, amount) Call SendPlayerData(index) Moved = YES End If```And change it to this:``` 'Checks for sprite tile If .Type = TILE_TYPE_SPRITE Then amount = .Data1 If CheckCash(Index, x, y) = True Then 'x=itemnum of your cash y=amount you want sprites to cost TakeInvItem (Index, x, y) 'x=itemnum of your cash y=amount you want sprites to cost Call SetPlayerSprite(index, amount) Call SendPlayerData(index) Else Call PlayerMsg(index, "You don't have enough cash!", Yellow) End If Else Moved = YES End If```Then add this to the bottom of modPlayer:```Function CheckCash(ByVal Index As Long, ByVal CashItemNum As Long, ByVal CashAmount As Long) As Boolean Dim i As Long For i = 1 To MAX_INV If GetPlayerInvItemNum(Index, i) = CashItemNum Then If Item(CashItemNum).Type = ITEM_TYPE_CURRENCY Then If CashAmount <= GetPlayerInvItemValue(Index, i) Then CheckCash = True Else CheckCash = False End If End If End If NextEnd Function``` Link to comment Share on other sites More sharing options...
damian666 Posted February 8, 2011 Share Posted February 8, 2011 nice, its refreshing to see new members post this stuff :)Dami Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2011 Share Posted February 8, 2011 This'll be pretty damn useful for customization, i.e. barbers, etc. Again, thanks ;D. Link to comment Share on other sites More sharing options...
Fbu Posted February 8, 2011 Author Share Posted February 8, 2011 Your welcome guys (: Link to comment Share on other sites More sharing options...
damian666 Posted February 8, 2011 Share Posted February 8, 2011 a other small improvement you could add.use the client side editor to also store type of currency to use, And the amount of it ^^easy, just want to see if you can do it. :pDami Link to comment Share on other sites More sharing options...
EclipseCommunity Posted February 10, 2011 Share Posted February 10, 2011 There's a strange glitch with the character sprite when walking over this attribute. It jumps and doesn't settle on that tile. Not sure what the problem was, wondered if anybody else had it. Link to comment Share on other sites More sharing options...
abcbadboy555 Posted February 27, 2011 Share Posted February 27, 2011 i think u have something wrong with the code "TakeInvItem (Index, x, y) 'x=itemnum of your cash y=amount you want sprites to cost" Even when you change it, it is still red and an error pops up and says "compile error: Expected: =" Link to comment Share on other sites More sharing options...
Joyce Posted February 27, 2011 Share Posted February 27, 2011 It's supposed to be either:```TakeInvItem Index,x,y```or```Call TakeInvItem(Index,x,y)```That's what's causing your issue, without the call command but with brackets VB6 assumes it's a function that should return a value, hence asking for the = symbol. The above methods will solve this issue. Link to comment Share on other sites More sharing options...
abcbadboy555 Posted February 27, 2011 Share Posted February 27, 2011 lol this is my line of code "Call TakeInvItem(Index,x,y) x=1 y=2000" and now it says "compile error: Expected: end of statement" Link to comment Share on other sites More sharing options...
Joyce Posted February 27, 2011 Share Posted February 27, 2011 Ah, no it doesn't work like that. You need to REPLACE the X and Y inside the brackets with your numbers, not place it after the command, so it should be like:```Call TakeInvItem(Index, 1, 2000) ' 1 is your currency(X), and 2000 is the amount taken.(Y)``` Link to comment Share on other sites More sharing options...
abcbadboy555 Posted February 27, 2011 Share Posted February 27, 2011 ohhh…. Thanks i just learned something new today! Thx Yami xD I also like your updater :D Link to comment Share on other sites More sharing options...
RyokuHasu Posted March 10, 2011 Share Posted March 10, 2011 =o GREAT way to give Exclusive avatars as rewards in hosted events =D I LIKE IT Link to comment Share on other sites More sharing options...
Dragonin Posted April 13, 2011 Share Posted April 13, 2011 ~~If i compile server.exe then i have error :So , why this mistake is jumping out ?~~ Ok now it's all ok , great tut ;]One question how to do previous outfit ? Link to comment Share on other sites More sharing options...
erkro1 Posted April 13, 2011 Share Posted April 13, 2011 @Dragonin:> ~~If i compile server.exe then i have error :> > So , why this mistake is jumping out ?~~You didn't add this properly :```Public Const TILE_TYPE_SPRITE As Byte = 16``` Link to comment Share on other sites More sharing options...
Suppositoire Posted May 24, 2011 Share Posted May 24, 2011 Is it possible of blocked the tile if the player does not buy the sprite? :) Link to comment Share on other sites More sharing options...
Vus Posted May 24, 2011 Share Posted May 24, 2011 appears runtime error 9, subscript out of range when i step on that tile :( Link to comment Share on other sites More sharing options...
Vus Posted May 25, 2011 Share Posted May 25, 2011 what to do with it please? Link to comment Share on other sites More sharing options...
Suppositoire Posted May 25, 2011 Share Posted May 25, 2011 I have a problem, I use the E.O Modification(S) (by Ritchi), and I take the code with the option: paying sprite ( the part optional ) but an error :sWhen I clic on[![](http://s3.noelshack.com/uploads/images/16679027850408_spritenudem.png)](http://s3.noelshack.com/upload/16679027850408_spritenudem.png)The error :[![](http://s3.noelshack.com/uploads/images/20681040759093_spritenum.png)](http://s3.noelshack.com/upload/20681040759093_spritenum.png)The fraSprite not appear.. :huh: Link to comment Share on other sites More sharing options...
Vus Posted May 25, 2011 Share Posted May 25, 2011 hmm, this one works for me…and it worked for you to compile? cuz i used Modification(S) and it was bugged so i wasnt able to source edit itbtw, does any1 know how to fix mine error?as i said, everything works, until i step on that tile, appears runtime error 9, subscript out of range :( Link to comment Share on other sites More sharing options...
Suppositoire Posted May 29, 2011 Share Posted May 29, 2011 Anybody can help me please? Link to comment Share on other sites More sharing options...
Vus Posted May 29, 2011 Share Posted May 29, 2011 same for me :D 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