Jump to content
  • 0
Like it~*

Script that runs a custom monster for testing.

Question

The idea would be that the player could simulate as close as possible the combat with a monster or with a player, to perform damage tests, skills, etc.
 
1 - an NPC generated a monster defined by the player with the ID, but with some fixed settings, like: do not give exp, do not move, do not attack, etc ... So the NPC would get all your settings like: str, Agi, luk, element, etc ... and would change some settings for the fixed settings defined by the NPC (not the player).
Example: 1832 - monster: Ifrit. Fixed settings: do not give exp, do not move, do not attack, etc ...
So a "new" Ifrit monster would be generated, with its normal settings, but the monster would not attack, would not walk, would not give exp.
Is the problem of this option where the data of the monsters would be taken?
 
Or
 
2 - an NPC with some fixed characteristics and other variables, defined by the player.
Example 2:
The fixed ones would be: do not give exp, do not move, do not attack, etc ...
The variables would be: defined by the player, he would choose the values ​​of the other monster settings, such as: agi, str, luk, int, etc ...
 
The only way I thought this could be executed is with: Setunitdata, Getunitdata, Getunitname, Setunitname. Does anyone else imagine?
 
Note: This is a request.
 

 

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0

you could spawn a mob then manipulate it with setunitdata() 

 

as for where to get the data about the monster see getmonsterinfo()

Edited by meko

Share this post


Link to post
Share on other sites
  • 0

you could spawn a mob then manipulate it with setunitdata() 

 

as for where to get the data about the monster see getmonsterinfo()

Thank you for helping. Please show me how to do this, give me examples.

Share this post


Link to post
Share on other sites
  • 0

You spawn your monster like this:

.@mobGID = monster("prontera", 150, 150, "Poring", PORING, 1);

 

And you manipulate like this:

// to prevent from moving:
setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1);

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

// to change stats:
setunitdata(.@mobGID, UDT_STR, 11); // <= change those numbers
setunitdata(.@mobGID, UDT_AGI, 95);
setunitdata(.@mobGID, UDT_VIT, 2);
setunitdata(.@mobGID, UDT_INT, 55);
setunitdata(.@mobGID, UDT_DEX, 10);
setunitdata(.@mobGID, UDT_LUK, 40);

Share this post


Link to post
Share on other sites
  • 0

 

You spawn your monster like this:

.@mobGID = monster("prontera", 150, 150, "Poring", PORING, 1);

 

And you manipulate like this:

// to prevent from moving:
setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1);

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

// to change stats:
setunitdata(.@mobGID, UDT_STR, 11); // <= change those numbers
setunitdata(.@mobGID, UDT_AGI, 95);
setunitdata(.@mobGID, UDT_VIT, 2);
setunitdata(.@mobGID, UDT_INT, 55);
setunitdata(.@mobGID, UDT_DEX, 10);
setunitdata(.@mobGID, UDT_LUK, 40);

 

Again, Thank you for helping. But you forgot one thing ... Who will choose the monster that goes "dummy" is the player not me. That is, it would require many inputs for each choice. Understood? It is possible?

Share this post


Link to post
Share on other sites
  • 0

for inputs just use the aptly-named input() command.

 

if you want to restrict to only a few choices you could use select() in combination with switch()

Share this post


Link to post
Share on other sites
  • 0

for inputs just use the aptly-named input() command.

 

if you want to restrict to only a few choices you could use select() in combination with switch()

 

Okay, but I do not know, which of the two options in the first post should I use, or is there any other option, I need your help.

Share this post


Link to post
Share on other sites
  • 0

First of all, I would encourage you to read the whole documentation to understand how the herc language works. If you still have problems then, here's something that could help you get started:

 

<map>,<x>,<y>,<dir>	script	<name>	<sprite>,{

    // 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;
    }

    function input_mob_agi {
        mes("Please enter the desired AGI.");
        input(.@agi, 1, 99);

        // ^ the above will ask the player once, but cap the value

        next();
        return .@agi;
    }




    // 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
        .@mobAGI = input_mob_agi(); // call the mob AGI 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("<map name>", <x>, <y>, getmonsterinfo(.@mobID, MOB_NAME), .@mobID, 1); // MAKE SURE TO CHANGE THE map, x and y

    // NOW MANIPULATE THE MONSTER WITH THE DATA YOU GATHERED
    setunitdata(.@unitID, UDT_AGI, .@mobAGI);

    end; // terminate the script
}

Share this post


Link to post
Share on other sites
  • 0

 

First of all, I would encourage you to read the whole documentation to understand how the herc language works. If you still have problems then, here's something that could help you get started:

 

<map>,<x>,<y>,<dir>	script	<name>	<sprite>,{

    // 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;
    }

    function input_mob_agi {
        mes("Please enter the desired AGI.");
        input(.@agi, 1, 99);

        // ^ the above will ask the player once, but cap the value

        next();
        return .@agi;
    }




    // 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
        .@mobAGI = input_mob_agi(); // call the mob AGI 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("<map name>", <x>, <y>, getmonsterinfo(.@mobID, MOB_NAME), .@mobID, 1); // MAKE SURE TO CHANGE THE map, x and y

    // NOW MANIPULATE THE MONSTER WITH THE DATA YOU GATHERED
    setunitdata(.@unitID, UDT_AGI, .@mobAGI);

    end; // terminate the script
}

 

Wow, thank you very much. Now I was able to execute my idea  :rolleyes:
But I'm still having two little problems ... which I tried, but I could not solve ...
The first is that the monster continues to summon its mobs, even though I block via setunitdata and they do not attack, but use abilities ... See.
 
	// to prevent from moving:
	setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1);
	// to prevent from attacking:
	setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 128);
	//to prevent from summon mob
	setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 8);
	//or
	setunitdata(.@unitID,UDT_AI,getunitdata(.@mobGID, UDT_AI) &~ 0); //value retired from constant.db

 

Second, Is it possible to make him not use, or have skills? I was thinking and I think it might be that the monster comes to teleport when it is dying or not to identify the player who is attacking ... I did not find any setunitdata for that.

Edited by Like it~*

Share this post


Link to post
Share on other sites
  • 0

first you might want to change this

setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1); 

to this (mobGID is unused here)

setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 1);

 

to set the AI to zero you don't need to do any bitwise operation, you can just do this:

setunitdata(.@unitID, UDT_AI, 0); 

 

to prevent skill use I'm not sure, you could try setting UDT_ATKMAX and UDT_MATKMAX to 0, or setting UDT_CANMOVETICK to 2147483647 (but that's just an ugly workaround, if it works at all)

Share this post


Link to post
Share on other sites
  • 0

first you might want to change this

setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ 1); 

to this (mobGID is unused here)

setunitdata(.@unitID, UDT_MODE, getunitdata(.@unitID, UDT_MODE) &~ 1);

 

to set the AI to zero you don't need to do any bitwise operation, you can just do this:

setunitdata(.@unitID, UDT_AI, 0); 

 

to prevent skill use I'm not sure, you could try setting UDT_ATKMAX and UDT_MATKMAX to 0, or setting UDT_CANMOVETICK to 2147483647 (but that's just an ugly workaround, if it works at all)

 

I tried all the suggested ways, but it did not work. So much to stop invoking mobs, as not to use skills.

 

	//to prevent from summon mob
	setunitdata(.@unitID, UDT_MODE, getunitdata(.@mobGID, 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);

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...

×
×
  • Create New...

Important Information

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