weapon effects repost
no credits for me just reposting so you have access to ananas weapon effect system! If you look at his original topic that he deleted for unknown reasons he said he didnt want credits either well he got um from me heres his guide..
Lets start with npc.cpp.
------------------------
Search for;
-----------
bool NPC::Walk(Direction direction)
{
return this->map->Walk(this, direction);
}
Place below that;
-----------------
void NPC::Effect(Character *from, int effect, int damage)
{
UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character)
{
PacketBuilder builder;
builder.SetID(PACKET_SPELLATT, PACKET_REPLY);
builder.AddShort(effect);
builder.AddShort(from->player->id);
builder.AddChar(from->player->character->direction);
builder.AddShort(this->index);//NPC map index number
// builder.AddThree(damage);
builder.AddShort(int(double(this->hp) / double(this->Data()->hp) * 100.0));
builder.AddShort(0);
if (character->InRange(this))
{
character->player->client->SendBuilder(builder);
}
}
}
Done with npc.cpp!
-----------------------------------------
Go to npc.hpp
-------------
Search for;
-----------
void Die(bool show = true);
Place below that;
-----------------
void Effect(Character *from, int effect, int damage);
Done with npc.hpp!
------------------
Now.. if you don't got the spells in your server etc. then you would need to add the packets (PACKET_SPELLATT)
Open packet.hpp
---------------
Search for;
-----------
PACKET_BOARD = 43,
Place below that;
-----------------
PACKET_SPELLATT = 44,
Nice! Done with packet.hpp.
Now! we go to world.cpp.
------------------------
Search for;
-----------
this->home_config.Read(this->config["HomeFile"]);
Place below that;
-----------------
this->effects_config.Read(this->config["EffectsFile"]);
Then search at the rehash() for;
----------------
this->home_config.Read(this->config["HomeFile"]);
Place below that;
-----------------
this->effects_config.Read(static_cast<std::string>(this->config["EffectsFile"]));
Done with world.cpp!
--------------------
Go to world.hpp
----------------
Search for;
-----------
Config home_config;
Add below that;
---------------
Config effects_config;
----------------------
Done with world.hpp.
--------------------
Go to your config.ini and search for;
-------------------------------------
## HomeFile (string)
# Spawn point and innkeeper data
HomeFile = ./data/home.ini
Add below that;
----------------
## Effects1File (string)
# Weapon Effects1 file
Effects1File = ./data/effects1.ini
Done with the config.ini!
-------------------------
Now go to your data folder and create an effects.ini
And fill it with the following file;
# Ananas his Weapon Effects #
# Goes like;
# (number).ItemID = (ItemID)
# (number).EffectID = (EffectID)
# (number).PlayerEffect = (EffectID)
#
#
# 1 = Small heal effect
# 2 = Small Heal Effect
# 3 = Small Heal Effect
# 4 = Small Fire
# 5 = Small Thunder
# 6 = Small Heal Effect
# 7 = Small Heal Effect
# 8 = Small Heal Effect
# 9 = Ultima Blast
# 10 = Fire from the sky
# 11 = Shield Effect
# 12 = Shield Effect
# 13 = Fire Ring
# 14 = Blizzard
# 15 = Energy Ball
# 16 = Tornado
# 17 = Small Fire
# 18 = Protection
# 19 = Boulders
# 20 = Admin Heal
# 21 = Ice from the sky
# 22 = Darkness Beam
# 23 = Darkness Hand
# 24 = Darkness Skull
# 25 = Fire Explosion
# 26 = Vines
# 27 = Darkness Wind
# 28 = Blue Magic Whirl
# 29 = Darkness Bite
# 30 = Shell
# 31 = Green Flame
# 32 = Spark
WAmount = 4
#Dagger doing energy ball
1.ItemID = 21
1.EffectID = 15
1.PlayerEffect = 27
#Gun doing explosion
2.ItemID = 365
2.EffectID = 13
2.PlayerEffect = 31
#Gun doing explosion
3.ItemID = 543
3.EffectID = 21
3.PlayerEffect = 27
Gun doing explosion
4.ItemID = 30
4.EffectID = 4
4.PlayerEffect = 17
Done!
-----
Now we go to map.cpp
And we search for;
------------------
npc->Damage(from, amount);
Add ABOVE that add;
---------------
int itemid, effectid;
for(int i = 0 ; i < static_cast<int>(this->world->effects_config["WAmount"]) ; i++){
itemid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".ItemID"]);
effectid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".EffectID"]);
if(from->paperdoll[Character::Weapon] == itemid){
npc->Effect(from, effectid, amount);
}
}
Now we search for;
------------------
character_ptr->hp -= limitamount;
Add BELOW that;
---------------
int itemid, effectid;
for(int i = 0 ; i < static_cast<int>(this->world->effects_config["WAmount"]) ; i++){
itemid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".ItemID"]);
effectid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".PlayerEffect"]);
if(from->paperdoll[Character::Weapon] == itemid)
{
character_ptr->Effect(effectid, true);
}
Done!!!!!!
14 years, 16 weeks ago
|
Ananas
Moderator
Joined: 22nd Apr 2009
Posts: 2190
Re: weapon effects repost
I removed it because its basically copy and pasting bytes and data, as apollo likes to call it that way. You can only say its your own work if you create your own emulator.
I don't see the use of releasing anything which you can't even claim to have made your own, so there is no need to share this with the community. It just shows you're wasting time to help others.
---
"Pineapples and shit."
14 years, 16 weeks ago
|
Re: weapon effects repost
I found this in my trunk license
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software.
Ananas you havnt copy and pasted bytes after 1052 posts on the eoserv community most of which were helping someone/guides/tutorials skill masters or some other sick release you are the man!
Makes me feal like i am the copy and paste king of the world then and i might never be smart enough to build my own emulator! Ive looked up to you since I started with eoserv over a year ago and I dont care what anyone says this is an example of one of your works!
14 years, 16 weeks ago
|
Re: weapon effects repost
Ananas posted: (12th Jan 2011 10:59 am)
I removed it because its basically copy and pasting bytes and data, as apollo likes to call it that way. You can only say its your own work if you create your own emulator.
I don't see the use of releasing anything which you can't even claim to have made your own, so there is no need to share this with the community. It just shows you're wasting time to help others.
I like the fact he's releasing code. There should be a resources sub forum or something specifically made for code. :)
14 years, 16 weeks ago
|
Re: weapon effects repost
after i add all the code do i save it or wat?
my first time doing code thingy :)
13 years, 50 weeks ago
|
lolss
Joined: 7th Mar 2011
Posts: 1777
Re: weapon effects repost
Great guide!
And no you don't "save" it :p.
You have to compile and Insom, I wish all your guides and other people's guides were as detailed as this :P
Btw 2 errors 1 warning:
C:\Documents and Settings\TaetmM\Desktop\trunk189\src\map.cpp||In member function 'bool Map::AttackPK(Character*, Direction)':|
C:\Documents and Settings\TaetmM\Desktop\trunk189\src\map.cpp|1549|error: a function-definition is not allowed here before '{' token|
C:\Documents and Settings\TaetmM\Desktop\trunk189\src\map.cpp|1995|error: expected '}' at end of input|
C:\Documents and Settings\TaetmM\Desktop\trunk189\src\map.cpp|1995|warning: control reaches end of non-void function|
||=== Build finished: 2 errors, 1 warnings ===|
Edit : Fixed
13 years, 50 weeks ago
|
Corey

Joined: 1st Apr 2011
Posts: 244
Re: weapon effects repost
Very nice guide Insomniac
13 years, 50 weeks ago
|
lolss
Joined: 7th Mar 2011
Posts: 1777
Re: weapon effects repost
If you use the search bar and type in (Feature Release) or something like (Adding effects) then stuff as cool and old as this will show up. :D
13 years, 50 weeks ago
|
Beywolf
Joined: 24th Apr 2011
Posts: 226
Re: weapon effects repost
Nice but
command = arguments.front().substr(1);
There was a Y or something in there xD
13 years, 42 weeks ago
|
Valimus
Joined: 27th Jul 2011
Posts: 1
Re: weapon effects repost
I followed the guide perfectly, and weapon effects still do not work. Any reason on why that could be?
13 years, 40 weeks ago
|
Dopeland
Joined: 17th Jan 2012
Posts: 13
Re: weapon effects repost
Any update for new Revision, Having some troubles with packet.hpp being completely changed. and having issues.,
C:\Users\....\EOSERV\trunk\src\npc.cpp:516:57: error: declaration of 'void NPC::Effect(Character*, int, int)' outside of class is not definition [-fpermissive]
C:\Users\....\EOSERV\trunk\src\npc.cpp:517:1: error: expected unqualified-id before '{' token
13 years, 15 weeks ago
| | | | | | | | | | | |