Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2014, 02:55 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Question Special_Abilities on the fly in Perl?

Afternoon ladies/gents/trolls,

I'm curious on how one might modify npc special_abilities on the fly through perl? I'm having issues with $npc->NPCSpecialAttacks as two comma delimited bits would trainwreck and it does not accept the special_abilities as a string:
Code:
$npc->NPCSpecialAttacks("12,1^13,1^14,1", 0);
I then tried the bit below, no luck.
Code:
$npc->ModifyNPCStat("special_abilities", "12,1^13,1^14,1");
$npc->ModifyNPCStat("special_attacks", "12,1^13,1^14,1");
Is there a way to edit these on the fly? What I'm trying to accomplish is to get a mob to ignore combat and charge at another NPC. If there are other ways to accomplish this, PLEASE LET ME KNOW. Also, if a way to handle these on-the-fly is possible, that would be incredibly helpful too.


Thank You!
-Hate
Reply With Quote
  #2  
Old 08-27-2014, 02:59 PM
nilbog
Hill Giant
 
Join Date: Nov 2007
Posts: 198
Default

I'm not sure if you've tried:

Quote:
quest::modifynpcstat(identifier, value) # Changes NPC stats on the fly. Changes are not saved to DB.
Might be useful for i.e. quest::modifynpcstat("max_hit", "700"); Just make sure to name the field correctly.
__________________
https://www.project1999.com
Reply With Quote
  #3  
Old 08-27-2014, 02:59 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

I don't believe special_abilities have been added to Perl yet, it is something that could be done, but I haven't seen it used any where yet.

Here's the $npc->ModifyNPCStat code (this is also used for quest::modifynpcstat):
Code:
void NPC::ModifyNPCStat(const char *identifier, const char *newValue)
{
    std::string id = identifier;
    std::string val = newValue;
    for(int i = 0; i < id.length(); ++i)
    {
        id[i] = std::tolower(id[i]);
    }

    if(id == "ac")
    {
        AC = atoi(val.c_str());
        return;
    }

    if(id == "str")
    {
        STR = atoi(val.c_str());
        return;
    }

    if(id == "sta")
    {
        STA = atoi(val.c_str());
        return;
    }

    if(id == "agi")
    {
        AGI = atoi(val.c_str());
        return;
    }

    if(id == "dex")
    {
        DEX = atoi(val.c_str());
        return;
    }

    if(id == "wis")
    {
        WIS = atoi(val.c_str());
        CalcMaxMana();
        return;
    }

    if(id == "int" || id == "_int")
    {
        INT = atoi(val.c_str());
        CalcMaxMana();
        return;
    }

    if(id == "cha")
    {
        CHA = atoi(val.c_str());
        return;
    }

    if(id == "max_hp")
    {
        base_hp = atoi(val.c_str());
        CalcMaxHP();
        if(cur_hp > max_hp)
            cur_hp = max_hp;
        return;
    }

    if(id == "max_mana")
    {
        npc_mana = atoi(val.c_str());
        CalcMaxMana();
        if(cur_mana > max_mana)
            cur_mana = max_mana;
        return;
    }

    if(id == "mr")
    {
        MR = atoi(val.c_str());
        return;
    }

    if(id == "fr")
    {
        FR = atoi(val.c_str());
        return;
    }

    if(id == "cr")
    {
        CR = atoi(val.c_str());
        return;
    }

    if(id == "pr")
    {
        PR = atoi(val.c_str());
        return;
    }

    if(id == "dr")
    {
        DR = atoi(val.c_str());
        return;
    }

    if(id == "PhR")
    {
        PhR = atoi(val.c_str());
        return;
    }

    if(id == "runspeed")
    {
        runspeed = (float)atof(val.c_str());
        CalcBonuses();
        return;
    }

    if(id == "special_attacks")
    {
        //Added reset flag.
        NPCSpecialAttacks(val.c_str(), 0, 1);
        return;
    }

    if(id == "attack_speed")
    {
        attack_speed = (float)atof(val.c_str());
        CalcBonuses();
        return;
    }

    if(id == "atk")
    {
        ATK = atoi(val.c_str());
        return;
    }

    if(id == "accuracy")
    {
        accuracy_rating = atoi(val.c_str());
        return;
    }

    if(id == "avoidance")
    {
        avoidance_rating = atoi(val.c_str());
        return;
    }

    if(id == "trackable")
    {
        trackable = atoi(val.c_str());
        return;
    }

    if(id == "min_hit")
    {
        min_dmg = atoi(val.c_str());
        return;
    }

    if(id == "max_hit")
    {
        max_dmg = atoi(val.c_str());
        return;
    }

    if(id == "attack_count")
    {
        attack_count = atoi(val.c_str());
        return;
    }

    if(id == "see_invis")
    {
        see_invis = atoi(val.c_str());
        return;
    }

    if(id == "see_invis_undead")
    {
        see_invis_undead = atoi(val.c_str());
        return;
    }

    if(id == "see_hide")
    {
        see_hide = atoi(val.c_str());
        return;
    }

    if(id == "see_improved_hide")
    {
        see_improved_hide = atoi(val.c_str());
        return;
    }

    if(id == "hp_regen")
    {
        hp_regen = atoi(val.c_str());
        return;
    }

    if(id == "mana_regen")
    {
        mana_regen = atoi(val.c_str());
        return;
    }

    if(id == "level")
    {
        SetLevel(atoi(val.c_str()));
        return;
    }

    if(id == "aggro")
    {
        pAggroRange = atof(val.c_str());
        return;
    }

    if(id == "assist")
    {
        pAssistRange = atof(val.c_str());
        return;
    }

    if(id == "slow_mitigation")
    {
        slow_mitigation = atoi(val.c_str());
        return;
    }
    if(id == "loottable_id")
    {
        loottable_id = atof(val.c_str());
        return;
    }
    if(id == "healscale")
    {
        healscale = atof(val.c_str());
        return;
    }
    if(id == "spellscale")
    {
        spellscale = atof(val.c_str());
        return;
    }
}
Reply With Quote
  #4  
Old 08-27-2014, 03:06 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

Well then, that was crazy fast. That will make things interesting. Thank you gents for the scary fast replies.


-Hate
Reply With Quote
  #5  
Old 08-27-2014, 03:12 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,595
Default

Haha, I wasn't aware it was fast, I had just logged in and saw a bold post and checked it out. You're welcome.
Reply With Quote
  #6  
Old 08-27-2014, 03:23 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

the NPCSpecialAttacks still work on the old letter system rather than the newer system.

https://github.com/EQEmu/Server/blob.../npc.cpp#L1414
Reply With Quote
  #7  
Old 08-27-2014, 04:36 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

some servers use it, just don't think many or even any of the quests on peq do/did
__________________

Reply With Quote
  #8  
Old 08-27-2014, 05:35 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Looking at the PEQ quests they do quest::modifynpcstat("special_attacks",ABfHG); my bad, still uses the old codes though.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:28 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3