Scott Posted September 7, 2011 Author Share Posted September 7, 2011 100% Credit goes to Ballie I just fixed it, I take no credit for this code.Orignal:[http://www.touchofdeathforums.com/smf/index.php/topic,61133.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,61133.0.html)If you have done any part of the old tutorial start over fresh.Did it for my own project, figured I'd post it to save people some time. **Make sure you put both files from the zip in the client/src folder.Delete the old NPC data files!**In modType in both **CLIENT/SERVER** replace NpcRec with this one```Private Type NpcRec Name As String * NAME_LENGTH AttackSay As String * 100 Sound As String * NAME_LENGTH Sprite As Long SpawnSecs As Long Behaviour As Byte Range As Byte DropChance(1 To MAX_NPC_DROPS) As Double DropItem(1 To MAX_NPC_DROPS) As Byte DropItemValue(1 To MAX_NPC_DROPS) As Integer Stat(1 To Stats.Stat_Count - 1) As Byte HP As Long EXP As Long Animation As Long Damage As Long Level As LongEnd Type```In modConstants in both **CLIENT/SERVER** search```' General constants```Place this under that```Public Const MAX_NPC_DROPS As Byte = 10```**SERVER**Search in modCombat for```'Drop the goods if they get it```Delete``` n = Int(Rnd * Npc(npcNum).DropChance) + 1 If n = 1 Then Call SpawnItem(Npc(npcNum).DropItem, Npc(npcNum).DropItemValue, mapNum, MapNpc(mapNum).Npc(mapNpcNum).x, MapNpc(mapNum).Npc(mapNpcNum).y) End If```and replace it with``` For n = 1 To MAX_NPC_DROPS If Npc(NpcNum).DropItem(n) = 0 Then Exit For If Rnd <= Npc(NpcNum).DropChance(n) Then Call SpawnItem(Npc(NpcNum).DropItem(n), Npc(NpcNum).DropItemValue(n), MapNum, MapNpc(MapNum).Npc(mapNpcNum).x, MapNpc(MapNum).Npc(mapNpcNum).y) End If Next```**CLIENT**Search modGameEditors for``` .txtChance.text = CStr(Npc(EditorIndex).DropChance)```Delete``` .txtChance.text = CStr(Npc(EditorIndex).DropChance) .scrlNum.Value = Npc(EditorIndex).DropItem .scrlValue.Value = Npc(EditorIndex).DropItemValue```Replace with``` .txtChance.text = CStr(Npc(EditorIndex).DropChance(1)) .scrlNum.Value = Npc(EditorIndex).DropItem(1) .scrlValue.Value = Npc(EditorIndex).DropItemValue(1)```**The format for drop chance is .percent Example: .25 = 25% .16 = 16% 1 = 100% More than 1 = 100%**Pretty simple fix, I did not test it after I made it so let me know if there is any errors, forms are attached. Link to comment Share on other sites More sharing options...
Justn Posted September 7, 2011 Share Posted September 7, 2011 Can you tell me what you fixed? I used Ballie's tutorial awhile back and it seems to be working fine. Is there a bug or something? Link to comment Share on other sites More sharing options...
Scott Posted September 7, 2011 Author Share Posted September 7, 2011 @Justn:> Can you tell me what you fixed? I used Ballie's tutorial awhile back and it seems to be working fine. Is there a bug or something?Seemed to be from an older version1.NpcRec was missing the sound field2.Some variables where different in the drop loop, it also told you to put it in 2 place, there is only 1 now.3.Where it starts up the npc editor it was not treating DropChance, DropItem, DropItemValue as arrays which caused an error. Link to comment Share on other sites More sharing options...
Vus Posted September 9, 2011 Share Posted September 9, 2011 It says Compile error: Cant assign to array and marks: .DropItem = Link to comment Share on other sites More sharing options...
Scott Posted September 9, 2011 Author Share Posted September 9, 2011 @Vus:> It says Compile error: Cant assign to array and marks: .DropItem =I just installed this on a fresh copy of EO 2.0 works fine, you did something wrong. Seems like you skipped the last step or did not replace the form. Make sure you put both files from the zip in the client/src folder. Link to comment Share on other sites More sharing options...
Ansonla Posted September 10, 2011 Share Posted September 10, 2011 is there another way or tutorial to not replace the forms? Link to comment Share on other sites More sharing options...
Vus Posted September 10, 2011 Share Posted September 10, 2011 i solved this problem, but now, i have another one ^^because i have alatars quest system, i can not copy file you attached cuz it woudl not work, so i copied that fra drop (with codes) and now it gives this error:In scrlDrop_Change()**DropItem =** and says variable not defined Link to comment Share on other sites More sharing options...
Scott Posted September 10, 2011 Author Share Posted September 10, 2011 @Vus:> i solved this problem, but now, i have another one ^^> because i have alatars quest system, i can not copy file you attached cuz it woudl not work, so i copied that fra drop (with codes) and now it gives this error:> In scrlDrop_Change()> **DropItem =** and says variable not definedYou need to declare DropIndexAt the very top of frmEditor_NPC under ```Option Explicit```Add```Private DropIndex As Byte```@Ansonla:> is there another way or tutorial to not replace the forms?Yes, very easy to doNo tutorial though Link to comment Share on other sites More sharing options...
Vus Posted September 11, 2011 Share Posted September 11, 2011 thanks, so i solved this one and it says .DropItemValue = cant assign array :( Link to comment Share on other sites More sharing options...
Vus Posted September 14, 2011 Share Posted September 14, 2011 eh, *bump*?I really need to fix this, please help me :) Link to comment Share on other sites More sharing options...
Scott Posted September 15, 2011 Author Share Posted September 15, 2011 @Vus:> thanks, so i solved this one and it says .DropItemValue = cant assign array :(```.DropItemValue(DropIndex)``` Link to comment Share on other sites More sharing options...
Vus Posted September 15, 2011 Share Posted September 15, 2011 thank you very much :)now, i sucesfully compiled it and it seems to work ~~, but i cant attack NPC's, not even with spells.~~Edit: Fixed.Edit2: Drops wont save for me, i set it up, click save, but when i kill the npc it drops nothing and when i go to npc editor, settings for drops are blank :( Link to comment Share on other sites More sharing options...
Scott Posted September 15, 2011 Author Share Posted September 15, 2011 @Vus:> thank you very much :)> now, i sucesfully compiled it and it seems to work ~~, but i cant attack NPC's, not even with spells.~~> > Edit: Fixed.> > Edit2: Drops wont save for me, i set it up, click save, but when i kill the npc it drops nothing and when i go to npc editor, settings for drops are blank :(Pm me your source before you put this tutorial in I'll add it for you, other than that pretty hard to fix a problem with out seeing the code. Link to comment Share on other sites More sharing options...
Vus Posted September 16, 2011 Share Posted September 16, 2011 ok Link to comment Share on other sites More sharing options...
Ultrasnofire Posted September 21, 2011 Share Posted September 21, 2011 ok i just put this in my game and it wont let me attack any npc's at all even with spelss. how could i fix this? plz help Link to comment Share on other sites More sharing options...
Guest Posted September 21, 2011 Share Posted September 21, 2011 ~~I can't damage npcs >.<~~NvmUhmm posted above ^ you should use a new npc delete the existing npcs. Link to comment Share on other sites More sharing options...
Scott Posted September 21, 2011 Author Share Posted September 21, 2011 @Night~:> ~~I can't damage npcs >.<~~> Nvm> > Uhmm posted above ^ you should use a new npc delete the existing npcs.Ah yes sorry forgot to add that to the tutorial, added now thanks for the heads up! Link to comment Share on other sites More sharing options...
Vus Posted September 21, 2011 Share Posted September 21, 2011 yes, that was same thing as i had:~~but i cant attack NPC's, not even with spells.~~Edit: Fixed. Link to comment Share on other sites More sharing options...
Ultrasnofire Posted September 22, 2011 Share Posted September 22, 2011 ok i fixed that i can kill the npc's but now i have another problem. The npc's dont hurt you and whenever i modify the damage of the npc it resets to 0\. plz help Link to comment Share on other sites More sharing options...
Scott Posted September 23, 2011 Author Share Posted September 23, 2011 You messed something up can't really solve your problem like this. Link to comment Share on other sites More sharing options...
Ultrasnofire Posted September 24, 2011 Share Posted September 24, 2011 ok i reinstalled the mod and it is now fully fixed and works properly! Thanks very much for this.ultrasnofire Link to comment Share on other sites More sharing options...
LoneWolf Posted September 24, 2011 Share Posted September 24, 2011 I have the same problemcan't damage NPC Link to comment Share on other sites More sharing options...
Murdoc Posted September 24, 2011 Share Posted September 24, 2011 @LoneWolf:> I have the same problem> > can't damage NPCDelete existing npc's for this to work properly. The answer is in the thread already. Link to comment Share on other sites More sharing options...
Murdoc Posted September 24, 2011 Share Posted September 24, 2011 I added this to EO 2.0 and ive noticed that the it doesnt matter what the chance is set at, the items ALWAYS drop… also in the npc editor the 1st drop is saving , but not the second or third.. they reset when you exit out and go back into the editor. Im not sure if ive done something wrong or what. Link to comment Share on other sites More sharing options...
Spiked Posted September 24, 2011 Share Posted September 24, 2011 @Murdock:> I added this to EO 2.0 and ive noticed that the it doesnt matter what the chance is set at, the items ALWAYS drop… also in the npc editor the 1st drop is saving , but not the second or third.. they reset when you exit out and go back into the editor. Im not sure if ive done something wrong or what.I can't confirm the always drop thing, but I've set an item at item slot 2 and it saved from the npc. 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