Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Npc

Newbie Spellweaver
Joined
Aug 21, 2007
Messages
67
Reaction score
0
How can i make a NPC give u random CPS between 1000-3000 cps exemple...
Code:
[SIZE=2][COLOR=#800000]
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2][COLOR=#800000] (CurrentNPC == 80805)
{
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2][COLOR=#800000] (Control == 1)
{
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2][COLOR=#800000] (MyChar.InventoryContains(722302, 1))
{
MyChar.RemoveItem(MyChar.ItemNext(722302));
MyChar.CPs += 1000 - 3000;
SendPacket([/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]General[/COLOR][/SIZE][SIZE=2][COLOR=#800000].MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
}
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]else
[/COLOR][/SIZE][SIZE=2][COLOR=#800000]{
SendPacket([/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]General[/COLOR][/SIZE][SIZE=2][COLOR=#800000].MyPackets.NPCSay([/COLOR][/SIZE][SIZE=2][COLOR=#a31515]"You don't have a LuckyJade."[/COLOR][/SIZE][SIZE=2][COLOR=#800000]));
SendPacket([/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]General[/COLOR][/SIZE][SIZE=2][COLOR=#800000].MyPackets.NPCLink([/COLOR][/SIZE][SIZE=2][COLOR=#a31515]"Ok."[/COLOR][/SIZE][SIZE=2][COLOR=#800000], 255));
SendPacket([/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]General[/COLOR][/SIZE][SIZE=2][COLOR=#800000].MyPackets.NPCSetFace(30));
SendPacket([/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]General[/COLOR][/SIZE][SIZE=2][COLOR=#800000].MyPackets.NPCFinish());
}
}
}
[/COLOR][/SIZE]
Error:
Error 1 Constant value '-2000' cannot be converted to a 'uint' C:\Documents and Settings\Vali\Desktop\co-fortress\Steals Server Pack\Source\PowerSource CO\COServerProject1\COServerProject\Client.cs 1808 51 COServerProject


ERM SRY I PUT IT IN RELEASE SECTION I THOUGHT I WAS ON HELP SECTION MOVE PLZ
 
Elite Diviner
Joined
Jan 11, 2008
Messages
405
Reaction score
0
Im not sure and i dont think mods really care anymore i see alot of stuff that needs to be moved and they are not doing it
 
Newbie Spellweaver
Joined
Aug 13, 2008
Messages
34
Reaction score
0
Code:
                            if (CurrentNPC == 80805)
                            {
                                if (Control == 1)
                                {
                                    if (MyChar.InventoryContains(722302, 1))
                                    {
                                        MyChar.RemoveItem(MyChar.ItemNext(722302));
                                        [U]MyChar.CPs += (uint)General.Rand.Next(1000, 3000);[/U]
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
                                    }
                                    else
                                    {
                                        SendPacket(General.MyPackets.NPCSay("You don't have a LuckyJade."));
                                        SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                        SendPacket(General.MyPackets.NPCSetFace(30));
                                        SendPacket(General.MyPackets.NPCFinish());
                                    }
                                }
                            }
 
Newbie Spellweaver
Joined
Aug 21, 2007
Messages
67
Reaction score
0
I have another question:D,how do you make the NPC to tell you the number of CPS you have won because it's random win....
 
Newbie Spellweaver
Joined
Jan 1, 2008
Messages
98
Reaction score
0
1)
uint wincp = General.Rand.Next(1000, 3000);
MyChar.CPs += wincp
Just use NPC Say like normal and put into message "You have won "+wincp+" CP's"
like that :)
 
Newbie Spellweaver
Joined
Aug 21, 2007
Messages
67
Reaction score
0
1)
uint wincp = General.Rand.Next(1000, 3000);
MyChar.CPs += wincp
Just use NPC Say like normal and put into message "You have won "+wincp+" CP's"
like that :)
Woot it worked thanks 1000 times:D
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
19
Reaction score
0
Error 1 Cannot implicitly convert type 'int' to 'uint'. An explicit conversion exists (are you missing a cast?) C:\Steals Server Pack\Source\PowerSource CO\COServerProject1\COServerProject\Client.cs 2662 50 COServerProject


:S
 
Newbie Spellweaver
Joined
Aug 30, 2008
Messages
74
Reaction score
0
/dev/Null fixed the problem right?
If yes, Im going to use that too lawl
 
Newbie Spellweaver
Joined
Jun 30, 2008
Messages
19
Reaction score
0
Code:
uint wincp = General.Rand.Next(1000, 3000);
MyChar.CPs += wincp

this code should be

Code:
uint wincp = (uint) General.Rand.Next(1000, 3000);
MyChar.CPs += (uint) wincp

Shouldn't it? Otherwise you get the error I got before.

EDIT: Yes, this code works fine.
 
Newbie Spellweaver
Joined
Aug 13, 2008
Messages
34
Reaction score
0
Code:
uint wincp = General.Rand.Next(1000, 3000);
MyChar.CPs += wincp

this code should be

Code:
uint wincp = (uint) General.Rand.Next(1000, 3000);
MyChar.CPs += (uint) wincp

Shouldn't it? Otherwise you get the error I got before.

EDIT: Yes, this code works fine.

Use what keving provided if you need/want the NPC to report your winnings, otherwise use mine.
 
Back
Top