Weather in 5520+

11/03/2011 23:27 abdeen#1
Okay , so i am trying to make its night , i coded it to Rain , Snow , Rain Wind and Blowing Cotton and its working fine , but i don't know how to make it`s Night

any help ?
11/03/2011 23:45 Spirited#2
That's not the weather system, that's the sky color system.
11/03/2011 23:52 abdeen#3
Quote:
Originally Posted by Fаng View Post
That's not the weather system, that's the sky color system.
oh , you are right , i forgot about that. Lol

how to make its night tho bro ?
11/04/2011 00:19 Sp!!ke#4
night it's just a screen color...if you will search here will got night ^ day system released
11/04/2011 00:25 -Sensei-#5
Code:
        public void Nighttime()
        {
            ScreenColor = 5855577;

            Network.GamePackets.Data Packet = new Network.GamePackets.Data(true);
            Packet.UID = Entity.UID;
            Packet.ID = 104;
            Packet.dwParam = ScreenColor;
            foreach (GameState pclient in ServerBase.Kernel.GamePool.Values)
            {
                pclient.Send(Packet);
            }
        }
11/04/2011 01:17 abdeen#6
thanks -Sensei- , i`ll try it .
Edit :

what the property stub for screencolor , and

an object reference is required for the nonstatic field method or property
for Entity.UID

Edit :

i made it :

PHP Code:
public uint ScreenColor getset; } 
is this correct ?


now i am getting this

an object reference is required for the nonstatic field method or property
for Entity.UID
11/04/2011 01:44 -Sensei-#7
Quote:
Originally Posted by abdeen View Post
thanks -Sensei- , i`ll try it .
Edit :

what the property stub for screencolor , and

an object reference is required for the nonstatic field method or property
for Entity.UID

Edit :

i made it :

PHP Code:
public uint ScreenColor getset; } 
is this correct ?


now i am getting this

an object reference is required for the nonstatic field method or property
for Entity.UID
Hey that wont work.

Set a time when will be night. like;
Code:
                    if (DateTime.Now.Hour == 00 && DateTime.Now.Minute == 0)
                    {
                        foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                        {

                            try
                            {
                                clients.Nighttime();
11/04/2011 01:54 abdeen#8
Quote:
Originally Posted by -Sensei- View Post
Hey that wont work.

Set a time when will be night. like;
Code:
                    if (DateTime.Now.Hour == 00 && DateTime.Now.Minute == 0)
                    {
                        foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values)
                        {

                            try
                            {
                                clients.Nighttime();
thanks , that`s what i did .

but i have these 4 errors
[Only registered and activated users can see links. Click Here To Register...]
11/04/2011 02:03 Spirited#9
You can't copy and paste it....
damn dude... think =|

You need to implement it using your own general data packet. It's not that difficult.
11/04/2011 02:06 abdeen#10
Quote:
Originally Posted by Fаng View Post
You can't copy and paste it....
damn dude... think =|

You need to implement it using your own general data packet. It's not that difficult.
Lol , i edited it already look here :

[Only registered and activated users can see links. Click Here To Register...]

but this problem i cant fix it without any help :P
11/04/2011 02:24 Spirited#11
You must not understand the code...
So let's go over it.

So you started by assigning ScreenColor with the integer 5855577. On the next line, you declared and assigned a new general data packet called Packet. Below that, you have your error. That line should assign the UID parameter in the packet with the character's uid (identity number). Let's get back to that later though and read on for now. So below the error line, you assign the type (id) with 104 (which is for Sky Color). After that line, you assign ScreenColor to dwParam (which is the first value parameter in the general data packet).

Then, you have the foreach loop. It states, for each client (which we'll name pclient) in the GamePool (a dictionary with all of your players in it), it will execute what's in brackets. Let's look at what's in the brackets:

So inside the brackets, you see that the server is sending the packet to the player's screen. So.... why are you trying to send the character's id up on the error line when you get the character's info down in the foreach statement?
11/04/2011 02:31 shadowman123#12
Abden Use it like that ..Client.Entity.UID; and Error will be removed
11/04/2011 02:32 Spirited#13
Quote:
Originally Posted by shadowman123 View Post
Abden Use it like that ..Client.Entity.UID; and Error will be removed
That would fix the syntax problem but it would create a very large semantic problem.
11/04/2011 03:27 pro4never#14
I weep....

Fang explained it properly. You should be assigning the uid for the packet based on the loop not based on a single player...
11/04/2011 12:07 nTL3fTy#15
Quote:
Originally Posted by pro4never View Post
I weep....

Fang explained it properly. You should be assigning the uid for the packet based on the loop not based on a single player...
Unless the method is inside of his player class, which he would then loop through the ingame players calling said method to change the map color.

Code:
public class Player
{
    public void ChangeToNightTime()
    {
        const uint COLOR_NIGHT = 0x595959;

        var packet = new Network.GamePackets.Data(true);
        packet.UID = Entity.UID;
        packet.ID = 104;
        packet.dwParam = COLOR_NIGHT;
        Send(Packet);
    }
}

...

foreach (var player in ServerBase.Kernel.GamePool.Values)
{
    player.ChangeToNightTime();
}