Richy420Rich Posted October 25, 2011 Author Share Posted October 25, 2011 Something quick I typed up tonight and figured I'd share it to those who wish to have it. Basically the way it is now, it'll scan through your item editor looking for all equipment for a player which is 5 levels higher then them via your items level requirement, it will also scan for that players class, and then it'll randomly select which equipment type to drop.Alright, I placed this code in modPlayer on server```Public Sub RareItem(Byval Index As Long, Byval PlayerLevel As Byte, Byval Class As Byte, Byval MapNum As Long, ByVal NPCx As Long, Byval NPCy As Long)Dim I As LongDim EquipType As LongDim Rarity As LongDim WeaponNum As LongDim HelmetNum As LongDim ArmorNum As LongDim ShieldNum As LongDim DropNum As Long 'Change this to a value you wish. Rarity = 69 'Add a > or < before the = if you want a better success rate drop. If Rand(1, 100) = Rarity Then 'Scanning item editor database For I = 1 To MAX_ITEMS 'Must meet these requirements to continue on If Len(Trim(Item(I).Name)) > 0 Then If (PlayerLevel + 5) = Item(I).LevelReq And Class = Item(I).ClassReq Then If Item(I).Type = ITEM_TYPE_WEAPON Or Item(I).Type = ITEM_TYPE_HELMET Or Item(I).Type = ITEM_TYPE_ARMOR Or Item(I).Type = ITEM_TYPE_SHIELD Then 'It'll find the item numbers for each equip type item available and record them in variables. Select Case Item(I).Type Case ITEM_TYPE_WEAPON WeaponNum = I Case ITEM_TYPE_HELMET HelmetNum = I Case ITEM_TYPE_ARMOR ArmorNum = I Case ITEM_TYPE_SHIELD ShieldNum = I End Select End If End If End If Next I DropNum = Rand(1, 4) 'Randomly drop the item of it's item type. Select Case DropNum Case 1 Call SpawnItem(WeaponNum, 1, MapNum, NPCx, NPCy) Case 2 Call SpawnItem(HelmetNum, 1, MapNum, NPCx, NPCy) Case 3 Call SpawnItem(ArmorNum, 1, MapNum, NPCx, NPCy) Case 4 Call SpawnItem(ShieldNum, 1, MapNum, NPCx, NPCy) End Select End IfEnd Sub```Then we just place this in PlayerAttackNPC, Look for this;```If n = 1 ThenCall SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapnum, MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y)End IfEnd IfEnd If```Underneath, put this in;```'Prevent camping on low level NPC's If Npc(npcNum).level >= GetPlayerLevel(Attacker) Then Call RareItem(Attacker, GetPlayerLevel(Attacker), GetPlayerClass(Attacker), mapnum, MapNpc(mapnum).Npc(mapNpcNum).x, MapNpc(mapnum).Npc(mapNpcNum).y) End If```Let me know if everything's cool with it if you try it.Credits aren't needed for this in any game project. Link to comment Share on other sites More sharing options...
Robin Posted October 25, 2011 Share Posted October 25, 2011 _Please_ nest your code properly. Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 25, 2011 Author Share Posted October 25, 2011 I thought it was. :(. What you mean? Link to comment Share on other sites More sharing options...
Carim123 Posted October 25, 2011 Share Posted October 25, 2011 Example```Select Case Index Case 1 PlayerMsg Index, "You are player number 1.", White Case 2 PlayerMsg Index, "You are player number 2.", White Case 3 PlayerMsg Index, "You are player number 3.", WhiteEnd Select```Use the tab key. Makes it WAY easier to read, and also makes it easier to think about how it'd work, and think about what runs when. Link to comment Share on other sites More sharing options...
Robin Posted October 25, 2011 Share Posted October 25, 2011 @Richy:> I thought it was. :(. What you mean?How could it be nested properly when you haven't nested a single line? Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 25, 2011 Author Share Posted October 25, 2011 Sorry I freetyped this cause my visual basic isn't letting me copy the code from inside of it for some unknown reason, and the tab key isn't gonna let me do it in this post so :(Well hell I learned something new today lol. I didn't think it really mattered. I'll copy and paste in notepad and nest it then. Link to comment Share on other sites More sharing options...
Robin Posted October 25, 2011 Share Posted October 25, 2011 Restart your computer. That isn't normal behaviour. Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 25, 2011 Author Share Posted October 25, 2011 Everything is cool with the code now I hope lol.Let me know if it's all good if anyone tries it out. Link to comment Share on other sites More sharing options...
Socuine Posted October 25, 2011 Share Posted October 25, 2011 Nest your code like HTMLlul. Link to comment Share on other sites More sharing options...
RyokuHasu Posted October 25, 2011 Share Posted October 25, 2011 @Glenn:> Nest your code like HTMLlul.that's a HORRIBLE example.a lot of HTML is nested in funny ways that don't apply to VB6. Link to comment Share on other sites More sharing options...
Socuine Posted October 25, 2011 Share Posted October 25, 2011 @Ryoku:> that's a HORRIBLE example.> > a lot of HTML is nested in funny ways that don't apply to VB6.Your lack sense of sarcasm pleases me.:> Link to comment Share on other sites More sharing options...
RyokuHasu Posted October 25, 2011 Share Posted October 25, 2011 >.> is that all you can do, be pleased and kiss ass? Link to comment Share on other sites More sharing options...
Socuine Posted October 26, 2011 Share Posted October 26, 2011 Your attempt at insulting does not pleases me.Really though, nesting makes your world easier. It's about convenience and overview. c(: Link to comment Share on other sites More sharing options...
Murdoc Posted October 26, 2011 Share Posted October 26, 2011 this is a nice feature to have.. thanks! Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 26, 2011 Author Share Posted October 26, 2011 No problem.@Glenn, I didn't even know what nesting meant until Serenade told me, Lol @ me with my fail of 'trying' to play off Robin;@Richy:> I thought it was. :(. What you mean?Though yes I'll make sure to nest anything from now on. I've already started in VB to do it but I still can't copy out of VB into notepad, wordpad or on the internet. Clipbook be saying that I ain't got enough memory like damn, my computer is starting a slow painful death. Link to comment Share on other sites More sharing options...
Socuine Posted October 26, 2011 Share Posted October 26, 2011 Ah okay, I understand. Well, now you do know what Nesting is. I'm pretty sure that when you nest, things are bound to be clear. 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