EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::General Support (https://www.eqemulator.org/forums/forumdisplay.php?f=598)
-   -   Weather Question (https://www.eqemulator.org/forums/showthread.php?t=41684)

ChaosSlayerZ 01-09-2018 01:15 PM

Weather Question
 
Looking at zone table in DB I noticed that there are 4 different chances for rain/snow.
Could someone tell me what does this mean? Are these 4 different types of rain that can happen? Like how strong it is?
And apparently it can Snow in Gfay? =)

Also, there are 4 different types of Fog setting - why 4? How do they combine with each other?

Thank You so much!

Maze_EQ 01-09-2018 02:07 PM

Check the source.

Coenxai 01-09-2018 08:20 PM

If I recall it selects one of the four "chances" and then performs a roll against that selected chance or something super weird?

Edit: On quick glance that's how it appears? There may be further reasoning though. I have always have had my weather/sky off :P

ChaosSlayerZ 01-19-2018 10:18 AM

Ok guys, so I am looking at
https://github.com/EQEmu/Server/blob...one/zonedb.cpp

I see this:

for (index = 0; index < 4; index++) {
zone_data->fog_red[index] = atoi(row[1 + index * 5]);
zone_data->fog_green[index] = atoi(row[2 + index * 5]);
zone_data->fog_blue[index] = atoi(row[3 + index * 5]);
zone_data->fog_minclip[index] = atof(row[4 + index * 5]);
zone_data->fog_maxclip[index] = atof(row[5 + index * 5]);
}


So are we combing different fog values together? Why, whats the significance? I noticed that for pretty much ALL zones all 4 fog values are the same.
Thanks!

Uleat 01-19-2018 12:12 PM

https://github.com/EQEmu/Server/blob...structs.h#L347

Each of those properties is a array of 4 indices.

So you would get:
Code:

zone_data->fog_red[0] = atoi(row[1]);
zone_data->fog_red[1] = atoi(row[6]);
zone_data->fog_red[2] = atoi(row[11]);
zone_data->fog_red[3] = atoi(row[16]);

..by looping like that.

ChaosSlayerZ 01-19-2018 12:22 PM

Ok so we got those values.
But what does this mean in game?
If my fog RGB is set to 255 0 0 - its red right?
But then if fog1 and fog2 is set to something else - whats the end effect? Because I was changing values back and forth and I can't seem to notice any difference.

Also - multiple fog maxclips confusing me...

Uleat 01-19-2018 12:54 PM

Pretty sure they correspond to the weather system..but, that's only a guess from me - I've been wrong many times before :P

https://github.com/EQEmu/Server/blob...20_Weather.sql


EDIT: I meant to include this too: https://github.com/EQEmu/Server/blob...zone.cpp#L1301

Just shows that weather takes on one of four states, then intensity is applied for rain/snow.

ChaosSlayerZ 01-20-2018 06:38 PM

Thank you for your reply Uleat!
I trying hard to test the intensity but not sure how to force the client to show me different intensity for rain/snow.

I have tried to force this with a quest script like:



sub EVENT_SAY {

if($text=~/hail/i)
{quest::say("bla bla $name - $zoneweather");
}

if($text=~/rain/i)
{quest::say("bla bla $name - RAIN HARDER! $zoneweather");

quest::rain($zoneweather+5); }

if($text=~/snow/i)
{quest::say("bla bla $name - SNOW HARDER! $zoneweather");

quest::snow($zoneweather+5);}

}

I THINK its working - as I see snowflakes flying faster, but I can't say that I notice any changes on fog levels.


Also, by chance is zone clip exposed to Perl script?
I am asking because we have gm command #zclip, having it accessible via Perl function would be nice - we could then create Fog weather effect by lowering the clipplane.

Uleat 01-20-2018 07:37 PM

I definitely don't know enough about that to even make an educated guess...

I did see, in that function, that intensity seems to be its own value (1 - 10) and not part of the (0 - 3) array that controls which of the weather chances are used.

I'll keep my eyes open for any documentation concerning this.

ChaosSlayerZ 01-20-2018 08:53 PM

Thank you Uleat!

Kingly_Krab 01-20-2018 10:07 PM

You can modify weather and stuff in Perl using quest::UpdateZoneHeader(ID, value).

Code:

void QuestManager::UpdateZoneHeader(std::string type, std::string value) {
    if (strcasecmp(type.c_str(), "ztype") == 0)
        zone->newzone_data.ztype = atoi(value.c_str());
    else if (strcasecmp(type.c_str(), "fog_red") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.fog_red[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "fog_green") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.fog_green[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "fog_blue") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.fog_blue[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "fog_minclip") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.fog_minclip[i] = atof(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "fog_maxclip") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.fog_maxclip[i] = atof(value.c_str());
        }
    }
    else if (strcasecmp(type.c_str(), "gravity") == 0)
        zone->newzone_data.gravity = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "time_type") == 0)
        zone->newzone_data.time_type = atoi(value.c_str());
    else if (strcasecmp(type.c_str(), "rain_chance") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.rain_chance[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "rain_duration") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.rain_duration[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "snow_chance") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.snow_chance[i] = atoi(value.c_str());
        }
    } else if (strcasecmp(type.c_str(), "snow_duration") == 0) {
        for (int i = 0; i < 4; i++) {
            zone->newzone_data.snow_duration[i] = atoi(value.c_str());
        }
    }
    else if (strcasecmp(type.c_str(), "sky") == 0)
        zone->newzone_data.sky = atoi(value.c_str());
    else if (strcasecmp(type.c_str(), "safe_x") == 0)
        zone->newzone_data.safe_x = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "safe_y") == 0)
        zone->newzone_data.safe_y = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "safe_z") == 0)
        zone->newzone_data.safe_z = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "max_z") == 0)
        zone->newzone_data.max_z = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "underworld") == 0)
        zone->newzone_data.underworld = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "minclip") == 0)
        zone->newzone_data.minclip = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "maxclip") == 0)
        zone->newzone_data.maxclip = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "fog_density") == 0)
        zone->newzone_data.fog_density = atof(value.c_str());
    else if (strcasecmp(type.c_str(), "suspendbuffs") == 0)
        zone->newzone_data.SuspendBuffs = atoi(value.c_str());

    auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
    memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
    entity_list.QueueClients(0, outapp);
    safe_delete(outapp);
}


ChaosSlayerZ 01-20-2018 10:51 PM

Kingly_Krab thank you very much for sharing this.
I just need a little bit more help translating this into plain English =)
Lets say I only want to alter clip plan (not entire zone header) in real time how do I pass it my quest npc that tracks weather?

so I put
quest::UpdateZoneHeader(maxclip, 300)
into npc script, where ID and value can be my clipplane?

and then I have
void QuestManager::UpdateZoneHeader(std::string type, std::string value)
as independent function, right?

PS wanted to add that I don't see UpdateZoneHeader on official Perl functions list:
http://wiki.eqemulator.org/p?Ultimat...rence&frm=Main

Kingly_Krab 01-20-2018 11:28 PM

It's not on the official list because it's undocumented (my fault). But all you need to do is put the following in a quest file:
Code:

quest::UpdateZoneHeader("maxclip", 300);

ChaosSlayerZ 01-21-2018 12:58 AM

Thank you so much! You have no idea how many issues this solves for me! ;)

ChaosSlayerZ 01-21-2018 04:52 PM

Another question for today
Playing around with fog color - I want to make bright yellow fog - using 255 255 0 does give me yellow color but it is still very dark with sky 0.
Any idea how to get bright yellow fog?


All times are GMT -4. The time now is 05:45 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.