![]() |
Npc's Drop Multiple Items - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: Npc's Drop Multiple Items (/showthread.php?tid=2394) |
Npc's Drop Multiple Items - DarkX - 22-11-2008 Ok the server side works in MS4 but I had to leave for work so I wasn't able to test out the client side, but I installed it, and it does work in MS3.0.3, and MSEbuild1 so, here's the code. And yes I think someone else did one of these tutorials on the old forums but, I did not see it posted on here. Server Side Add this to SendEditNpcTo after the other drop chances Code: & SEP_CHAR & Npc(NpcNum).DropChance2 & SEP_CHAR & Npc(NpcNum).DropItem2 & SEP_CHAR & Npc(NpcNum).DropItemValue2 & SEP_CHAR & Npc(NpcNum).DropChance3 & SEP_CHAR & Npc(NpcNum).DropItem3 & SEP_CHAR & Npc(NpcNum).DropItemValue3 & SEP_CHAR & Npc(NpcNum).DropChance4 & SEP_CHAR & Npc(NpcNum).DropItem4 & SEP_CHAR & Npc(NpcNum).DropItemValue4 & SEP_CHAR & Npc(NpcNum).DropChance5 & SEP_CHAR & Npc(NpcNum).DropItem5 & SEP_CHAR & Npc(NpcNum).DropItemValue5 Code: DropChance2 As Integer Code: Npc(n).DropChance2 = Val(Parse(11)) Code: ' Drop the goods if they get it Now to the Client Side Add this to handleupdatenpc Code: Npc(n).DropChance2 = 0 Code: Npc(n).DropChance2 = Val(Parse(11)) Code: & SEP_CHAR & Npc(NpcNum).DropChance2 & SEP_CHAR & Npc(NpcNum).DropItem2 & SEP_CHAR & Npc(NpcNum).DropItemValue2 & SEP_CHAR & Npc(NpcNum).DropChance3 & SEP_CHAR & Npc(NpcNum).DropItem3 & SEP_CHAR & Npc(NpcNum).DropItemValue3 & SEP_CHAR & Npc(NpcNum).DropChance4 & SEP_CHAR & Npc(NpcNum).DropItem4 & SEP_CHAR & Npc(NpcNum).DropItemValue4 & SEP_CHAR & Npc(NpcNum).DropChance5 & SEP_CHAR & Npc(NpcNum).DropItem5 & SEP_CHAR & Npc(NpcNum).DropItemValue5 Code: DropChance2 As Integer Code: frmNpcEditor.txtChance2.Text = Str(Npc(EditorIndex).DropChance2) Code: Npc(EditorIndex).DropChance2 = Val(frmNpcEditor.txtChance2.Text) Now this makes it so that if any of the items that are on the same chance # like item 1 & 2 are set to chance 1 out of 2 and then 3, 4, 5 are set to a diffrent number it will drop the 2 at the number it gets first, so some updating might need to be done to it a little later on. hope this works if not let me know and I'll try to figure it out. To make this work for MSE and 3.0.3 just copy and change the save and load code in save and loadnpc. Re: Npc's Drop Multiple Items - Matt - 23-11-2008 You should do this with an array. It'd be much more optimized. Re: Npc's Drop Multiple Items - DarkX - 23-11-2008 I am not sure how to work with arrays but I am going to convert it to use with's when I get home to speed it up a little. Re: Npc's Drop Multiple Items - Matt - 23-11-2008 Just learn to use an array. DropItem(1 to 3) as byte (I think..) Re: Npc's Drop Multiple Items - DarkX - 23-11-2008 I googled it and here's what I came up with is that what your thinking of? http://visualbasic.freetutes.com/learn-vb6/lesson6.html Re: Npc's Drop Multiple Items - Robin - 23-11-2008 DarkX Wrote:I googled it and here's what I came up with is that what your thinking of? Obviously. Re: Npc's Drop Multiple Items - DarkX - 23-11-2008 I'll get to working on it tonight, and try to convert to arrays Re: Npc's Drop Multiple Items - skillzalot - 19-01-2009 Did this ever get update to arrays and is it still usable with the new ms4 Re: Npc's Drop Multiple Items - deathknight - 19-01-2009 This is all serverside, but it looks like it should still work with MS4. All it does is create a bunch of new values in the NPC file, so if you use this you'll either have to put something in to add in those blank values, or delete all your NPC files. You'll also have to do clientside, which shouldn't be too hard. It would mainly just be adding in a bunch of scrollbars, etc, to the NPC editor, then having the values sent to the server when you save then NPC. |