Jump to content
  • 0
Sign in to follow this  
Blinzer

making slim potion pitcher great again

Question

alright so simply put

 

WelltodoGiantAlligator.gif

 

 

as you can see, sling item equips the food as ammunition and then you can sling it to another player to give them the buff effects of the food

 

i need help doing the same thing with slim potion pitcher. i already know how to make items into ammo, so the only thing i need help with is the source code aspect and make it search for whatever ammo you have equipped instead of whatever it's doing. i have highlighted the suspected culprits

 

 


 

 

case CR_SLIMPITCHER:

            if (sd) {
                int i = skill_lv%11 - 1;
                int j = pc->search_inventory(sd,skill->db[skill_id].itemid);
                if( j < 0 || skill->db[skill_id].itemid <= 0 ) 
                {
                    clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
                    return 1;
                }
                script->potion_flag = 1;
                script->potion_hp = 0;
                script->potion_sp = 0;
                script->run(sd->inventory_data[j]->script,0,sd->bl.id,0); <---- i suspect this to be the game running the effects of the item on the target player(s)
                script->potion_flag = 0;
                //Apply skill bonuses
                i = pc->checkskill(sd,CR_SLIMPITCHER)*10
                    + pc->checkskill(sd,AM_POTIONPITCHER)*10
                    + pc->checkskill(sd,AM_LEARNINGPOTION)*5
                    + pc->skillheal_bonus(sd, skill_id);
 
                script->potion_hp = script->potion_hp * (100+i)/100;
                script->potion_sp = script->potion_sp * (100+i)/100;
 
                if(script->potion_hp > 0 || script->potion_sp > 0) {
                    i = skill->get_splash(skill_id, skill_lv);
                    map->foreachinarea(skill->area_sub,
                                       src->m,x-i,y-i,x+i,y+i,BL_CHAR,
                                       src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
                                       skill->castend_nodamage_id);
                }
            } else {
                int i = skill_lv%11 - 1;
                struct item_data *item;
                i = skill->db[skill_id].itemid;
                item = itemdb->search(i);
                script->potion_flag = 1;
                script->potion_hp = 0;
                script->potion_sp = 0;
                script->run(item->script,0,src->id,0);
                script->potion_flag = 0;
                i = skill->get_max(CR_SLIMPITCHER)*10;
 
                script->potion_hp = script->potion_hp * (100+i)/100;
                script->potion_sp = script->potion_sp * (100+i)/100;
 
                if(script->potion_hp > 0 || script->potion_sp > 0) {
                    i = skill->get_splash(skill_id, skill_lv);
                    map->foreachinarea(skill->area_sub,
                                       src->m,x-i,y-i,x+i,y+i,BL_CHAR,
                                       src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
                                       skill->castend_nodamage_id);
                }
            }
            break;
 
 
please note that i will not be using any values specified in the skill_require_db, i will be opting for a hard code of each individual item id that is valid for ammo.
 
 
other info from previous attempts:
 
when getting help before, they suggested me to use this code(which is basically sling item's)
 

 

 

case CR_SLIMPITCHER:

 

            if( dstmd && (dstmd->class_ == MOBID_EMPERIUM || (dstmd->class_ >= MOBID_BARRICADE1 && dstmd->class_ <= MOBID_GUARIDAN_STONE2)) )
                break;
            if( sd ) {
                short ammo_id;
                int equip_idx = sd->equip_index[EQI_AMMO];
                if( equip_idx <= 0 )
                    break; // No ammo.
                ammo_id = sd->inventory_data[equip_idx]->nameid;
                if( ammo_id <= 0 )
                    break;
                sd->itemid = ammo_id;
               
                if( ammo_id == 545 || ammo_id == 546 || ammo_id == 547 ) {
                    struct script_code *scriptroot = sd->inventory_data[equip_idx]->script;
                    if( !scriptroot )
                        break;
                    if( dstsd )
                        script->run(scriptroot,0,dstsd->bl.id,npc->fake_nd->bl.id);
                    else
                        script->run(scriptroot,0,src->id,0);
                }
            }
 
 
but the problem is that not only does the ammunition provide its buffs to the wielder like this when it gets equipped, but it doesn't even use the ammunition at all and opts to search for the item requirement defined in skill_require_db anyways.
Edited by Blinzer

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Check the actual code for sling item, whatever you have pasted there is incomplete. Gut all the unneeded parts, modify what's needed, add defines for the items (itemdb_is_GNbomb/itemdb_is_GNthrowable by default), imitate that. Of course you will also have to modify the entry in skill_require_db to behave in a similar way or hardcode the whole new portion instead. If you want the skill to do both what it does normally and this new thing without interferences (like your issue with the caster getting item's status), you'll have to split it into two blocks, adding a check for having a throwable item equipped or something of the sort, could also make it based on skill's level.

 

This is something you'll have to figure out yourself, we don't know what's exactly going on there.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.