Ne-o-x Posted July 25, 2011 Share Posted July 25, 2011 So, can someone convert this to EO 2.0?Many thanks. Link to comment Share on other sites More sharing options...
tsuki Posted July 25, 2011 Share Posted July 25, 2011 @Robin:> It works fine in EOv2\. You just need to find a different line of code instead of the one provided to get to the npc drop bit in AttackNpc. Link to comment Share on other sites More sharing options...
hedgy Posted July 29, 2011 Share Posted July 29, 2011 @Rawrz: Try to search for 'Drop the goods if they get itinstead ;)I'm still getting the error atNpc(EditorIndex).DropChance(DropIndex) = 0:S Link to comment Share on other sites More sharing options...
Olimar72 Posted August 18, 2011 Share Posted August 18, 2011 Great tutorial, just what I've been looking for. When I compile Client, it shoots out this error: Link to comment Share on other sites More sharing options...
Robin Posted August 18, 2011 Share Posted August 18, 2011 You need to _not_ overwrite the UDT. The one in the tutorial is old. Simply rip the specific changes. Link to comment Share on other sites More sharing options...
Olimar72 Posted August 18, 2011 Share Posted August 18, 2011 OK, so I fixed my previous problem (Thanks Robin). Now I'm getting "at 'Npc(EditorIndex).DropItem = scrlNum.Value' can't assign to array". So I know I need to declare it as an array, but how would I do that? I kinda know how to declare them, but I'm not sure how to change the expression to declare it as an array, rather than a variable. And yes, I did try Googling. Link to comment Share on other sites More sharing options...
Warden Posted September 3, 2011 Share Posted September 3, 2011 yay,i got it working for EOv2 ,it rocks,thank you :) Link to comment Share on other sites More sharing options...
Scott Posted September 7, 2011 Share Posted September 7, 2011 @Olimar72:> OK, so I fixed my previous problem (Thanks Robin). Now I'm getting "at 'Npc(EditorIndex).DropItem = scrlNum.Value' can't assign to array". So I know I need to declare it as an array, but how would I do that? I kinda know how to declare them, but I'm not sure how to change the expression to declare it as an array, rather than a variable. And yes, I did try Googling.```Npc(EditorIndex).DropItem(DropIndex) = scrlNum.Value```You need to set which item you are editing now that there is more than 1.For this mod in modType you edit NpcRec to change 3 fields```DropChance As LongDropItem As LongDropItemValue As Long```to```DropChance(1 To MAX_NPC_DROPS) As DoubleDropItem(1 To MAX_NPC_DROPS) As ByteDropItemValue(1 To MAX_NPC_DROPS) As Integer```so if you already did that, your arrays are declared already.If you look at the top of modType you will see this```Public Npc(1 To MAX_NPCS) As NpcRec```This declares an array of objects with all of NpcRec's variables, it's an exact copy of NpcRec so when you edited NpcRec you changed the 3 variables across the whole script to be arrays. **Fixed version here: [http://www.touchofdeathforums.com/smf/index.php/topic,75169.0.html](http://www.touchofdeathforums.com/smf/index.php/topic,75169.0.html)** Link to comment Share on other sites More sharing options...
lordlego Posted November 8, 2011 Share Posted November 8, 2011 @Ballie:> 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 Long> End 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> ```i can not find that bit plz help :mad:> 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...
lordlego Posted November 8, 2011 Share Posted November 8, 2011 @hedgy:> @Rawrz: Try to search for > 'Drop the goods if they get it> instead ;)> cheers> > I'm still getting the error at> Npc(EditorIndex).DropChance(DropIndex) = 0> :S 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