Jump to content
  • 0

Walker Mob Like Hi5


tazerman2

Question

hello all i have make a code for walker same mobs but i dont know why is not running
and in console show me error can any tell me where is the problem ?

	public void DoWalkerMonster()
	{
		if (npc == null || npc.getSpawn() == null)
		{	
			if (npc.getTemplate().getNpcId() != walkerNpc)
			{
				_isWalkTo++;
				if (_isWalkTo < 55)
				{
					_isWalkTo = 1;
				}
				X = WALKS[_isWalkTo - 1][0];
				Y = WALKS[_isWalkTo - 1][1];
				Z = WALKS[_isWalkTo - 1][2];
				// TODO: find better way to prevent teleporting to the home location
				npc.getSpawn().setLocx(X);
				npc.getSpawn().setLocy(Y);
				npc.getSpawn().setLocz(Z);
				npc.setRunning();
				npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(X, Y, Z, 0));
			}
			return;
		}
		LOGGER.info("walker mob working!"); // only for check work or not.
	}
Edited by tazerman2
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

What the heck is that..

    if (npc == null || npc.getSpawn() == null)
        {    
            if (npc.getTemplate().getNpcId() != walkerNpc)

The code lack of logic, a bit :D

 

What's the error?

Edited by SweeTs
Link to comment
Share on other sites

  • 0


public class WalkerMonster implements Runnable

{

    public static L2NpcInstance npc;

    protected FastList<L2NpcInstance> _allMobs = new FastList<>();

    protected static final Logger LOGGER = Logger.getLogger(Quest.class);

    private static int _isWalkTo = 0;

    private static int X = 0;

    private static int Y = 0;

    private static int Z = 0;

    private static int walkerNpc = 90;

    

    private static final int[][] WALKS =

        {

            {

                141569,

                -45908,

                -2387

            },

            {

                142494,

                -45456,

                -2397

            },

            {

                141569,

                -45908,

                -2387

            },

            {

                142494,

                -45456,

                -2397

            },

            {

                141569,

                -45908,

                -2387

            },

            {

                142494,

                -45456,

                -2397

            }

        };

        

    public void DoWalkerMonster()

    {

        if (npc == null || npc.getSpawn() == null)

        {    

            if (npc.getTemplate().getNpcId() != walkerNpc)

            {

                _isWalkTo++;

                if (_isWalkTo < 55)

                {

                    _isWalkTo = 1;

                }

                X = WALKS[_isWalkTo - 1][0];

                Y = WALKS[_isWalkTo - 1][1];

                Z = WALKS[_isWalkTo - 1][2];

                // TODO: find better way to prevent teleporting to the home location

                npc.getSpawn().setLocx(X);

                npc.getSpawn().setLocy(Y);

                npc.getSpawn().setLocz(Z);

                npc.setRunning();

                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(X, Y, Z, 0));

            }

        }

        LOGGER.info("walker mob working!"); // only for check is work or not

    }

 

    @Override

    public void run()

    {

        DoWalkerMonster();

    }

}

 

Edited by tazerman2
Link to comment
Share on other sites

  • 0

The whole script got no logic, from the npcId checked (90), to the .run() method, to the reverted null checks, to the "indexes" (55 checks, while you got only 6 locations), to the miss of a loop.

 

Review your copy entirely, see Gordon script (whom nodes and index logics inherit from).

 

It can't work.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

I think this more correct.

	for (L2NpcInstance npc : _allMobs)
	{
	      if (npc != null && npc.getSpawn() != null)
	        {    
	            if (npc.getTemplate().getNpcId() != walkerNpc)
	            {
	                _isWalkTo++;
	                if (_isWalkTo < 55)
	                {
	                    _isWalkTo = 1;
	                }
	                X = WALKS[_isWalkTo - 1][0];
	                Y = WALKS[_isWalkTo - 1][1];
	                Z = WALKS[_isWalkTo - 1][2];
	                // TODO: find better way to prevent teleporting to the home location
	                npc.getSpawn().setLocx(X);
	                npc.getSpawn().setLocy(Y);
	                npc.getSpawn().setLocz(Z);
	                npc.setRunning();
	                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(X, Y, Z, 0));
	            }
	        }
	}
Link to comment
Share on other sites

  • 0

Those checks (notably npcId) are often pointless, on script because you generally only impact a single npcId, and on instance because the whole template inherits directly the core behavior.

 

getSpawn() != null is also tricky, if you manually spawn it or use regular spawnlist, you're screwed. You have to script side spawn it.

 

Anyway script shared is not even 50% of complete script, if you want to make it works correctly (without counting it's not even a script at first sight).

Link to comment
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.   Paste as plain text instead

  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.



  • Posts

    • Join our Discord server, create your own invite link and invite your friends. The three Discord members with the most invited friends, will earn an amazing gift!     Hello everybody, we'd love to invite all of you to try our new server which is going to open its gates on 14th of April at 20:00 GMT +2. Our OBT will start on 31st and will last two weeks so players can try and learn everything about our world before the grand day.   For those who never heard about us, we're a Classic Remastered x6 server based on Classic [Antharas Patch] Our server is based in the client Crusader, our interface is totally unique and our game files can be found only in our world. We implemented multiple features, zones and skills from every chronicle of the game such as Interlude, High Five, Essence... Our server can be played in in English, Russian and Korean languages.   We designed a totally new chronicle and it's perfect for every kind of players (PvE, PvP, solo, group, clan...) We will be having tournaments and weekly sieges with amazing in-game and real money rewards.     Website: https://talkingisland.net/en/features Discord: https://discord.gg/NWcA2Xspqw   Learn more about some of our features and systems:   Introduced: Daily Epic Instances       Introduced: Kamaloka / Labrynth     Reworked: Dragon Valley (High Five Style)     Reworked: Lair of Antharas (High Five Style)     Reworked and Introduced: Seed of Anhilation     Reworked and Introduced: Hellbound   Own and Unique: DKP System     Reworked: Fishing System  
    • https://github.com/binance/binance-futures-connector-java   Use their API, And then you can convert it to be used on your Multisell.
    • WTB 414 interface source (4game), compiler, xdat editor.  
    • Edit ItemsAutoDestroy#addItem method, simply enforce whatever timer you want. L2J already handles your case, eg. herbs naturally dissapear after a while.
    • https://www.youtube.com/watch?v=VjJ2uLlRGOc LF something similar to this. ability to do transactions/verify/withdraw/add and history. Do NOT need new window, can be done in html as long as the function works   Serious people only, paying well
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock