Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 12:12

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]Materials NPC's Related to Buying & Upgrading House for 5165

Discussion on [Release]Materials NPC's Related to Buying & Upgrading House for 5165 within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old 02/01/2010, 03:12   #16
 
elite*gold: 0
Join Date: Aug 2005
Posts: 96
Received Thanks: 25
Quote:
Originally Posted by pro4never View Post
Yuppp, that's a function that lets you do the same thing over and over without having to write the entire code required. Think about the additem void. Instead of having to go through all the steps of creating a new item, you have a function that does it for you using simple input such as item Id, +, -, sockets, etc.

What this does is gets an input of the id to find and returns the count of it in the players inventory. The 'genius' of the way he wrote it is you have the base item Id for ores and then each loop (the while loop) it adds the loop count to the end of it thus searching for a different kind of ore each time and then returns how many their are. If there are enough it does a similar loop to delete them from the players inventory.

Hope that helps a bit. @ original npc, good job! Nice to see people contributing.
Awsome, thanks for the explanation, thats exactly what I was wanting to get it to do. Thanks to both of you for your help.
HardNotTo is offline  
Old 02/01/2010, 03:57   #17
 
elite*gold: 0
Join Date: Aug 2005
Posts: 96
Received Thanks: 25
Ok, just put in his code and it works, but I have two things wrong with it.
1. It does not count the Rate1 CopperOres
2. Now it requires 12 Ores(correct), but it only removes 5 of them from the inventory and replaces them with the correct number of Vouchers.

Not sure if this helps but there are only 10 different CopperOres listed in order from 1072020 to 1072029
HardNotTo is offline  
Old 02/01/2010, 04:01   #18
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
byte count = 1;

Change that to 0, that should help (assuming the first copper ore is 1072020 instead of 1072021.

totalcount += GC.MyChar.InventoryItemIDCount((uint)(1072020 + count));

That's saying it's using 1072020 + whatever loop number it is on to check for items in inventory. with count being initially 1 it will only go up from 1072021 (thus not counting the rate 1 ores)


Do the same fix to the removal and that may fix some of your problems.
pro4never is offline  
Thanks
1 User
Old 02/01/2010, 05:27   #19
 
elite*gold: 0
Join Date: Aug 2005
Posts: 96
Received Thanks: 25
ok i got it to count the Rate1 Copper, thanks

now for the removal i changed:

count = 1; this bit has me stuck I know that at count = 1; it removes 5 of the 12 Ores. changed to: count = 0; and now it removes 10 of the 12 Ores, then just to test something I changed it to: count = 12; and it didn't remove any Ores, but did give the Vouchers.
while (count != 13 && othercount != 12)
{
GC.MyChar.RemoveItem(GC.MyChar.NextItem((uint)(107 2020 + count)));
count++;
othercount++;

Well, after trying different things, nothing working, I will give up for the night and try again tomorrow. I could take the easy way out and have it require only 10 CopperOres, but then I wouldn't be learning anything. So maybe something will come to me while I sleep.
HardNotTo is offline  
Old 02/01/2010, 05:58   #20
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
I think you may need to get a new remove item void. My suspicion (without having used lotf) is that it's just going ahead and removing the ores even if they aren't properly in your inventory.

You might need something similar to the count item id fucntion he posted basically doing a loop through inventory counting up ores of 1 type, removing them and then subtracting how many more ores need to be removed from the inventory and moving on to the next one.
pro4never is offline  
Old 02/01/2010, 09:04   #21
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
I guess it's my fault that it wasn't counting all ores... I'm not sure how many rate of ores are there 10 or 12?
-impulse- is offline  
Old 02/01/2010, 14:49   #22
 
elite*gold: 0
Join Date: Aug 2005
Posts: 96
Received Thanks: 25
Quote:
Originally Posted by -impulse- View Post
I guess it's my fault that it wasn't counting all ores... I'm not sure how many rate of ores are there 10 or 12?
there are 10
HardNotTo is offline  
Old 02/01/2010, 17:46   #23
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
alright then let me rewrite the code :X

PHP Code:
else if (Control == 3)
                                    {
                                        
byte[] contains = new byte[10];
                                        
byte totalcount 0;
                                        
byte othercount 0;
                                        
byte count 0;
                                        while (
count != 10)
                                        {
                                            
contains[count] += GC.MyChar.InventoryItemIDCount((uint)(1072020 count));
                                            
totalcount += GC.MyChar.InventoryItemIDCount((uint)(1072020 count));
                                            
count++;
                                        }
                                        if (
totalcount >= 12)
                                        {
                                            
count 0;
                                            while (
count != 10 && othercount != 12)
                                            {
                                                while (
contains[count] != && othercount != 12)
                                                {
                                                    
GC.MyChar.RemoveItem(GC.MyChar.NextItem((uint)(1072020 count)));
                                                    
othercount++;
                                                    
contains[count]--;
                                                }
                                                
count++;
                                            }
                                            for (
int i 010i++)
                                                
GC.MyChar.AddItem(721175);
                                            
GC.AddSend(Packets.NPCSay("Congragulation you have 10 Copper Ore Voucher for 12 Any Rate Copper Ores."));
                                            
GC.AddSend(Packets.NPCLink("OK Thx"255));
                                            
GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("Sorry you dont have 12 Any Rate Copper Ores."));
                                            
GC.AddSend(Packets.NPCLink("OK i see."255));
                                            
GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                    } 
This should work...It was like removing one of 1 type... never 2 of 1 type
-impulse- is offline  
Thanks
1 User
Old 02/01/2010, 18:43   #24
 
elite*gold: 0
Join Date: Aug 2005
Posts: 96
Received Thanks: 25
Quote:
Originally Posted by -impulse- View Post
alright then let me rewrite the code :X

PHP Code:
else if (Control == 3)
                                    {
                                        
byte[] contains = new byte[10];
                                        
byte totalcount 0;
                                        
byte othercount 0;
                                        
byte count 0;
                                        while (
count != 10)
                                        {
                                            
contains[count] += GC.MyChar.InventoryItemIDCount((uint)(1072020 count));
                                            
totalcount += GC.MyChar.InventoryItemIDCount((uint)(1072020 count));
                                            
count++;
                                        }
                                        if (
totalcount >= 12)
                                        {
                                            
count 0;
                                            while (
count != 10 && othercount != 12)
                                            {
                                                while (
contains[count] != && othercount != 12)
                                                {
                                                    
GC.MyChar.RemoveItem(GC.MyChar.NextItem((uint)(1072020 count)));
                                                    
othercount++;
                                                    
contains[count]--;
                                                }
                                                
count++;
                                            }
                                            for (
int i 010i++)
                                                
GC.MyChar.AddItem(721175);
                                            
GC.AddSend(Packets.NPCSay("Congragulation you have 10 Copper Ore Voucher for 12 Any Rate Copper Ores."));
                                            
GC.AddSend(Packets.NPCLink("OK Thx"255));
                                            
GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                        else
                                        {
                                            
GC.AddSend(Packets.NPCSay("Sorry you dont have 12 Any Rate Copper Ores."));
                                            
GC.AddSend(Packets.NPCLink("OK i see."255));
                                            
GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                            
GC.AddSend(Packets.NPCFinish());
                                        }
                                    } 
This should work...It was like removing one of 1 type... never 2 of 1 type
that fixed it...works perfectly...thank you both for helping me with this.

Updated first post with this fix and gave credit to you.
HardNotTo is offline  
Reply


Similar Threads Similar Threads
[Tiny-Release] Buying Attribute Points! 5165 Source...
01/21/2010 - CO2 PServer Guides & Releases - 18 Replies
#REMOVED! I MADE AN ALL-IN-ONE THREAD ABOUT IT! #Request Close
[Release] Birth-Island NPC's! 5165 Source...
01/21/2010 - CO2 PServer Guides & Releases - 5 Replies
#REMOVED! I MADE AN ALL-IN-ONE THREAD ABOUT IT! #Request Close
Guide: Building and Upgrading a House
05/04/2009 - CO2 Guides & Templates - 7 Replies
Conquer Online House Guide By Kastoli TQ has provided Conquer players with a guide to building and upgrading a house. Although, the TQ guide is badly written and hard to understand. That’s why I made this guide, to make the lives of all EPvPers easier. Building your House It is advised that you have multiple characters logged in mining with one character running back a forward collecting and exchanging ores. Ores are the main component to creating a house; you require 2500 ore to...
Kojan House Materials Guide
03/06/2007 - General Gaming Discussion - 0 Replies
Kojani Style, Single Story, Thatched Roof, Type 48. Sandstone Housing Brick x100 Soapstone Cornerstone x1 Rotwort Mortar x10 Standard Wood Panels x20 Standard Wood Housing Beams x20 Iron Fastners x6 Firegrass Window Coverings x10 Firegrass Thatch x20



All times are GMT +1. The time now is 12:12.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.