Jump to content

Recommended Posts

Posted

You must use l2net and script

 

//**** Fighter script v0.2 ****//

 

//Remember to set weapon ID at line 133 and 137 (in the killtarget sub)

 

//****** User Settings ******//

DEFINE INT MIN_ATTACKDELAY 500

DEFINE INT MAX_ATTACKDELAY 700

DEFINE INT LOOT_RANGE 120

DEFINE INT MIN_PICKUPDELAY 150

DEFINE INT MAX_PICKUPDELAY 300

DEFINE INT MIN_TARGETDELAY 200

DEFINE INT MAX_TARGETDELAY 300

DEFINE INT MOVETO_DISTANCE 400

 

//***********************Kite Stuff*********************//

DEFINE INT KiteRange 450

DEFINE DOUBLE VX 0

DEFINE DOUBLE VY 0

DEFINE DOUBLE VX1 0

DEFINE DOUBLE VY1 0

DEFINE DOUBLE LEN 0

//*****************************************************//

 

//*******time*******//

DEFINE INT StartTime 0

DEFINE INT EndTime 0

DEFINE INT UsedTime 0

DEFINE INT MaxTime 100000000

DEFINE INT MaxPickTime 50000000

 

//******Rest Settings******//

//set here at what hp/mp to rest. (in %)

DEFINE INT RESTHPPERCENT 40

DEFINE INT RESTMPPERCENT 0

 

DEFINE INT TEMP 0

DEFINE INT i 0

DEFINE INT TEN 10

DEFINE INT FOUR 4

DEFINE INT HUNDRED 100

DEFINE INT COUNT 0

DEFINE INT Rest 0

DEFINE INT RESTHP 0

DEFINE INT RESTMP 0

DEFINE INT SKILLMP 0

DEFINE INT DISTANCE_TO_TARGET 0

DEFINE INT PICKUP_X 0

DEFINE INT PICKUP_Y 0

DEFINE INT TEMPX 3

DEFINE DOUBLE X 0

DEFINE DOUBLE Y 0

DEFINE DOUBLE Range 50

 

 

MATH RESTHP CHAR_MAX_HP MULTIPLY RESTHPPERCENT

MATH RESTHP RESTHP DIVIDE HUNDRED

MATH RESTMP CHAR_MAX_MP MULTIPLY RESTMPPERCENT

MATH RESTMP RESTMP DIVIDE HUNDRED

 

//****** MAIN ******//

 

//just a printout

PRINT_TEXT "rest below <&RESTHP&> HP"

DO

TARGET_NEAREST

GET_RAND TEMP "<&MIN_TARGETDELAY&>" "<&MAX_TARGETDELAY&>"

SLEEP "<&TEMP&>"

IF TARGET_CUR_HP > ZERO

CALLSUB MovetoTarget

SLEEP 500

CALLSUB KillTarget

ENDIF

 

//Target is dead, pick up

GET_TIME StartTime

SET PICKUP_X "<&CHAR_X&>"

SET PICKUP_Y "<&CHAR_Y&>"

WHILE NEAREST_ITEM_DISTANCE < LOOT_RANGE

GET_TIME EndTime

MATH UsedTime EndTime SUBTRACT StartTime

IF UsedTime > MaxPickTime

BREAK 2

ENDIF

DISTANCE TEMP CHAR_X CHAR_Y TEMP PICKUP_X PICKUP_Y TEMP

IF TEMP > LOOT_RANGE

BREAK 2

ENDIF

CALLSUB Pickup

WEND

 

IF COUNT_NPC_TARGETME == ZERO

IF CHAR_CUR_HP < RESTHP

CALLSUB Rest

ENDIF

ENDIF

LOOP ZERO == ZERO

SCRIPT_END

 

//***************** SUBS *****************//

SUB MovetoTarget

SET i 0

GET_TIME StartTime

DISTANCE DISTANCE_TO_TARGET CHAR_X CHAR_Y CHAR_Z TARGET_X TARGET_Y TARGET_Z

IF DISTANCE_TO_TARGET <= MOVETO_DISTANCE

RETURNSUB

ENDIF

SET TEMPX "<&TARGET_X&>"

MOVE_TO "<&TARGET_X&>" "<&TARGET_Y&>" "<&TARGET_Z&>"

WHILE DISTANCE_TO_TARGET > MOVETO_DISTANCE

               GET_TIME EndTime

MATH UsedTime EndTime SUBTRACT StartTime

DISTANCE DISTANCE_TO_TARGET CHAR_X CHAR_Y CHAR_Z TARGET_X TARGET_Y TARGET_Z

GET_RAND TEMP "<&MIN_TARGETDELAY&>" "<&MAX_TARGETDELAY&>"

SLEEP "<&TEMP&>"

IF UsedTime > MaxTime

CALLSUB Stuck

RETURNSUB

ENDIF

IF TARGET_X != TEMPX

MOVE_TO "<&TARGET_X&>" "<&TARGET_Y&>" "<&TARGET_Z&>"

ENDIF

WEND

RETURNSUB

//******************************************************************************//

SUB KillTarget

GET_TIME StartTime

DO

MATH i i ADD ONE

PRINT_TEXT "Entering loop <&i&>"

GET_TIME EndTime

MATH UsedTime EndTime SUBTRACT StartTime

IF i == FOUR

IF TARGET_CUR_HP == TARGET_MAX_HP

USE_ITEM 13 //Equip Short Bow

SLEEP 1000

ATTACK_TARGET

SLEEP 3500

USE_ITEM 2543 //Equip duals

SET i 0

ENDIF

ENDIF

IF UsedTime > MaxTime

IF TARGET_CUR_HP == TARGET_MAX_HP

CALLSUB Stuck

RETURNSUB

ENDIF

ENDIF

ATTACK_TARGET

GET_RAND TEMP "<&MIN_ATTACKDELAY&>" "<&MAX_ATTACKDELAY&>"

SLEEP "<&TEMP&>"

LOOP TARGET_CUR_HP > ZERO

RETURNSUB

//******************************************************************************//

SUB Pickup

CLICK_NEAREST_ITEM

GET_RAND TEMP "<&MIN_PICKUPDELAY&>" "<&MAX_PICKUPDELAY&>"

SLEEP "<&TEMP&>"

RETURNSUB

//******************************************************************************//

SUB Rest

PRINT_TEXT "starting to rest"

SLEEP 1000

COMMAND "/sit"

//USE_SKILL 226

WHILE CHAR_CUR_HP < CHAR_MAX_HP

IF COUNT_NPC_TARGETME != ZERO

COMMAND "/stand"

RETURNSUB

ENDIF

SLEEP 1000

WEND

//done resting lets stand

COMMAND "/stand"

SLEEP 200

RETURNSUB

//******************************************************************************//

SUB Stuck

//need to get a vector for from the monster to us

MATH VX CHAR_X SUBTRACT TARGET_X

MATH VY CHAR_Y SUBTRACT TARGET_Y

//now we have the vector from the target to us... lets normalize it now

DISTANCE LEN ZERO ZERO ZERO VX VY ZERO

MATH VX VX DIVIDE LEN

MATH VY VY DIVIDE LEN

//now lets scale back up to our range

MATH VX VX MULTIPLY KiteRange

MATH VY VY MULTIPLY KiteRange

SET VX1 "<&VX&>"

SET VY1 "<&VY&>"

//then we add this offset to our location

MATH VX VX ADD CHAR_X

MATH VY VY ADD CHAR_Y

//and finally... we move

MOVE_TO "<&VX&>" "<&VY&>" "<&CHAR_Z&>"

SLEEP 1500

//left turn

MATH VX CHAR_X SUBTRACT VY1

MATH VY CHAR_Y ADD VX1

MOVE_TO "<&VX&>" "<&VY&>" "<&CHAR_Z&>"

SLEEP 1500

MOVE_TO "<&TARGET_X&>" "<&TARGET_Y&>" "<&TARGET_Z&>"

SLEEP 1500

RETURNSUB

 

i proposes you to use IG l2net :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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