HerculesWS / Hercules

Hercules is a collaborative software development project revolving around the creation of a robust massively multiplayer online role playing game (MMORPG) server package. Written in C, the program is very versatile and provides NPCs, warps and modifications. The project is jointly managed by a group of volunteers located around the world as well as a tremendous community providing QA and support. Hercules is a continuation of the original Athena project.
http://herc.ws
GNU General Public License v3.0
900 stars 758 forks source link

Setunitdata don't work. #1770

Open Likeeit opened 7 years ago

Likeeit commented 7 years ago

Issue Prelude

Description

The first issue is that the monster continues to summon its mobs, even though I block via setunitdata and they do not attack, but use abilities.

As I'm trying to prevent the monster from using skills, I tried to find a mode for setunitdata, but I found none. I was suggested these options by dev. Meko, as a workaround, however, to no avail.

Current Behavior

Monster continues to invoke his mobs even blocking with setunitdata and no setunitdata has been found to block the skills of monsters and mobs.

Expected Behavior

Monster should not use skills and summon his mobs.

Steps To Reproduce The Issue

  1. Step 1:Click on npc.
  2. Step 2:Enter the ID of a MvP monster (which has mob).
  3. Step 3:Advance and the monster will be invoked.
  4. Step 4:Wait and the monster will summon your mob and use skills.

Branch(es):

Hercules rev. hash/commit:

Git revision src: Info: Hercules 32-bit for Windows Info: Exported revision (src): 'Unknown' Info: Exported revision (scripts): 'Unknown' Info: OS version: 'Windows 8 Workstation (other) (build 9200) [x86_64]'

Info: Compiled with Microsoft Visual C++ 2015 (v1900)

Operating System

Windows 10 Home - x64 64 bits

prontera,170,170,3  script  Test    4W_M_03,{   
    // YOUR INPUT FUNCTIONS GO HERE

function input_mob_id {
    do {
        mes("Please enter the desired mob ID.");
        input(.@id, 1001, 10000);
    } while(getmonsterinfo(.@id, MOB_LV) < 0);

    // ^ the above will keep asking the player over and over until
    //   they enter the ID of a monster that exists

    next();
    return .@id;
}
    // YOUR MAIN SCRIPT GOES HERE

    do {
        mes("Hi there, please enter the desired values."); // print a message
        next(); // require the player to click "next"

        .@mobID = input_mob_id(); // call the mob id menu, store the value

        // ^ HERE ADD MORE CALLS AS NEEDED

        mes("Do you wish to proceed?"); // print a message
        select("Start over.", "Proceed."); // ask the player if they wish to continue

    } while (@menu != 2);

    mes("Please close the dialog to continue.");
    close2(); // require the player to close the dialog

    // HERE SPAWN YOUR MONSTER
    .@unitID = monster("prontera",170,170, getmonsterinfo(.@mobID, MOB_NAME), .@mobID, 1); // MAKE SURE TO CHANGE THE map, x and y

    // NOW MANIPULATE THE MONSTER WITH THE DATA YOU GATHERED
    // to prevent from moving:
    setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 1);

    // to prevent from attacking:
    setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 128);

    //to prevent from summon mob
    setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 8);
    //or
    setunitdata(.@unitID, UDT_AI, 0);  //value retired from constant.db

    //to prevent skills
    setunitdata(.@unitID, UDT_ATKMAX, 0);   setunitdata(.@unitID, UDT_MATKMAX, 0);
    //or
    setunitdata(.@unitID, UDT_CANMOVETICK, 2147483647);

    end; // terminate the script
}

Topic with more information: http://herc.ws/board/topic/14706-script-that-runs-a-custom-monster-for-testing/#comment-82274

dastgirp commented 7 years ago

There's no .@mobGID, you should try changing that to .@unitID and test

Likeeit commented 7 years ago

Excuse me @dastgir . I fixed the script and it still does not work.

sagunkho commented 7 years ago

Can someone else confirm this?

dastgirp commented 7 years ago

Would try this now and let you know

dastgirp commented 7 years ago

Can confirm, there's no option available to disable skill usage of monsters.

dastgirp commented 7 years ago

Also I found a minor bug(typo?) in getunitdata

#undef getunitdata_sub

    return false;

it returns false even if it is successful, resulting in debug messages in console, I guess that should be changed to return true;

AnnieRuru commented 6 years ago

currently there is no script command to disable a monster to summon mobs although its not that hard to do ... rathena add MD_NOCAST_SKILL ... which I personally think that is unofficial I think ... add something else with *setunitdata like UDT_FLAG something that uses bitmask value ... so can control more than 1 things

now your script

    //to prevent from summon mob
    setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 8);
    //or
    setunitdata(.@unitID, UDT_AI, 0);  //value retired from constant.db

1st one is... wrong MD_ASSIST is like ant_hell, where all the ants attack you if you just attack 1 of them

2nd one also wrong ... UDT_AI defines the monster behavior, which most of them are hard-coded

<ai> can be:
    0 = none (default)
    1 = attack/friendly
    2 = sphere (Alchemist skill)
    3 = flora (Alchemist skill)
    4 = zanzou (Kagerou/Oboro skill)

I'll take this one then