Jump to content
  • 0

unitattack


noblesse

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  05/15/16
  • Last Seen:  

Hello,

I am trying to use the unitattack command to a player using bindatcmd. Unfortunately, I can't make it work. I can get the GID of the mob that is close to my character. Can anyone help me please? Thanks!

-	script	test_bot	-1,{
	OnInit:
		bindatcmd "testsc",strnpcinfo(3) + "::OnAtcommand";
		end;
	OnAtcommand:
		if (getgroupid() > 90) {
			
			getmapxy(.@m$,.@x0,.@y0,BL_PC);
			
			.@plusx = .@x0 + 5;
			.@plusy = .@y0 + 5;
			.@minx = .@x0 - 5;
			.@miny = .@y0 - 5;
			
			dispbottom .@m$ + " " + .@x0 + " " + .@y0;
			
			.@num = getareaunits(BL_MOB,.@m$,.@plusx,.@plusy,.@minx,.@miny,.@array[0]);
			

			dispbottom "the number of Monsters in Prontera in that Coordinates is " + .@num + " .";
			dispbottom "list of Monsters GID :";
			freeloop(1);	// for if the list was too big.
			for(.@i=0;.@i<getarraysize(.@array);.@i++) {
				dispbottom (.@i + 1) + " " + .@array[.@i];
				//unitskilluseid getcharid(3),"WL_JACKFROST",5,getcharid(3),-4;
				unitattack  getcharid(3),.@array[.@i];
				unitattack  0,.@array[.@i];
			}
			freeloop(0);
			dispbottom "end";
			end;
		} else {
			dispbottom "Currently for testing only.";
			end;
		}
}

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  768
  • Reputation:   233
  • Joined:  02/11/17
  • Last Seen:  

-	script	test_bot	-1,{
	OnInit:
		bindatcmd "testsc",strnpcinfo(3) + "::OnAtcommand";
		end;
	OnAtcommand:
		if (getgroupid() > 90) {
			
			getmapxy(.@m$,.@x0,.@y0,BL_PC);
			
			.@plusx = .@x0 + 5;
			.@plusy = .@y0 + 5;
			.@minx = .@x0 - 5;
			.@miny = .@y0 - 5;
			
			dispbottom .@m$ + " " + .@x0 + " " + .@y0;
			
			.@num = getareaunits(BL_MOB,.@m$,.@plusx,.@plusy,.@minx,.@miny,.@array[0]);
			.@gid = getcharid(3);
			detachrid;
			dispbottom "the number of Monsters in Prontera in that Coordinates is " + .@num + " .";
			dispbottom "list of Monsters GID :";
			freeloop(1);	// for if the list was too big.
			for(.@i=0;.@i<getarraysize(.@array);.@i++) {
				dispbottom (.@i + 1) + " " + .@array[.@i];
				//unitskilluseid getcharid(3),"WL_JACKFROST",5,getcharid(3),-4;
				unitattack  .@gid,.@array[.@i];
			}
			freeloop(0);
			dispbottom "end";
			end;
		} else {
			dispbottom "Currently for testing only.";
			end;
		}
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  05/15/16
  • Last Seen:  

Thank you so much @crazyarashi I just modified a bit of the script on dispbottom for steps checking and continuous attack. I am adding the detachrid inside the for loop before that's why I am not getting it right.

-	script	test_bot	-1,{
	OnInit:
		bindatcmd "testsc",strnpcinfo(3) + "::OnAtcommand";
		end;
	OnAtcommand:
		if (getgroupid() > 90) {
			
			getmapxy(.@m$,.@x0,.@y0,BL_PC);
			
			.@plusx = .@x0 + 5;
			.@plusy = .@y0 + 5;
			.@minx = .@x0 - 5;
			.@miny = .@y0 - 5;
			
			dispbottom .@m$ + " " + .@x0 + " " + .@y0;
			
			.@num = getareaunits(BL_MOB,.@m$,.@plusx,.@plusy,.@minx,.@miny,.@array[0]);
			dispbottom "1";
			.@gid = getcharid(3);
			.@cid = getcharid(0);
			detachrid;
			dispbottom "the number of Monsters in Prontera in that Coordinates is " + .@num + " .",0x00FF00,.@cid;
			dispbottom "list of Monsters GID :",0x00FF00,.@cid;
			freeloop(1);	// for if the list was too big.
			for(.@i=0;.@i<getarraysize(.@array);.@i++) {
				dispbottom (.@i + 1) + " " + .@array[.@i],0x00FF00,.@cid;
				//unitskilluseid getcharid(3),"WL_JACKFROST",5,getcharid(3),-4;
				unitattack  .@gid,.@array[.@i],1;
			}
			freeloop(0);
			dispbottom "end",0x00FF00,.@cid;
			end;
		} else {
			dispbottom "Currently for testing only.";
			end;
		}
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  05/15/16
  • Last Seen:  

@crazyarashi just a question, how does the event label works in unitwalk. Tried it have but the event didn't trigger.

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.

×
×
  • Create New...