EOSERV Forum > EOSERV > map storm release updated12/28/10
Topic is locked.
Page: << 1 2 3 >>
map storm release updated12/28/10
Author Message
Post #56894 map storm release updated12/28/10

I thought you guys might like this as much as I do!


update 12/28/10 this is alot better than before edit with map editor no config

in map.cpp around line 360 under

this->pk = PacketProcessor::Number(buf[0]) == 3;

add


SAFE_SEEK(fh, 0x20, SEEK_SET);
SAFE_READ(buf, sizeof(char), 1, fh);
this->effect = PacketProcessor::Number(buf[0]);

in map.cpp under

void Map::Effect(int effect, int param)
{
    PacketBuilder builder;
    builder.SetID(PACKET_EFFECT, PACKET_USE);
    builder.AddChar(effect);
    builder.AddChar(param);

    UTIL_PTR_LIST_FOREACH(this->characters, Character, character)
    {
        character->player->client->SendBuilder(builder);
    }
}


add 


void Map::Storm()
{
PacketBuilder reply;
int x, x1, x2 ,x3, x4, x5, x6, x7, x8, y, y1, y2, y3,
y4, y5, y6, y7, y8, peram, d = 11;peram = util::rand(0, 8);

UTIL_PTR_LIST_FOREACH(this->characters, Character, character)
{
if (character->InRange(*character))
    {
x = util::rand(character->x - d, character->x + d);
x1= util::rand(character->x - d, character->x + d);
x2= util::rand(character->x - d, character->x + d);
x3= util::rand(character->x - d, character->x + d);
x4= util::rand(character->x - d, character->x + d);
x5= util::rand(character->x - d, character->x + d);
x6= util::rand(character->x - d, character->x + d);
x7= util::rand(character->x - d, character->x + d);
x8= util::rand(character->x - d, character->x + d);
 y= util::rand(character->y - d, character->y + d);
y1= util::rand(character->y - d, character->y + d);
y2= util::rand(character->y - d, character->y + d);
y3 = util::rand(character->y - d, character->y + d);
y4=util::rand(character->y - d, character->y + d);
y5 = util::rand(character->y - d, character->y + d);
y6=util::rand(character->y - d, character->y + d);
y7 = util::rand(character->y - d, character->y + d);
y8=util::rand(character->y - d, character->y + d);
reply.SetID(PACKET_EFFECT, PACKET_AGREE);
reply.AddChar(x );reply.AddChar(y );reply.AddShort(10);
reply.AddChar(x1);reply.AddChar(y1);reply.AddShort(10);
reply.AddChar(x2);reply.AddChar(y2);reply.AddShort(10);
reply.AddChar(x3);reply.AddChar(y3);reply.AddShort(17);
reply.AddChar(x4);reply.AddChar(y4);reply.AddShort(10);
reply.AddChar(x5);reply.AddChar(y5);reply.AddShort(10);
reply.AddChar(x6);reply.AddChar(y6);reply.AddShort(17);
reply.AddChar(x7);reply.AddChar(y7);reply.AddShort(10);
reply.AddChar(x8);reply.AddChar(y8);reply.AddShort(10);

character->player->client->SendBuilder(reply);
               }

           }

in map.hpp under public: find


bool pk;


add here


unsigned char effect;


in map.hpp find

       

void Effect(int effect, int param);


add here


void Storm();


in world.cpp find


void world_timed_save(void *world_void)
{
    World *world = static_cast<World *>(world_void);

    UTIL_PTR_VECTOR_FOREACH(world->characters, Character, character)
    {
        //character->Refresh();
        character->Save();
    }

    world->guildmanager->SaveAll();
}


add this here

void world_effect(void *world_void)// to do set up quake timers
{
  World *world = static_cast<World *>(world_void);

 UTIL_PTR_VECTOR_FOREACH(world->maps, Map, map)
   {

  int p = util::rand(0, 1); int p1 = util::rand(0, 2);
  int p2 = util::rand(3, 4); int p3 = util::rand(6, 8);
 if(map->effect == 3)
{
    map->Effect(1, p);
        }
  if(map->effect == 4)
{
    map->Effect(1, p1);
        }
  if(map->effect == 5)
{
    map->Effect(1, p2);
        }
if(map->effect == 6)
{
    map->Effect(1, p3);
        }
if(map->effect == 7)
{
    map->Storm();
        }
    }
}


if (this->config["MapStorm"])
    {
 event = new TimeEvent(world_effect, this, static_cast<double>(this->config["MapStorm"]), Timer::FOREVER);
    this->timer.Register(event);
    event->Release();
    }



in your config.ini find


## TimedSave (number)
# How often to save all online characters
# Characters are still saved on logout
# Set to 0 to disable timed saves
TimedSave = 100

add above  TimedSave


## MapStorm (number)
# How storms effect maps
# Characters normal maps not effected
# Set to 0 to disable effects
MapStorm = 10


14 years, 19 weeks ago
Post #56918 Re: map storm release

I got this Error.


C:\Users\Alek\Desktop\trunk\src\util.hpp:1186: error: expected ';' before ')' token


there isn't a line 1186..

14 years, 19 weeks ago
Post #56919 Re: map storm release

ye ill post pics and about the error  it looks like util.hpp which this doesnt have anything to do with whats before that error ? maybe post the whole log, errors and warns! It changes to there is like 10 different patterns that it does!


14 years, 19 weeks ago
Post #56920 Re: map storm release

That's all it said after I compiled :X..

14 years, 19 weeks ago
Post #56921 Re: map storm release

I have no clue on the error because usually the errors dont point to the problem but when it compiles it shows what its compiling so just  see what the last thing it compiles before the error is and post that

14 years, 19 weeks ago
Post #56925 Re: map storm release

Wow thanks for posting this i was going to make something like this.


Just one suggestion if you don't mind ... you should make it so you can change the effects for different maps.

---
http://www.torn.com/478456
14 years, 19 weeks ago
Post #56926 Re: map storm release

nice release insomniac~

14 years, 19 weeks ago
Post #56934 Re: map storm release

Should we enter this into the ugliest code of the year. You could have more easily done this simply by using the map effect parameter (not a whole config file for storms listing maps). Once you have decided on a value for storms that isn't currently taken by quakes or map drains, you can then add a simple timer into world.cpp that will produce lightning on a random x/y within the map size.

I understand what you have written was a nice attempt and apparently you have put a lot of time into writing code, but I think you need to revise this code quite a bit as the result you seek is far to easy to produce with way less code. This is not the kind of release you offer people to use, it is the kind you ask people to fix/improve.

14 years, 19 weeks ago
Post #56937 Re: map storm release


A bit of harsh criticism there =\ Apo....

this is kinda cool release....

 

---
"With your feet steady and firm on the ground soar high and ignore limitations"  -Bladex
EOSERV Class : Pixel Artist, Grammar Nazi, Server Owner, Mapping Artist, Server Coder, Test Player,
The Game Maker
14 years, 19 weeks ago
Post #56938 Re: map storm release

It is pretty ugly, and when i do post the stuff i hope people revise it! It didnt take much time i just had the idea did it and it worked and thought people might want to use it. I will revise it and release finished storm. The main thing i go for is "does it do what I want" yes it doesI appreciate your input  Thanks apollo!!

14 years, 19 weeks ago
Post #56939 Re: map storm release


I compile it sucessfully with 0 error and work perfectly~really nice

Pic:

14 years, 19 weeks ago
Post #56946 Re: map storm release

This is how i would go about doing this. Also i verified it does work. This also doesn't require any outside configuration as it's how thunder should be and that's entirely random. There could be much more done to it to make it only trigger the thunder on random maps or what ever else could be thought of. This way is just so much less code and seems more logical based on real nature :P. Also this checks so it doesn't cast on a wall, chair, etc tile.


You can get it here :)


Taking it all from the top this is how you would implement it.


In map.cpp under:

void Map::Effect(int effect, int param)
{
    PacketBuilder builder;
    builder.SetID(PACKET_EFFECT, PACKET_USE);
    builder.AddChar(effect);
    builder.AddChar(param);

    UTIL_PTR_LIST_FOREACH(this->characters, Character, character)
    {
        character->player->client->SendBuilder(builder);
    }
}


Add:

This


In map.hpp find:

void Effect(int effect, int param);


Add:

void Storm();


In world.cpp under:

void world_timed_save(void *world_void)
{
    World *world = static_cast<World *>(world_void);

    UTIL_PTR_VECTOR_FOREACH(world->characters, Character, character)
    {
        //character->Refresh();
        character->Save();
    }

    world->guildmanager->SaveAll();
}


Add:

void world_storm(void *world_void)
{
    World *world = static_cast<World *>(world_void);

    UTIL_PTR_VECTOR_FOREACH(world->maps, Map, map)
    {
        map->Storm();
    }
}


In world.cpp under:

TimeEvent *event = new TimeEvent(world_spawn_npcs, this, 1.0, Timer::FOREVER);
    this->timer.Register(event);
    event->Release();


Add:

event = new TimeEvent(world_storm, this, 10.00, Timer::FOREVER);
    this->timer.Register(event);
    event->Release();


And that should be it :). Credits to this topic owner for parts of the code as i merely rewrote the base Storm() method in the map class.


Edit: Also sorry i cant help the odd lines on this post :/

---
¨°º¤ø„º°¨ Exile Studios ¨°º„ø¤º°¨
14 years, 18 weeks ago
Post #56956 Re: map storm release

In map.cpp around line 360:

find: SAFE_SEEK(fh, 0x20, SEEK_SET);

SAFE_READ(buf, sizeof(char), 1, fh);

add this on the line below:

this->mapeffect = PacketProcessor::Number(buf[0]);

in world.cpp within your function and within a foreach map loop add this in addition to your effect packet:

if (map->mapeffect == 7)

{

*effect packet and random x,y shit goes here

}

Now all you need to do is set the map effect parameter to 7 with the map editor of your choosing.
K, you try :P

14 years, 18 weeks ago
Post #56966 Re: map storm release


You reckon you can add a none buggy damage with the effects aswell? cause whenever i try to add it it goes 0 then bugs th hp so whenever a effect touches a player it damages them too =\

---
"With your feet steady and firm on the ground soar high and ignore limitations"  -Bladex
EOSERV Class : Pixel Artist, Grammar Nazi, Server Owner, Mapping Artist, Server Coder, Test Player,
The Game Maker
14 years, 18 weeks ago
Post #56968 Re: map storm release

I like the Idea of the Config File. Exiles release has it on every map. it would be nice to have it only on sertin maps

14 years, 18 weeks ago
Page: << 1 2 3 >>
Topic is locked.
EOSERV Forum > EOSERV > map storm release updated12/28/10