Snoozey Posted April 24, 2012 Author Share Posted April 24, 2012 Looking to modify spawn item sub. I would like it to check the players level. If the player is 5 levels over the monster level, it will not drop an item. I am assuming this is the code I will need to change```Sub SpawnItem(ByVal itemnum As Long, ByVal ItemVal As Long, ByVal mapNum As Long, ByVal x As Long, ByVal y As Long, Optional ByVal playerName As String = vbNullString) Dim i As Long ' Check for subscript out of range If itemnum < 1 Or itemnum > MAX_ITEMS Or mapNum <= 0 Or mapNum > MAX_MAPS Then Exit Sub End If ' Find open map item slot i = FindOpenMapItemSlot(mapNum) Call SpawnItemSlot(i, itemnum, ItemVal, mapNum, x, y, playerName)End Sub```I think this is the code I need to add for it to check, but I get an error " expected then or goto" and then it highlights NPC``` if player(index).Level =< 5 npc(index).Level then"Spawn code"else exit subendif```Any ideas? Still learning how to do this. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted April 24, 2012 Share Posted April 24, 2012 Don't modify that code. (That's unrelated to the if statement syntax error which you got.)This piece of code is called in many places for various reasons. It's called for spawning map items and player drops. Don't assume any system can be changed without changing others. Here's the NPC drop code:``` Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y```So you could write:```If Abs(Player(attacker).Level - Npc(npcNum).Level) <= 5 Then ' above codeEnd If```But please do not use Exit Sub here! You will royally mess up your server. Link to comment Share on other sites More sharing options...
Snoozey Posted April 25, 2012 Author Share Posted April 25, 2012 Thanks also works for exp :] 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