[HELP] Buff Fairy's for OsRose

Welcome in the osRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Re: [HELP] Buff Fairy's for OsRose

Postby PurpleYouko on Thu Sep 14, 2017 7:50 pm

so now we need to make the actual buff code. I've put it in battle.cpp immediately after void CCharacter::UseBuffSkill( CCharacter* Target, CSkills* skill )

here is the function
  1. // this function runs from the /buffme command via gmcmds.cpp
  2. void CCharacter::GiveBuffsFromBot( CCharacter* Target, UINT skillid, UINT skillpower )
  3. {
  4.     Log(MSG_DEBUG,"buffme called. giving skill id %i",skillid);
  5.     CSkills* thisskill = GServer->GetSkillByID( skillid );
  6.     GServer->AddBuffs( thisskill, Target, skillpower ); //apply the buffs
  7.     BEGINPACKET( pak, 0x7b5 );
  8.     ADDWORD    ( pak, Target->clientid );
  9.     ADDWORD    ( pak, Target->clientid );
  10.     ADDWORD    ( pak, thisskill->id );
  11.     ADDWORD    ( pak, 1 );
  12.     ADDBYTE    ( pak, thisskill->nbuffs );
  13.     GServer->SendToVisible( &pak, Target );
  14.     //need a CPlayer object to set the stats so we go and find it
  15.     CPlayer* thisclient = GServer->GetClientByID(Target->clientid,Target->Position->Map);
  16.     thisclient->SetStats(); //this actually sends the updated stats to the client
  17. }

See how simplified that is now? :D

We also need the prototype which we put in character.h. here it is in situ.
  1. void UseBuffSkillQSD( CCharacter* Target, CSkills* skill, bool deBuff = false );
  2.         void GiveBuffsFromBot( CCharacter* Target, UINT skillid, UINT skillpower );     //new buffme code added by PY
  3.         void UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff= false );


Then i went back to startup.cpp and added a couple of lines of code to the normal NPC load function bool CWorldServer::LoadNPCs( ) just to make sure that all the other (normal) NPCs have their buffbot and buffpower values set to zero. I kept getting false positives for my bot check.
These two lines will do it.
  1.  
  2. thisnpc->buffbot = false;
  3.     thisnpc->buffpower = 0;

just stick them at the bottom of the actual loading code so that it looks something like this
  1.  
  2. thisnpc->pos.x = WarpGate.IfoPosition.x;
  3.     thisnpc->pos.y = WarpGate.IfoPosition.y;
  4.     thisnpc->dialog=0;
  5.     thisnpc->event=0;
  6.     thisnpc->thisnpc = GetNPCDataByID( thisnpc->npctype );
  7.     thisnpc->thisnpc->eventid=0;
  8.     thisnpc->buffbot = false;
  9.     thisnpc->buffpower = 0;
  10.  
  11.     //LMA: check if out of memory.
  12.     if (thisnpc->posMap>=MapList.max)
  13.     {
  14.        Log(MSG_WARNING,"NPC, index overflow trapped %i>%i (should not happen) WarpGate",thisnpc->posMap,MapList.max);
  15.        delete thisnpc;
  16.     }


And very last (I think), set that stupid database default value for buffpower back to zero and change all the non-buffbot NPCs in that table back to zero also.

As you will notice in my gm commands code I used the 4 GM buff skills for this test run.
  1. {       //Got buff bot so do de buffs
  2.         Target->GiveBuffsFromBot( Target, 3202, buffpower );
  3.         Target->GiveBuffsFromBot( Target, 3203, buffpower );
  4.         Target->GiveBuffsFromBot( Target, 3204, buffpower );
  5.         Target->GiveBuffsFromBot( Target, 3205, buffpower );
  6.         SendPM(Target,"Congratulations! You received buffs from the buff fairy with buffpower %i", buffpower);
  7.     }

Feel free to use whatever skills you like in place of these. Even make some of your own if you like.

And absolutely finally.........
Here it is all working brilliantly :D
hellyes.jpg


the only thing I didn't do here was to put my buff fairy onto the mini-map
If you want to do that you will just have to edit the IFO files for the maps in which you add your buff bots.
If you want to get really smart with it you could also add some simple CON files so that you can at least select a buff bot and talk to it enough to maybe get instructions. But right now I'm not planning on going there because i have much grander plans than using crappy old CON and LTB stuff.

Have fun and give me feedback, modification ideas and stuff. Or just let me know if it simply didn't work for you and I will attempt to figure out why. Bye for now
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [HELP] Buff Fairy's for OsRose

Postby AnimalCrackerz on Fri Sep 15, 2017 12:33 am

Work's great! Having a small issue .. when I go to one map fairy to another the buffpower value varys..but the applied buff is the same strength


*working* gonna be honest PY..Ty ..but It's working and I am not farting with it anymore..I can now add as many fairys as I want and set the buffpower..all at the database...I am a HAPPY CAMPER..no more Please I can't keep UP! :lol:
Attachments
Screenshot_1.png
Screenshot_2.png
Last edited by AnimalCrackerz on Fri Sep 15, 2017 8:48 pm, edited 1 time in total.
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: [HELP] Buff Fairy's for OsRose

Postby PurpleYouko on Fri Sep 15, 2017 2:30 pm

AnimalCrackerz wrote:Work's great! Having a small issue .. when I go to one map fairy to another the buffpower value varys..but the applied buff is the same strength



did you allow the first buff to expire first? I've noticed that sometimes buff strength doesn't change when you refresh an existing buff.
I also notice that your move speed buff is a lot bigger on the second buff fairy even though most (if not all) of the others are about the same.

I wonder if the difference between INT of 1000 and 1500 is not enough to make all that much difference to some of them. You should take a look at the buff skills in LIST_SKILL.STB
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [HELP] Buff Fairy's for OsRose

Postby AnimalCrackerz on Fri Sep 15, 2017 9:49 pm

Not sure will test some more again this evening...it's working great now...in the battle cpp ... I added an ADDWORD pak skillpower.. to the list and then it started buffing different int strengths from one fairy to the next..I think the buffpower is way to high at what I had it set in the screenshots but I plan to lower the max in the code and give buff strenghts 700 1000 and 1200 .. any higher is unnecessary
Ty you so much PY :)
AnimalCrackerz
Pomic
Pomic
 
Posts: 102
Joined: Tue Apr 20, 2010 1:58 pm

Re: [HELP] Buff Fairy's for OsRose

Postby Blackdpd on Fri Sep 15, 2017 10:46 pm

It always makes me smile when reading one of PY's small tutorials :D
Was fun reading through.
User avatar
Blackdpd
El Verloon Marshall
El Verloon Marshall
 
Posts: 900
Joined: Sun Jan 27, 2008 10:06 pm
Location: The Netherlands

Re: [HELP] Buff Fairy's for OsRose

Postby PurpleYouko on Sat Sep 16, 2017 6:34 pm

hey there blackdpd? long time no see. :D
Are you planning on sticking around or is this just a flying visit?
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [HELP] Buff Fairy's for OsRose

Postby Blackdpd on Sun Sep 17, 2017 12:04 am

Hey! Yeah I'm planning to stick around. If possible learn something aswell.
It's funny because now I understand more of the code than before.
I still get really confused when it comes to packet stuff.

Awh the memories of when i didn't understand 1 single line of code :D
User avatar
Blackdpd
El Verloon Marshall
El Verloon Marshall
 
Posts: 900
Joined: Sun Jan 27, 2008 10:06 pm
Location: The Netherlands

Previous

Return to Support - OsRose Emulator

Who is online

Users browsing this forum: No registered users and 16 guests