Mirage Source http://miragesource.net/forums/ |
|
Npc's Drop Multiple Items http://miragesource.net/forums/viewtopic.php?f=183&t=4774 |
Page 1 of 66 |
Author: | DarkX [ Sat Nov 22, 2008 5:14 pm ] |
Post subject: | Npc's Drop Multiple Items |
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 then add this to the npc rec Code: DropChance2 As Integer DropItem2 As Byte DropItemValue2 As Integer DropChance3 As Integer DropItem3 As Byte DropItemValue3 As Integer DropChance4 As Integer DropItem4 As Byte DropItemValue4 As Integer DropChance5 As Integer DropItem5 As Byte DropItemValue5 As Integer then add to HandleSaveNpc Code: Npc(n).DropChance2 = Val(Parse(11)) Npc(n).DropItem2 = Val(Parse(12)) Npc(n).DropItemValue2 = Val(Parse(13)) Npc(n).DropChance3 = Val(Parse(14)) Npc(n).DropItem3 = Val(Parse(15)) Npc(n).DropItemValue3 = Val(Parse(16)) Npc(n).DropChance4 = Val(Parse(17)) Npc(n).DropItem4 = Val(Parse(18)) Npc(n).DropItemValue4 = Val(Parse(19)) Npc(n).DropChance5 = Val(Parse(20)) Npc(n).DropItem5 = Val(Parse(21)) Npc(n).DropItemValue5 = Val(Parse(22)) Add this to attacknpc Code: ' Drop the goods if they get it n = Int(Rnd * Npc(NpcNum).DropChance2) + 1 If n = 1 Then Call SpawnItem(Npc(NpcNum).DropItem2, Npc(NpcNum).DropItemValue2, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) End If ' Drop the goods if they get it n = Int(Rnd * Npc(NpcNum).DropChance3) + 1 If n = 1 Then Call SpawnItem(Npc(NpcNum).DropItem3, Npc(NpcNum).DropItemValue3, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) End If ' Drop the goods if they get it n = Int(Rnd * Npc(NpcNum).DropChance4) + 1 If n = 1 Then Call SpawnItem(Npc(NpcNum).DropItem4, Npc(NpcNum).DropItemValue4, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) End If ' Drop the goods if they get it n = Int(Rnd * Npc(NpcNum).DropChance5) + 1 If n = 1 Then Call SpawnItem(Npc(NpcNum).DropItem5, Npc(NpcNum).DropItemValue5, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) End If Thats all server side Now to the Client Side Add this to handleupdatenpc Code: Npc(n).DropChance2 = 0 Npc(n).DropItem2 = 0 Npc(n).DropItemValue2 = 0 Npc(n).DropChance3 = 0 Npc(n).DropItem3 = 0 Npc(n).DropItemValue3 = 0 Npc(n).DropChance4 = 0 Npc(n).DropItem4 = 0 Npc(n).DropItemValue4 = 0 Npc(n).DropChance5 = 0 Npc(n).DropItem5 = 0 Npc(n).DropItemValue5 = 0 Then add this to handleeditnpc Code: Npc(n).DropChance2 = Val(Parse(11)) Npc(n).DropItem2 = Val(Parse(12)) Npc(n).DropItemValue2 = Val(Parse(13)) Npc(n).DropChance3 = Val(Parse(14)) Npc(n).DropItem3 = Val(Parse(15)) Npc(n).DropItemValue3 = Val(Parse(16)) Npc(n).DropChance4 = Val(Parse(17)) Npc(n).DropItem4 = Val(Parse(18)) Npc(n).DropItemValue4 = Val(Parse(19)) Npc(n).DropChance5 = Val(Parse(20)) Npc(n).DropItem5 = Val(Parse(21)) Npc(n).DropItemValue5 = Val(Parse(22)) Add this to sendsavenpc 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 Add this to NpcRec Code: DropChance2 As Integer DropItem2 As Byte DropItemValue2 As Integer DropChance3 As Integer DropItem3 As Byte DropItemValue3 As Integer DropChance4 As Integer DropItem4 As Byte DropItemValue4 As Integer DropChance5 As Integer DropItem5 As Byte DropItemValue5 As Integer Add this to Npceditorinit Code: frmNpcEditor.txtChance2.Text = Str(Npc(EditorIndex).DropChance2) frmNpcEditor.scrlNum2.Value = Npc(EditorIndex).DropItem2 frmNpcEditor.scrlValue2.Value = Npc(EditorIndex).DropItemValue2 frmNpcEditor.txtChance3.Text = Str(Npc(EditorIndex).DropChance3) frmNpcEditor.scrlNum3.Value = Npc(EditorIndex).DropItem3 frmNpcEditor.scrlValue3.Value = Npc(EditorIndex).DropItemValue3 frmNpcEditor.txtChance4.Text = Str(Npc(EditorIndex).DropChance4) frmNpcEditor.scrlNum4.Value = Npc(EditorIndex).DropItem4 frmNpcEditor.scrlValue4.Value = Npc(EditorIndex).DropItemValue4 frmNpcEditor.txtChance5.Text = Str(Npc(EditorIndex).DropChance5) frmNpcEditor.scrlNum5.Value = Npc(EditorIndex).DropItem5 frmNpcEditor.scrlValue5.Value = Npc(EditorIndex).DropItemValue5 Add this to npceditorok Code: Npc(EditorIndex).DropChance2 = Val(frmNpcEditor.txtChance2.Text) Npc(EditorIndex).DropItem2 = frmNpcEditor.scrlNum2.Value Npc(EditorIndex).DropItemValue2 = frmNpcEditor.scrlValue2.Value Npc(EditorIndex).DropChance3 = Val(frmNpcEditor.txtChance3.Text) Npc(EditorIndex).DropItem3 = frmNpcEditor.scrlNum3.Value Npc(EditorIndex).DropItemValue3 = frmNpcEditor.scrlValue3.Value Npc(EditorIndex).DropChance4 = Val(frmNpcEditor.txtChance4.Text) Npc(EditorIndex).DropItem4 = frmNpcEditor.scrlNum4.Value Npc(EditorIndex).DropItemValue4 = frmNpcEditor.scrlValue4.Value Npc(EditorIndex).DropChance5 = Val(frmNpcEditor.txtChance5.Text) Npc(EditorIndex).DropItem5 = frmNpcEditor.scrlNum5.Value Npc(EditorIndex).DropItemValue5 = frmNpcEditor.scrlValue5.Value Then make duplicates of each of the drop things in the npceditor. 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. |
Author: | Matt [ Sun Nov 23, 2008 5:40 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
You should do this with an array. It'd be much more optimized. |
Author: | DarkX [ Sun Nov 23, 2008 6:47 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
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. |
Author: | Matt [ Sun Nov 23, 2008 7:12 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
Just learn to use an array. DropItem(1 to 3) as byte (I think..) |
Author: | DarkX [ Sun Nov 23, 2008 8:58 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
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 |
Author: | Robin [ Sun Nov 23, 2008 9:33 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
DarkX wrote: 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 Obviously. |
Author: | DarkX [ Sun Nov 23, 2008 10:30 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
I'll get to working on it tonight, and try to convert to arrays |
Author: | skillzalot [ Mon Jan 19, 2009 3:34 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
Did this ever get update to arrays and is it still usable with the new ms4 |
Author: | deathknight [ Mon Jan 19, 2009 9:30 pm ] |
Post subject: | Re: Npc's Drop Multiple Items |
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. |
Author: | wanai [ Fri Dec 31, 2021 7:24 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
XVII |
Author: | wanai [ Fri Dec 31, 2021 7:25 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
69.4 |
Author: | wanai [ Fri Dec 31, 2021 7:26 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Bett |
Author: | wanai [ Fri Dec 31, 2021 7:27 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Bett |
Author: | wanai [ Fri Dec 31, 2021 7:28 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Jack |
Author: | wanai [ Fri Dec 31, 2021 7:29 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Cent |
Author: | wanai [ Fri Dec 31, 2021 7:31 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Line |
Author: | wanai [ Fri Dec 31, 2021 7:32 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
XVII |
Author: | wanai [ Fri Dec 31, 2021 7:33 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Paul |
Author: | wanai [ Fri Dec 31, 2021 7:34 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Gold |
Author: | wanai [ Fri Dec 31, 2021 7:35 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Stor |
Author: | wanai [ Fri Dec 31, 2021 7:36 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Atla |
Author: | wanai [ Fri Dec 31, 2021 7:37 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Tesc |
Author: | wanai [ Fri Dec 31, 2021 7:38 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Luck |
Author: | wanai [ Fri Dec 31, 2021 7:39 am ] |
Post subject: | Re: Npc's Drop Multiple Items |
Fisk |
Page 1 of 66 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |