tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 So in this tutorial you will make possible to have this weapon types:* [2 Handed](http://www.touchofdeathforums.com/smf2/index.php/topic,80386) - by Sigridunset* Dagger* Normal weapon2 Handed - If u have daggers or normal weapon and shield equipped, it will unequip them and equip 2 handed weapon. [Made by Sigridunset](http://www.touchofdeathforums.com/smf2/index.php/topic,80386).Dagger - If u have weapon and shield equipped, it will first unequip weapon, and if u equip another dagger, it will equip on shield slot ( so you can have 2 weapons equipped, and yes stats stack, so if first dagger have bonus 5 dmg and second dagger have bonus 10 dmg, bonus will be 15 dmg). And u can have equipped shield with dagger.Normal weapon - Like dagger but u cant have equipped this item on shield slot, so u can have equiped this weapon and shield, but not this weapon and this weapon.Some parts of this tutorial is by Sigridunset.Thx to Sigridunset for [2h system](http://www.touchofdeathforums.com/smf2/index.php/topic,80386).CLIENT SIDEGo to frmEditor_Item and make 2 checkboxes in fraEquipmentFirstName: chkTwohCaption: Two HandedAdd into it```' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerIf chkTwoh.Value = 0 ThenItem(EditorIndex).isTwoHanded = FalseElseItem(EditorIndex).isTwoHanded = TrueItem(EditorIndex).isDagger = FalsechkDagger.Value = 0End If' Error handlerExit Suberrorhandler:HandleError "chkTwoh", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit Sub```SecondName: chkDaggerCaption: DaggerAdd into it```If Options.Debug = 1 Then On Error GoTo errorhandlerIf chkDagger.Value = 0 ThenItem(EditorIndex).isDagger = FalseElseItem(EditorIndex).isDagger = TrueItem(EditorIndex).isTwoHanded = FalsechkTwoh.Value = 0End If' Error handlerExit Suberrorhandler:HandleError "chkTwoh", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit Sub```Now add at bottom of Private Type ItemRec``` isTwoHanded As BooleanisDagger As Boolean```Now go to Public Sub ItemEditorInit()Here find```frmEditor_Item.scrlSpeed.Value = .Speed```Add under it```If Item(EditorIndex).isTwoHanded ThenfrmEditor_Item.chkTwoh.Value = 1ElsefrmEditor_Item.chkTwoh.Value = 0End IfIf Item(EditorIndex).isDagger ThenfrmEditor_Item.chkDagger.Value = 1ElsefrmEditor_Item.chkDagger.Value = 0End If```SERVER SIDEAt bottom of Private Type ItemRec add```isTwoHanded As BooleanisDagger As Boolean```At top of Public Sub UseItem add```Dim b As Long, j As LongFor j = 1 To MAX_INVNextb = FindOpenInvSlot(index, j)```Now find```Case ITEM_TYPE_WEAPON```Under```' access requirement```Put```If Item(itemnum).isTwoHanded = True ThenIf GetPlayerEquipment(index, Shield) > 0 ThenIf GetPlayerEquipment(index, Weapon) > 0 ThenIf b < 1 ThenCall PlayerMsg(index, "You have no room in your inventory.", BrightRed)Exit SubEnd IfEnd IfEnd IfEnd If```Still in ITEM_TYPE_WEAPON in Sub UseItem in ModPlayerAbove this:```PlayerMsg Index, "You equip " & CheckGrammar(Item(itemnum).Name), BrightGreen```Remove this:```SetPlayerEquipment Index, itemnum, Weapon```Delete this```If GetPlayerEquipment(Index, Weapon) > 0 ThentempItem = GetPlayerEquipment(Index, Weapon)End If```And replace this```If tempItem > 0 ThenGiveInvItem Index, tempItem, 0 ' give back the stored itemtempItem = 0End If```With this```If Item(ItemNum).isDagger ThenIf GetPlayerEquipment(index, Shield) > 0 ThenIf GetPlayerEquipment(index, Weapon) > 0 ThenIf Item(GetPlayerEquipment(index, Weapon)).isDagger ThenGiveInvItem index, GetPlayerEquipment(index, Shield), 0SetPlayerEquipment index, ItemNum, ShieldElseGiveInvItem index, GetPlayerEquipment(index, Weapon), 0SetPlayerEquipment index, ItemNum, WeaponEnd IfElseSetPlayerEquipment index, ItemNum, WeaponEnd IfElseIf GetPlayerEquipment(index, Weapon) > 0 ThenIf Item(GetPlayerEquipment(index, Weapon)).isDagger ThenGiveInvItem index, GetPlayerEquipment(index, Shield), 0SetPlayerEquipment index, ItemNum, ShieldElseGiveInvItem index, GetPlayerEquipment(index, Weapon), 0SetPlayerEquipment index, ItemNum, WeaponEnd IfElseSetPlayerEquipment index, ItemNum, WeaponEnd IfEnd IfElseIf Item(ItemNum).isTwoHanded ThenIf GetPlayerEquipment(index, Shield) > 0 ThenIf GetPlayerEquipment(index, Weapon) > 0 ThenGiveInvItem index, GetPlayerEquipment(index, Weapon), 0GiveInvItem index, GetPlayerEquipment(index, Shield), 0SetPlayerEquipment index, 0, ShieldSetPlayerEquipment index, ItemNum, WeaponElseGiveInvItem index, GetPlayerEquipment(index, Shield), 0SetPlayerEquipment index, 0, ShieldSetPlayerEquipment index, ItemNum, WeaponEnd IfElseIf GetPlayerEquipment(index, Weapon) > 0 ThenGiveInvItem index, GetPlayerEquipment(index, Weapon), 0SetPlayerEquipment index, ItemNum, WeaponElseSetPlayerEquipment index, ItemNum, WeaponEnd IfEnd IfElseIf GetPlayerEquipment(index, Shield) > 0 ThenIf GetPlayerEquipment(index, Weapon) > 0 ThenGiveInvItem index, GetPlayerEquipment(index, Weapon), 0SetPlayerEquipment index, ItemNum, WeaponElseSetPlayerEquipment index, ItemNum, WeaponEnd IfElseIf GetPlayerEquipment(index, Weapon) > 0 ThenGiveInvItem index, GetPlayerEquipment(index, Weapon), 0SetPlayerEquipment index, ItemNum, WeaponElseSetPlayerEquipment index, ItemNum, WeaponEnd IfEnd IfEnd If```Now find```Case ITEM_TYPE_SHIELD```In this case replace this:```If tempItem > 0 ThenGiveInvItem index, tempItem, 0 ' give back the stored itemtempItem = 0End If```With this:```If GetPlayerEquipment(Index, Weapon) > 0 ThenIf Item(GetPlayerEquipment(Index, Weapon)).isTwoHanded ThenGiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0SetPlayerEquipment Index, 0, WeaponElseIf tempItem > 0 ThenGiveInvItem Index, tempItem, 0 ' give back the stored itemtempItem = 0End IfEnd IfEnd If ```And now you will have working 3 types of weapons in game. :cheesy:Report any Bugs found._________________________________________________________________________But i need help with paperdolling. I tried to make this - if dagger is equipped on shield slot, it will change DaggerEq boolean to true ( and i added DaggerEq as Boolean to ItemRec) and on client side i tried to add scrollbar similar do Paperdoll scrollbar, but it will give atribute Item(EditorIndex).DaggerPaperdoll and i tried to add DaggerPaperdoll as Long attribute to ItemRecAnd i tried to add check:```If Item(GetPlayerEquipment(Index, PaperdollOrder(I)))).DaggerEq = True ThenCall BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(I))).DaggerPaperdoll, Anim, SpriteTop)ElseCall BltPaperdoll(x, y, Item(GetPlayerEquipment(Index, PaperdollOrder(I))).Paperdoll, Anim, SpriteTop)```But it dont worked Link to comment Share on other sites More sharing options...
Vus Posted May 27, 2012 Share Posted May 27, 2012 nice tutorial ;)I will add it to my game sometime… Link to comment Share on other sites More sharing options...
Matt Posted May 27, 2012 Share Posted May 27, 2012 Why did you combine your dagger tutorial with my Two handed tutorial?… Link to comment Share on other sites More sharing options...
quintensky Posted May 27, 2012 Share Posted May 27, 2012 @Sigridunset:> Why did you combine your dagger tutorial with my Two handed tutorial?…because adding those two together will make a brilliant system, instead of a nice one Link to comment Share on other sites More sharing options...
Ruins of Hell Posted May 27, 2012 Share Posted May 27, 2012 @Sigridunset:> Why did you combine your dagger tutorial with my Two handed tutorial?…I think the idea was that certain parts of it would make it incompatible with your tutorial. (For example, now clicking the dagger checkbox removes the two-handed checkbox.) I have added a link to your topic in the tutorial, although I could remove your tutorial from the tutorial completely if you wish. Link to comment Share on other sites More sharing options...
or3o Posted May 27, 2012 Share Posted May 27, 2012 can you make it so if the item is in the shield slot than it uses to shield paperdoll layer to render? im not sure how to go about it but that semms like the easiest way to make the item show up. ill try n figure it out and ill post it here if i do. Link to comment Share on other sites More sharing options...
Matt Posted May 27, 2012 Share Posted May 27, 2012 @Soul:> I think the idea was that certain parts of it would make it incompatible with your tutorial. (For example, now clicking the dagger checkbox removes the two-handed checkbox.) I have added a link to your topic in the tutorial, although I could remove your tutorial from the tutorial completely if you wish.Yeah that would be great! I felt repeating it was unnecessary. As long as it mentions that it requires the two handed addition it should be fine. Thank you :) Link to comment Share on other sites More sharing options...
tslusny Posted May 29, 2012 Author Share Posted May 29, 2012 @Sigridunset:> Yeah that would be great! I felt repeating it was unnecessary. As long as it mentions that it requires the two handed addition it should be fine. Thank you :)Yes it necessary becouse if i dont include it in it i will must add if u added Sigirdunsets tutorial remove that, replace it with that and soo many replacement will be made so it was necessary to copy your tutorial. Link to comment Share on other sites More sharing options...
tslusny Posted May 29, 2012 Author Share Posted May 29, 2012 @or3o:> can you make it so if the item is in the shield slot than it uses to shield paperdoll layer to render? im not sure how to go about it but that semms like the easiest way to make the item show up. ill try n figure it out and ill post it here if i do.I tried to make that i have scrollbar for another paperdoll in equipment window and i maked check if .isdagger then it will show that paperdoll. Its irrevelant for now in what paperdoll layer it render. Its easy to do in what paperdoll layer it render but i cant figure this problem. Link to comment Share on other sites More sharing options...
Matt Posted May 29, 2012 Share Posted May 29, 2012 I'm having trouble with a similar problem. Want to try solve it together? Link to comment Share on other sites More sharing options...
Domino_ Posted June 18, 2012 Share Posted June 18, 2012 I have a problem that when I equip sword then he dublicates it and one sword is equiped and one in inventory from that who i tryed to equip… and when I equip dagger he equips in both off hand and main hand solts..... Link to comment Share on other sites More sharing options...
tslusny Posted June 18, 2012 Author Share Posted June 18, 2012 Weird, i had this problem too but only when i started making on this code and i fixed it with couple of IFs, so that weird it still occurEDIT:Do you deleted this?```If GetPlayerEquipment(Index, Weapon) > 0 Then          tempItem = GetPlayerEquipment(Index, Weapon)        End If```Do you replaced this?       ``` If tempItem > 0 Then         GiveInvItem Index, tempItem, 0 ' give back the stored item          tempItem = 0        End If```Becouse you MUST replace it becouse it stores that weapon and after equip another it will give you backAboves are in Case ITEM_TYPE_WEAPON Link to comment Share on other sites More sharing options...
Domino_ Posted June 18, 2012 Share Posted June 18, 2012 I'v done it all, maybe I have made a mistake and added if checks afther code somewhere .. :DBut here is both weapon and shield type… dunno why showing u shield cuz there is no problem only with weapon xD>! ```Case ITEM_TYPE_WEAPON>!         ' stat requirements        For i = 1 To Stats.Stat_Count - 1          If GetPlayerRawStat(Index, i) < Item(itemnum).Stat_Req(i) Then            PlayerMsg Index, "You do not meet the stat requirements to equip this item.", BrightRed            Exit Sub          End If        Next        ' level requirement        If GetPlayerLevel(Index) < Item(itemnum).LevelReq Then          PlayerMsg Index, "You do not meet the level requirement to equip this item.", BrightRed          Exit Sub        End If        If Item(itemnum).isTwoHanded = True Then          If GetPlayerEquipment(Index, Shield) > 0 Then            If GetPlayerEquipment(Index, Weapon) > 0 Then              If b < 1 Then                Call PlayerMsg(Index, "You have no room in your inventory.", BrightRed)                Exit Sub              End If            End If          End If        End If        ' class requirement        If Item(itemnum).ClassReq > 0 Then          If Not GetPlayerClass(Index) = Item(itemnum).ClassReq Then            PlayerMsg Index, "You do not meet the class requirement to equip this item.", BrightRed            Exit Sub          End If        End If        ' access requirement        If Not GetPlayerAccess(Index) >= Item(itemnum).AccessReq Then          PlayerMsg Index, "You do not meet the access requirement to equip this item.", BrightRed          Exit Sub        End If>!         SetPlayerEquipment Index, itemnum, Weapon        PlayerMsg Index, "You equip " & CheckGrammar(Item(itemnum).Name), BrightGreen        TakeInvItem Index, itemnum, 1        If Item(itemnum).isDagger Then          If GetPlayerEquipment(Index, Shield) > 0 Then            If GetPlayerEquipment(Index, Weapon) > 0 Then              If Item(GetPlayerEquipment(Index, Weapon)).isDagger Then                GiveInvItem Index, GetPlayerEquipment(Index, Shield), 0                SetPlayerEquipment Index, itemnum, Shield              Else                GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0                SetPlayerEquipment Index, itemnum, Weapon              End If            Else              SetPlayerEquipment Index, itemnum, Weapon            End If          Else            If GetPlayerEquipment(Index, Weapon) > 0 Then              If Item(GetPlayerEquipment(Index, Weapon)).isDagger Then                GiveInvItem Index, GetPlayerEquipment(Index, Shield), 0                SetPlayerEquipment Index, itemnum, Shield              Else                GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0                SetPlayerEquipment Index, itemnum, Weapon              End If            Else              SetPlayerEquipment Index, itemnum, Weapon            End If          End If        ElseIf Item(itemnum).isTwoHanded Then          If GetPlayerEquipment(Index, Shield) > 0 Then            If GetPlayerEquipment(Index, Weapon) > 0 Then              GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0              GiveInvItem Index, GetPlayerEquipment(Index, Shield), 0              SetPlayerEquipment Index, 0, Shield              SetPlayerEquipment Index, itemnum, Weapon            Else              GiveInvItem Index, GetPlayerEquipment(Index, Shield), 0              SetPlayerEquipment Index, 0, Shield              SetPlayerEquipment Index, itemnum, Weapon            End If          Else            If GetPlayerEquipment(Index, Weapon) > 0 Then              GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0              SetPlayerEquipment Index, itemnum, Weapon            Else              SetPlayerEquipment Index, itemnum, Weapon            End If          End If        Else          If GetPlayerEquipment(Index, Shield) > 0 Then            If GetPlayerEquipment(Index, Weapon) > 0 Then              GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0              SetPlayerEquipment Index, itemnum, Weapon            Else              SetPlayerEquipment Index, itemnum, Weapon            End If          Else            If GetPlayerEquipment(Index, Weapon) > 0 Then              GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0              SetPlayerEquipment Index, itemnum, Weapon            Else              SetPlayerEquipment Index, itemnum, Weapon            End If          End If        End If>!         Call SendWornEquipment(Index)        Call SendMapEquipment(Index)        ' send vitals        Call SendVital(Index, Vitals.HP)        Call SendVital(Index, Vitals.MP)        ' send vitals to party if in one        If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index        ' send the sound        SendPlayerSound Index, GetPlayerX(Index), GetPlayerY(Index), SoundEntity.seItem, itemnum>! ```>! ```Case ITEM_TYPE_SHIELD        ' stat requirements        For i = 1 To Stats.Stat_Count - 1          If GetPlayerRawStat(Index, i) < Item(itemnum).Stat_Req(i) Then            PlayerMsg Index, "You do not meet the stat requirements to equip this item.", BrightRed            Exit Sub          End If        Next        ' level requirement        If GetPlayerLevel(Index) < Item(itemnum).LevelReq Then          PlayerMsg Index, "You do not meet the level requirement to equip this item.", BrightRed          Exit Sub        End If        ' class requirement        If Item(itemnum).ClassReq > 0 Then          If Not GetPlayerClass(Index) = Item(itemnum).ClassReq Then            PlayerMsg Index, "You do not meet the class requirement to equip this item.", BrightRed            Exit Sub          End If        End If        ' access requirement        If Not GetPlayerAccess(Index) >= Item(itemnum).AccessReq Then          PlayerMsg Index, "You do not meet the access requirement to equip this item.", BrightRed          Exit Sub        End If>!         If GetPlayerEquipment(Index, Shield) > 0 Then          tempItem = GetPlayerEquipment(Index, Shield)        End If>!         SetPlayerEquipment Index, itemnum, Shield        PlayerMsg Index, "You equip " & CheckGrammar(Item(itemnum).Name), BrightGreen        TakeInvItem Index, itemnum, 1        If GetPlayerEquipment(Index, Weapon) > 0 Then          If Item(GetPlayerEquipment(Index, Weapon)).isTwoHanded Then            GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0            SetPlayerEquipment Index, 0, Weapon          End If        End If>!         If tempItem > 0 Then          GiveInvItem Index, tempItem, 0 ' give back the stored item          tempItem = 0        End If        ' send vitals        Call SendVital(Index, Vitals.HP)        Call SendVital(Index, Vitals.MP)        ' send vitals to party if in one        If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index>!         Call SendWornEquipment(Index)        Call SendMapEquipment(Index)        ' send the sound        SendPlayerSound Index, GetPlayerX(Index), GetPlayerY(Index), SoundEntity.seItem, itemnum>! ``` Link to comment Share on other sites More sharing options...
tslusny Posted June 18, 2012 Author Share Posted June 18, 2012 Above this:PlayerMsg Index, "You equip " & CheckGrammar(Item(itemnum).Name), BrightGreenRemove this:SetPlayerEquipment Index, itemnum, WeaponAnd in shield case replace this:If GetPlayerEquipment(Index, Weapon) > 0 Then          If Item(GetPlayerEquipment(Index, Weapon)).isTwoHanded Then            GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0            SetPlayerEquipment Index, 0, Weapon          End If        End If        If tempItem > 0 Then          GiveInvItem Index, tempItem, 0 ' give back the stored item          tempItem = 0        End IfWith this:If GetPlayerEquipment(Index, Weapon) > 0 Then          If Item(GetPlayerEquipment(Index, Weapon)).isTwoHanded Then            GiveInvItem Index, GetPlayerEquipment(Index, Weapon), 0            SetPlayerEquipment Index, 0, Weapon  Else            If tempItem > 0 Then              GiveInvItem Index, tempItem, 0 ' give back the stored item              tempItem = 0            End If          End If        End If I thin thiw will fix all i must add it to tutorial Link to comment Share on other sites More sharing options...
Domino_ Posted June 18, 2012 Share Posted June 18, 2012 Now works fine, thanks. :)) Link to comment Share on other sites More sharing options...
tslusny Posted June 18, 2012 Author Share Posted June 18, 2012 Added to tutorial :D Link to comment Share on other sites More sharing options...
chamster Posted July 22, 2012 Share Posted July 22, 2012 I found an bug? When a dagger is equipped into the shield slot, and you log out, and you log back in the dagger is gone, cannot be found in inventory either… Link to comment Share on other sites More sharing options...
tslusny Posted July 22, 2012 Author Share Posted July 22, 2012 @chamster:> I found an bug? When a dagger is equipped into the shield slot, and you log out, and you log back in the dagger is gone, cannot be found in inventory either…Weird i look at that Link to comment Share on other sites More sharing options...
chamster Posted July 22, 2012 Share Posted July 22, 2012 @Deathbeam:> Weird i look at thatk thanks, :) Link to comment Share on other sites More sharing options...
zarz02 Posted August 1, 2012 Share Posted August 1, 2012 @chamster:> I found an bug? When a dagger is equipped into the shield slot, and you log out, and you log back in the dagger is gone, cannot be found in inventory either…Before I add this code, was this ever fixed? Link to comment Share on other sites More sharing options...
TheLordOfTheManor Posted August 27, 2012 Share Posted August 27, 2012 > Before I add this code, was this ever fixed?Wondering that too. Link to comment Share on other sites More sharing options...
Dawntide Posted August 27, 2012 Share Posted August 27, 2012 I don't think so. There are only a few tutorials which are getting updated and fixed. Most of them stay bugged, because the thread creator does not care. Link to comment Share on other sites More sharing options...
TheLordOfTheManor Posted August 28, 2012 Share Posted August 28, 2012 > I don't think so. There are only a few tutorials which are getting updated and fixed. Most of them stay bugged, because the thread creator does not care.I wonder if there is a working version of this. But I can't seem to find one. Hopefully someone comes along and fixes it. Link to comment Share on other sites More sharing options...
or3o Posted August 28, 2012 Share Posted August 28, 2012 Im gonna try to fix it and release a working tutorial today, the way i have it planned might make it a little longer of a tutorial but at least it will be done right. Link to comment Share on other sites More sharing options...
TheLordOfTheManor Posted August 28, 2012 Share Posted August 28, 2012 > Im gonna try to fix it and release a working tutorial today, the way i have it planned might make it a little longer of a tutorial but at least it will be done right.If you can then thank you. I would really like that code. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) 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