balliztik1 Posted June 5, 2010 Author Share Posted June 5, 2010 There were two things that bugged me about NPC item drops in Eclipse Origins. The first was the lack of multiple drops. That had been done in past Eclipse releases and seemed almost necessary to add in. The second has been present for as long as I can remember. I hate the "1 in X" drop chance, particularly because of its inaccuracy. It quickly jumps from 100% chance to 50% chance to 33.3% chance, with no option of between-values. I decided to rectify these two issues I had with a little bit of editing._This will require deleting all your NPCs unless you code a converter_**Client-Side**In modTypes, change the NpcRec to this:```Private Type NpcRec Name As String * NAME_LENGTH AttackSay As String * 100 Sprite As Integer 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 faction As Byte HP As Long EXP As Long Animation As LongEnd Type```Make sure to add this to modConstants as well:```Public Const MAX_NPC_DROPS As Byte = 10```Next, you'll need to download the attached form files and replace your old ones. If you've changed anything, you can just copy the new controls and code from that file.**Server-side**On the server-side, there's a few more changes. Firstly, do the same steps as above for modTypes and modConstants. Next, we change the logic statements. Find this line in modGameLogic:``` ' Drop the goods if they get it```Make the code underneath that look like so:``` For n = 1 To MAX_NPC_DROPS If Npc(vNpcNum).DropItem(n) = 0 Then Exit For If Rnd <= Npc(vNpcNum).DropChance(n) Then Call SpawnItem(Npc(vNpcNum).DropItem(n), Npc(vNpcNum).DropItemValue(n), MapNum, MapNpc(MapNum).Npc(Victim).x, MapNpc(MapNum).Npc(Victim).y) End If Next```You'll also find the same line in modPlayer:``` ' Drop the goods if they get it```Replace that code bit with this:``` 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```And that's all! This adds a couple new features to the NPC editor to comply with the changes.* The "Chance" box now accepts only a decimal value from 0 to 1\. You can enter fractional values as well, now. For instance, you can type "5/12" for a 5 of 12 chance, or "1/10" for a 1 of 10 chance. The number will auto-convert to decimal. Additionally, you can now use percentages. Entering "25%" for example will automatically convert to ".25".* There is now a scrollbar that determines which item drop to edit. The default maximum, as shown in the code above, is 10, but can be altered as you see fit. Marking any item number as 0 will cause the loop to exit when the NPC drop logic fires, so you cannot leave drops 1 and 2 blank and start with item drop 3, for example.Here's a little screenshot for those interested:![](http://beaubuckley.info/derrick/DropChanges.png) Link to comment Share on other sites More sharing options...
Anna Comnena Posted June 5, 2010 Share Posted June 5, 2010 Very cool, I like how robust it is with the user inputs. :) Link to comment Share on other sites More sharing options...
Im_Mad_1337 Posted June 13, 2010 Share Posted June 13, 2010 Thats awesome, if only I knew how to source edit :( what are those files in the attachments for? Link to comment Share on other sites More sharing options...
balliztik1 Posted June 13, 2010 Author Share Posted June 13, 2010 Those are the form files. To save you from having to reorganize, etc., you just download those and replace your old forms. Link to comment Share on other sites More sharing options...
Im_Mad_1337 Posted June 13, 2010 Share Posted June 13, 2010 @Ballie:> Those are the form files. To save you from having to reorganize, etc., you just download those and replace your old forms.So, if I were to download those and replace them with my old ones, then I wont need to do any of that editing? Link to comment Share on other sites More sharing options...
azure Posted June 13, 2010 Share Posted June 13, 2010 The forms are for the graphical/in game chance editing. If you don't do the code edits they won't work properly and will most likely crash the engine.(probably needs confirmation, though I wouldn't care to.) Link to comment Share on other sites More sharing options...
Im_Mad_1337 Posted June 13, 2010 Share Posted June 13, 2010 That sucks XD I'm completely horrible at scripting, I can't read any of it, and I can't source edit at all. I don't even have VB6 or whatever you use for it.Edit: Replacing those files doesn't change anything at all if you don't do all the work above. I wish he would put the edited files as attachments, but if I ask, I'd feel like a total ass. Link to comment Share on other sites More sharing options...
Joyce Posted June 13, 2010 Share Posted June 13, 2010 Even if he added the edited files it'd do nothing unless compiled with VB6. Link to comment Share on other sites More sharing options...
balliztik1 Posted June 13, 2010 Author Share Posted June 13, 2010 Edited files or not, if you don't have VB6, this isn't going to be compilable. Plus, since this is a third party edit, and a new Origins release is potentially coming out soon, compiling these edits into new executables would only benefit people for a couple days. Then, they'd be left with non-transferable items for the new version. Link to comment Share on other sites More sharing options...
Im_Mad_1337 Posted June 13, 2010 Share Posted June 13, 2010 @YamYam:> Even if he added the edited files it'd do nothing unless compiled with VB6.Yea, I just realized that, I'ma dumbass o.0 I wish I knew where to get VB6\. I just don't feel like paying for it, and can't find any free downloads. Link to comment Share on other sites More sharing options...
Robin Posted June 13, 2010 Share Posted June 13, 2010 @Im_Mad_1337:> and can't find any free downloads.Then you're not looking hard enough. Link to comment Share on other sites More sharing options...
Im_Mad_1337 Posted June 13, 2010 Share Posted June 13, 2010 @Robin:> Then you're not looking hard enough.Yea, I know, I just found one. Link to comment Share on other sites More sharing options...
Ertzel Posted July 4, 2010 Share Posted July 4, 2010 whenever I try to compile the client, I get this errorin modGameEditors, under Public Sub NpcEditorInit()``` .txtChance.text = CStr(Npc(EditorIndex).DropChance)``` Link to comment Share on other sites More sharing options...
Ertzel Posted July 7, 2010 Share Posted July 7, 2010 anyone know how to fix the problem posted above? Link to comment Share on other sites More sharing options...
The New World Posted July 7, 2010 Share Posted July 7, 2010 ~~For one you're missing a parentheses. ;D ~~Misread D: Going to bed. Gl. Link to comment Share on other sites More sharing options...
Ertzel Posted July 8, 2010 Share Posted July 8, 2010 Ok, I tried commenting out the dropChance line and running the compile, and then it gives me an the Type Missmatch error in these two parts also..```Private Type NpcRec DropItem(1 To MAX_NPC_DROPS) As Byte DropItemValue(1 To MAX_NPC_DROPS) As IntegerEnd Type``` Link to comment Share on other sites More sharing options...
GoldenTot Posted July 9, 2010 Share Posted July 9, 2010 @Ertzel:> whenever I try to compile the client, I get this error> in modGameEditors, under Public Sub NpcEditorInit()> ```> .txtChance.text = CStr(Npc(EditorIndex).DropChance)> ```I'm having this exact problem. ;_; Link to comment Share on other sites More sharing options...
The New World Posted July 10, 2010 Share Posted July 10, 2010 I went through, had to highlight + right click the .DropChance and click definition. And change it's type. Even though it'll give you the same error for .DropChance and all the .*etc* below it in the sub. So you have to change all their types. :[If this doesn't work, download the files, open them in a new project, and edit your code accordingly. Link to comment Share on other sites More sharing options...
aaaron Posted July 10, 2010 Share Posted July 10, 2010 @Rose:> I went through, had to highlight + right click the .DropChance and click definition. And change it's type. Even though it'll give you the same error for .DropChance and all the .*etc* below it in the sub. So you have to change all their types. :[> > If this doesn't work, download the files, open them in a new project, and edit your code accordingly.what she said.. Link to comment Share on other sites More sharing options...
DJMaxus Posted July 11, 2010 Share Posted July 11, 2010 @Ertzel:> whenever I try to compile the client, I get this error> in modGameEditors, under Public Sub NpcEditorInit()> ```> .txtChance.text = CStr(Npc(EditorIndex).DropChance)> ```In NpcEditorInit()Underneath "**Dim i As Long**" Add:```Dim DropIndex As Long```Underneath "**EditorIndex = frmEditor_NPC.lstIndex.ListIndex + 1**" Add:```DropIndex = frmEditor_NPC.scrlDrop.Value```Then replace:```.txtChance.text = CStr(Npc(EditorIndex).DropChance) .scrlNum.Value = Npc(EditorIndex).DropItem .scrlValue.Value = Npc(EditorIndex).DropItemValue```With:```.txtChance.text = CStr(Npc(EditorIndex).DropChance(DropIndex)) .scrlNum.Value = Npc(EditorIndex).DropItem(DropIndex) .scrlValue.Value = Npc(EditorIndex).DropItemValue(DropIndex)```Go into the frmEditor_NPC and search for "Private Sub scrlNum_Change()"Underneath it Add:```DropIndex = scrlDrop.Value```And do the same for "Private Sub scrlValue_Change()"This should fix the Mismatch error, as well as the Subscript out of range error you would receive from adding the DropIndex. Link to comment Share on other sites More sharing options...
adr990 Posted July 12, 2010 Share Posted July 12, 2010 DJMaxus you're the best. :D Thanks for this fix, keep it up!Ballie this is the best drop script ever seen on Eclipse. I'm p. sure. It does %'s and 1/10 14/20 everything.Thanks! Link to comment Share on other sites More sharing options...
MrAvi Posted July 15, 2010 Share Posted July 15, 2010 @DJMaxus:> @Ertzel:> > > whenever I try to compile the client, I get this error> > in modGameEditors, under Public Sub NpcEditorInit()> > ```> > .txtChance.text = CStr(Npc(EditorIndex).DropChance)> > ```> > In NpcEditorInit()> > Underneath "**Dim I As Long**" Add:> ```> Dim DropIndex As Long> ```> Underneath "**EditorIndex = frmEditor_NPC.lstIndex.ListIndex + 1**" Add:> ```> DropIndex = frmEditor_NPC.scrlDrop.Value> ```> Then replace:> ```> .txtChance.text = CStr(Npc(EditorIndex).DropChance)> .scrlNum.Value = Npc(EditorIndex).DropItem> .scrlValue.Value = Npc(EditorIndex).DropItemValue> ```> With:> > ```> .txtChance.text = CStr(Npc(EditorIndex).DropChance(DropIndex))> .scrlNum.Value = Npc(EditorIndex).DropItem(DropIndex)> .scrlValue.Value = Npc(EditorIndex).DropItemValue(DropIndex)> ```> Go into the frmEditor_NPC and search for "Private Sub scrlNum_Change()"> Underneath it Add:> ```> DropIndex = scrlDrop.Value> ```And do the same for "Private Sub scrlValue_Change()"> > This should fix the Mismatch error, as well as the Subscript out of range error you would receive from adding the DropIndex.Doesn´t work, it gives an error at:```DropIndex = frmEditor_NPC[b].scrlDrop[/b].Value```(At .scrlDrop) Link to comment Share on other sites More sharing options...
Robin Posted July 15, 2010 Share Posted July 15, 2010 You haven't added the scrollbar to the form then. Link to comment Share on other sites More sharing options...
MrAvi Posted July 15, 2010 Share Posted July 15, 2010 @Robin:> You haven't added the scrollbar to the form then.You mean```DropIndex = scrlDrop.Value ```? Because i actually did. Link to comment Share on other sites More sharing options...
Robin Posted July 15, 2010 Share Posted July 15, 2010 No, you haven't added the actual scrollbar. 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