emblem Posted July 7, 2009 Author Share Posted July 7, 2009 **Adding a Switch Attribute****Created for:** http://www.touchofdeathforums.com/smf/index.php/topic,47790.msg490643/boardseen.html#new**Eclipse Version:** Eclipse Evolution 2.8**Difficulty:** 2/5 - Copy paste**Preinstalled Download:** [[Source Files]](http://www.mediafire.com/download.php?annr2b1odza) [[Compiled Files]](http://www.freemmorpgmaker.com/files/imagehost/pics/7ff3c734506a9d9ef72e1a441d763f6b.rar)_Let's begin!_Client Side**Download this file:** [[frmSwitch.frm]](http://www.freemmorpgmaker.com/files/imagehost/pics/77c7f061ffaa3874504498dc0c08c1c2.rar) and add it to the project.**Controls****frmMapEditor:** Add one radio button to this form, and call it "optSwitch". Add it under the chest radio button.**Code**``` If Me.OptGHook.Value Then .Type = TILE_TYPE_HOOKSHOT .Data1 = 0 .Data2 = 0 .Data3 = 0 .String1 = vbNullString .String2 = vbNullString .String3 = vbNullString End If`````` If Me.optSwitch.Value Then .Type = TILE_TYPE_SWITCH .Data1 = SwitchWarpMap .Data2 = SwitchWarpPos .Data3 = SwitchWarpFlags .String1 = vbNullString .String2 = vbNullString .String3 = vbNullString End If``````Private Sub optSwitch_Click() frmSwitch.Show vbModalEnd Sub``````Public Const TILE_TYPE_LOWER_STAT = 31``````Public Const TILE_TYPE_SWITCH = 32`````` If X >= 0 And X <= MAX_MAPX Then If y >= 0 And y <= MAX_MAPY Then If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_BLOCKED Then Player(Index).Arrow(z).Arrow = 0 End If End If End If`````` If Map(GetPlayerMap(MyIndex)).Tile(X, y).Type = TILE_TYPE_SWITCH Then If (Map(GetPlayerMap(MyIndex)).Tile(X, y).Data3 And 2) = 2 Then ' Advanced Bit Logic, ask for help before changing this line. Call SendData("arrowswitch" & SEP_CHAR & X & SEP_CHAR & y & END_CHAR) Player(Index).Arrow(z).Arrow = 0 End If End If`````` If .Type = TILE_TYPE_LOWER_STAT Then MinusHp = .Data1 MinusMp = .Data2 MinusSp = .Data3 MessageMinus = .String1 frmMapEditor.optMinusStat.Value = True End If`````` If .Type = TILE_TYPE_SWITCH Then SwitchWarpMap = .Data1 SwitchWarpPos = .Data2 SwitchWarpFlags = .Data3 frmMapEditor.optSwitch.Value = True End If`````` If frmMapEditor.optMinusStat.Value = True Then .Type = TILE_TYPE_LOWER_STAT .Data1 = MinusHp .Data2 = MinusMp .Data3 = MinusSp .String1 = MessageMinus .String2 = vbNullString .String3 = vbNullString End If`````` If frmMapEditor.optSwitch.Value = True Then .Type = TILE_TYPE_SWITCH .Data1 = SwitchWarpMap .Data2 = SwitchWarpPos .Data3 = SwitchWarpFlags .String1 = vbNullString .String2 = vbNullString .String3 = vbNullString End If`````` If .Type = TILE_TYPE_LOWER_STAT Then Call DrawText(TexthDC, X * PIC_X + sx + 8 - (NewPlayerX * PIC_X) - NewXOffset, y * PIC_Y + sx + 8 - (NewPlayerY * PIC_Y) - NewYOffset, "-S", QBColor(BRIGHTRED)) End If`````` If .Type = TILE_TYPE_SWITCH Then Call DrawText(TexthDC, X * PIC_X + sx + 8 - (NewPlayerX * PIC_X) - NewXOffset, y * PIC_Y + sx + 8 - (NewPlayerY * PIC_Y) - NewYOffset, "Sw", QBColor(GREY)) End If```Server SideNothing special to do server side, just code additions ^^**Controls**No controls to add, woo!**Code**``` (Find this]Public Const TILE_TYPE_LOWER_STAT = 31`````` (After, add this]Public Const TILE_TYPE_SWITCH = 32`````` Case "arrowhit" Call Packet_ArrowHit(index, Val(Parse(1)), Val(Parse(2)), Val(Parse(3)), Val(Parse(4))) Exit Sub`````` Case "arrowswitch" Call Packet_ArrowSwitch(index, Val(Parse(1)), Val(Parse(2))) Exit Sub``````Public Sub Packet_Attack(ByVal index As Long) Dim I As Long Dim Damage As Long`````` Dim X As Byte, Y As Byte, tX As Byte, tY As Byte`````` If GetPlayerWeaponSlot(index) > 0 Then If Item(GetPlayerInvItemNum(index, GetPlayerWeaponSlot(index))).Data3 > 0 Then If Item(GetPlayerInvItemNum(index, GetPlayerWeaponSlot(index))).Stackable = 0 Then Call SendDataToMap(GetPlayerMap(index), "checkarrows" & SEP_CHAR & index & SEP_CHAR & Item(GetPlayerInvItemNum(index, GetPlayerWeaponSlot(index))).Data3 & SEP_CHAR & GetPlayerDir(index) & END_CHAR) Else Call GrapleHook(index) End If Exit Sub End If End If`````` X = GetPlayerX(index) + IIf(GetPlayerDir(index) >= 2, (GetPlayerDir(index) - 2) * 2 - 1, 0) Y = GetPlayerY(index) + IIf(GetPlayerDir(index) < 2, GetPlayerDir(index) * 2 - 1, 0) If Map(GetPlayerMap(index)).Tile(X, Y).Type = TILE_TYPE_SWITCH Then If (Map(GetPlayerMap(index)).Tile(X, Y).Data3 And 1) = 1 Then ' Advanced Bit Logic, ask for help before changing this line. tX = Map(GetPlayerMap(index)).Tile(X, Y).Data2 \ 256 tY = Map(GetPlayerMap(index)).Tile(X, Y).Data2 Mod 256 Call PlayerWarp(index, Map(GetPlayerMap(index)).Tile(X, Y).Data1, tX, tY) Exit Sub End If End If``````Public Sub Packet_ArrowSwitch(ByVal index As Long, ByVal X As Long, ByVal Y As Long) Dim tX As Byte, tY As Byte If Map(GetPlayerMap(index)).Tile(X, Y).Type = TILE_TYPE_SWITCH Then If (Map(GetPlayerMap(index)).Tile(X, Y).Data3 And 2) = 2 Then ' Advanced Bit Logic, ask for help before changing this line. tX = Map(GetPlayerMap(index)).Tile(X, Y).Data2 \ 256 tY = Map(GetPlayerMap(index)).Tile(X, Y).Data2 Mod 256 Call PlayerWarp(index, Map(GetPlayerMap(index)).Tile(X, Y).Data1, tX, tY) End If End IfEnd Sub```**Edit:**```Public MinusHp As IntegerPublic MinusMp As IntegerPublic MinusSp As IntegerPublic MessageMinus As String```And under it add```Public SwitchWarpMap As LongPublic SwitchWarpPos As LongPublic SwitchWarpFlags As Long```_Congradulations, you are finished!_And don't ask how I got the Source Rar from 100mb to 8mb. I don't even know myself. Link to comment Share on other sites More sharing options...
Jaiden Posted July 7, 2009 Share Posted July 7, 2009 Freaking Epic! Thanks so much! I'll test it now :3 Link to comment Share on other sites More sharing options...
emblem Posted July 7, 2009 Author Share Posted July 7, 2009 It *should* work, but the Eyedropper wont work because it's bugged and I can't seem to fix it :/ Link to comment Share on other sites More sharing options...
goku1993 Posted July 7, 2009 Share Posted July 7, 2009 hmm looking at the code it looks good but didn't you forget to dim SwitchWarpMap or did i just read the code wrong somewhere. Link to comment Share on other sites More sharing options...
emblem Posted July 7, 2009 Author Share Posted July 7, 2009 Thank you. I knew I forgot something! Link to comment Share on other sites More sharing options...
goku1993 Posted July 7, 2009 Share Posted July 7, 2009 no problem i just saw didn't find it while looking into the code just luck Link to comment Share on other sites More sharing options...
emblem Posted July 7, 2009 Author Share Posted July 7, 2009 No problem, I'm glad someone noticed soon. Would have embarrassed myself to find out later it wasn't there. Link to comment Share on other sites More sharing options...
Jaiden Posted July 8, 2009 Share Posted July 8, 2009 Yeah can you fix that? o.o I added all the code and got an error when I tried to place the tile, involving SwitchWarpMap = .Data1 I believe it said undefined variable or something along those lines. Link to comment Share on other sites More sharing options...
emblem Posted July 9, 2009 Author Share Posted July 9, 2009 ```Dim MinusHp As LongDim MinusMp As LongDim MinusSp As Long``````Dim SwitchWarpMap As LongDim SwitchWarpPos As LongDim SwitchWarpFlags As Long```Should do it, I typed that up without the source so. Link to comment Share on other sites More sharing options...
Jaiden Posted July 9, 2009 Share Posted July 9, 2009 I didn't find it anywhere, so I used common sense I suppose. I guessed, and was right haha.Its actuallyFind```Public MinusHp As IntegerPublic MinusMp As IntegerPublic MinusSp As IntegerPublic MessageMinus As String```And under it add```Public SwitchWarpMap As LongPublic SwitchWarpPos As LongPublic SwitchWarpFlags As Long```Thank you so much for this Emblem! It works great! Link to comment Share on other sites More sharing options...
goku1993 Posted July 10, 2009 Share Posted July 10, 2009 Ok well i tested it but the Y caption in the form doesn't work properly so i think i m gonna check it out i ll tell you if i find the erroredit: ok found it it s just a stupid error,i think you just didn't realize it while typing:```Private Sub scrlX_Change() lblX.Caption = scrlX.ValueEnd SubPrivate Sub scrlY_Change() lblY.Caption = scrlX.ValueEnd Sub```should be :```Private Sub scrlX_Change() lblX.Caption = scrlX.ValueEnd SubPrivate Sub scrlY_Change() lblY.Caption = scrlY.ValueEnd Sub``` Link to comment Share on other sites More sharing options...
emblem Posted July 13, 2009 Author Share Posted July 13, 2009 Yeah, that's weird because I copied my source directly from the working version.And it worked perfectly.Mmhm. 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