Jump to content

  •  

Photo

making slim potion pitcher great again


  • Please log in to reply
1 reply to this topic

#1 Blinzer

Blinzer

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts

Posted 15 January 2017 - 12:28 AM

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[i]);
                if( j < 0 || skill->db[skill_id].itemid[i] <= 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[i];
                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, 15 January 2017 - 12:59 AM.


#2 Anisotropic Defixation

Anisotropic Defixation

    Advanced Member

  • Members
  • PipPipPip
  • 116 posts

Posted 15 January 2017 - 06:30 PM

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.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


This topic has been visited by 12 user(s)