본문 바로가기

Ultima Online/스크립트

[EasyUo]Taming

initevents

gosub InitMenu

gosub InitAnimalTaming

 

loop:

gosub Dispatch

goto loop

 

sub InitMenu

    menu clear

    menu window title Taming

    menu window size 170 190

    menu window color $E0E0E0

    menu font bgcolor $E0E0E0

    menu font name MS Sans Serif

    menu font size 8

    menu font style b

    menu text lblstatistics 10 5 Statistics

    menu font style n

    menu text lbltameskill 10 20 Animal Taming:

    menu text lblloreskill 10 35 Animal Lore:

    menu text lbltameid 10 50 Animal Id:

    menu text lbltamecount 10 65 Attempts:

    menu font align right

    menu text tameskill 160 20 0/0

    menu text loreskill 160 35 0/0

    menu text tameid 160 50 N/A

    menu text tamecount 160 65 0

    menu font align left

    menu font style b

    menu button start 10 90 150 70 START

    menu font style n

    menu shape bgstatus 0 173 170 17 3 7 1 $999999 7 $E0E0E0

    menu font color $666666

    menu text lblstatus 5 175 Status:

    menu text status 40 175 Initializing

    gosub MenuUpdateStats

    menu show

    menu HideEUO

    set #menubutton N/A

return

 

sub InitAnimalTaming

    event macro 8 2 ; open status

    wait 1s

    set %statusposx #contposx

    set %statusposy #contposy

    set %charstartx #charposx

    set %charstarty #charposy

    set %charstartz #charposz

    set %tameskill -1

    set %tameigtimer 0

    set %tamecount 0

    set %tameid N/A

return

 

sub Dispatch

    menu set status Idle

    gosub TamingCheckSkill

    set %finditems N/A

    if #menubutton = start

    {

        set #menubutton N/A

        menu delete start

        menu font style b

        menu button stop 10 90 150 70 STOP

        menu font style n

        while #menubutton <> stop

        {

            gosub TamingIgnore reset

            set %finditems %tameable

            gosub FindClosestItem %finditems

            if %finddist <> N/A

            {

                if %findtype in %tameable

                    gosub Taming %findid

            }

        gosub MenuUpdateStats

        }

    }

return

 

sub MenuUpdateStats

    chooseskill anim

    str right #skill 1

    set %_skilldec #strres

    set %_skill #skill / 10

    set %_skillcap #skillcap / 10

    menu set tameskill %_skill , #dot , %_skilldec , / , %_skillcap

    chooseskill anil

    str right #skill 1

    set %_skilldec #strres

    set %_skill #skill / 10

    set %_skillcap #skillcap / 10

    menu set loreskill %_skill , #dot , %_skilldec , / , %_skillcap

    menu set tameid %tameid

    menu set tamecount %tamecount

return

 

sub Taming

    if #followers >= #maxfol

    {

        display ok You have too many followers

        menu set autotame #false

        return

    }

    finditem %1 G_16

    if #findkind = -1

        return

    set %tameid #findid

    set %tametype #findtype

    set %tamedist #finddist

    if %tameid <> #ltargetid

        event exmsg %tameid 3 30 Pick me!

    set %tamecount 0

    gosub MenuUpdateStats

    gosub TameAnimal

    set %tameid N/A

return

 

sub TamingManual

    if %tameid <> N/A

    {

        event sysmessage You are already taming something.

        return

    }

    menu set status Waiting For Target

    gosub GetTargetId

    gosub Taming #ltargetid

return

 

sub TamingCheckSkill

    menu get autotame

    if #menures = #false

        return

    chooseskill anim

    if #skill = #skillcap

    {

        display ok Taming skillcap reached

        halt

    }

    if %tameskill = #skill

        return

    set %tameskill #skill

    ; ---------------------------------------------------

    ; this chart was auto-generated using TamingChart.xls

    ; ---------------------------------------------------

    if %tameskill >= 0 && %tameskill < 40

        set %tameable HG_RD_NF_BE_NF_GO_WC

    if %tameskill >= 40 && %tameskill < 160

        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG

    if %tameskill >= 160 && %tameskill < 220

        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF

    if %tameskill >= 220 && %tameskill < 280

        set %tameable HG_RD_NF_BE_NF_GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC

    if %tameskill >= 280 && %tameskill < 340

        set %tameable GO_WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG

    if %tameskill >= 340 && %tameskill < 400

        set %tameable WC_RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC

    if %tameskill >= 400 && %tameskill < 460

        set %tameable RF_AG_KB_WG_WG_IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG

    if %tameskill >= 460 && %tameskill < 520

        set %tameable IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH

    if %tameskill >= 520 && %tameskill < 580

        set %tameable IG_NG_ZF_JF_TF_PF_TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE

    if %tameskill >= 580 && %tameskill < 640

        set %tameable TC_BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M

    if %tameskill >= 640 && %tameskill < 700

        set %tameable BB_TG_VE_PG_CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE

    if %tameskill >= 700 && %tameskill < 736

        set %tameable CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD

    if %tameskill >= 736 && %tameskill < 760

        set %tameable CO_CG_JG_ZGB_XF_SF_MG_SG_OF_BO_WN_EG_QC_BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH

    if %tameskill >= 760 && %tameskill < 796

        set %tameable BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF

    if %tameskill >= 796 && %tameskill < 820

        set %tameable BG_EG_VF_DG_ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD

    if %tameskill >= 820 && %tameskill < 856

        set %tameable ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB

    if %tameskill >= 856 && %tameskill < 880

        set %tameable ZI_ZE_IH_UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF

    if %tameskill >= 880 && %tameskill < 892

        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ

    if %tameskill >= 892 && %tameskill < 904

        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE

    if %tameskill >= 904 && %tameskill < 940

        set %tameable UF_UE_VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB

    if %tameskill >= 940 && %tameskill < 988

        set %tameable VD_YF_L_M_SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC

    if %tameskill >= 988 && %tameskill < 1000

        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB

    if %tameskill >= 1000 && %tameskill < 1012

        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC

    if %tameskill >= 1012 && %tameskill < 1036

        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC_TE

    if %tameskill >= 1036

        set %tameable SD_AH_WF_QE_GE_ZD_OH_YG_XG_RF_KD_KG_CB_EH_QF_LD_W_WJ_YE_XE_UB_NC_CD_DF_JJ_CH_MHB_SH_TJ_SC_TE_HH_HH

    gosub TamingIgnore gain

return

 

sub TamingIgnore

    if %1 = perm

    {

        ignoreitem %2

        return

    }

    if %1 = temp

    {

        ignoreitem %2 1

        set %tameigtimer #systime + 60000

        return

    }

    if %1 = reset && #systime > %tameigtimer

    {

        ignoreitem reset 1

        return

    }

    if %1 = skill

    {

        ignoreitem %2 2

        return

    }

    if %1 = gain

    {

        ignoreitem reset 2

        return

    }

return

 

sub TameAnimal

    menu set status Starting To Tame

    TamingLoop:

    finditem %tameid G_16

    if #findkind = -1

        return

    if #finddist > 1

    {

        menu set status Too Far Away

        gosub PathfindWait #findx #findy #findz

        if %moveres = error

        {

            gosub TamingIgnore temp %tameid

            return

        }

        if #menubutton = ignorecurrent

        {

            set #menubutton N/A

            gosub TamingIgnore perm %tameid

            return

        }

        gosub ScriptIdletime

        goto TamingLoop

    }

    set %tamecount %tamecount + 1

    set %tamejournal #jindex + 1

    set %tamefollow #followers

    set #ltargetid %tameid

    set #ltargetkind 1

    event macro 13 35 ; animal taming

    target 2s

    event macro 22 0 ; last target

    gosub TamingMonitor

    if #result = success

    {

        gosub TamingKill

        gosub TamingIgnore perm %tameid

        return

    }

    if #result = retry

    {

        gosub ScriptIdletime

        goto TamingLoop

    }

    if #result = retrylater

    {

        gosub TamingIgnore temp %tameid

        return

    }

    if #result = ignore

    {

        gosub TamingIgnore perm %tameid

        return

    }

    if #result = cancel

    {

        menu set autotame #false

        return

    }

    if #result = skill

    {

        gosub TamingIgnore skill %tameid

        return

    }

    gosub ScriptIdletime

    goto TamingLoop

return

 

sub TamingMonitor

    set %movetimer 0

    set %tametimer #systime + 5000

    TamingMonitorLoop:

    if #jindex >= %tamejournal

    {

        scanjournal %tamejournal

        set %tamejournal %tamejournal + 1

        if start_to_tame in #journal

            menu set status Taming Animal

        if seems_to_accept in #journal

            return success

        if anger_the_beast in #journal

            return retry

        if fail_to_tame in #journal

            return retry

        if too_far in #journal

            return retry

        if clear_path in #journal

            return retry

        if too_many_followers in #journal

            return cancel

        if can't_see_that in #journal

            return retrylater

        if too_angry in #journal

            return retrylater

        if distracted in #journal

            return retrylater

        if someone_else in #journal

            return retrylater

        if tame_already in #journal

            return ignore

        if cannot_be_tamed in #journal

            return ignore

        if can't_tame_that in #journal

            return ignore

        if no_chance in #journal

            return skill

    }

    if #followers > %tamefollow

        return success

    if #menubutton = ignorecurrent

        return ignore

    if #systime > %tametimer

        return retry

    finditem %tameid G_16

    if #findkind = -1

        return retry

    if #finddist > 3 && #systime > %movetimer

    {

        menu get dontmove

        if #menures = #false

            event pathfind #findx #findy #findz

        set %movetimer #systime + 500

    }

    gosub ScriptIdletime

    goto TamingMonitorLoop

return

 

sub TamingKill

    menu set status Killing Animal

    TamingKillLoop:

    finditem %tameid

    if #findkind = -1

        return

    if #mana < 50

    {

        chooseskill medi

        if #skill > 500

        {

            event macro 13 46 ; meditation

            wait 11s

            goto TamingKillLoop

        }

        else

        {

            event sysmessage You must have at least 50 skill Meditation to use this option.

            menu set releasekill #false

            return

        }

    }

    set #ltargetid %tameid

    set #ltargetkind 1

    event macro 15 50 ; flame strike

    target 6s

    event macro 22 0 ; last target

    wait 2s

    goto TamingKillLoop

return

 

; clickScreenXYZ by ScriptFellow modded by Roadkill

; Mods by UncleDave

sub GetScreenXY

    set %1 ( %1 - #charposx ) * 22  ; world x-coordinate

    set %2 ( #charposy - %2 ) * 22  ; world y-coordinate

    set %3 ( %3 - #charposz ) * 4   ; world z-coordinate

    if %0 < 4 || %4 = N/A

        set %4 0                    ; x displacement, added to screen coordinate

    if %0 < 5 || %5 = N/A

        set %5 35                   ; y displacement, added to screen coordinate

    set %screenx #clileft + #clixres / 2 + %1 + %2 + %4

    set %screeny #clitop + #cliyres / 2 + %1 - %2 - %3 + %5

    set %offscreen #true

    if %screenx > #clileft &&

        + %screeny > #clitop &&

        + %screenx < ( #clileft + #clixres ) &&

        + %screeny < ( #clitop + #cliyres )

    {

        set %offscreen #false

        ;click %screenx %screeny F

    }

return

 

; GetYDisplacementForAnimType by Roadkill

; Mods by UncleDave

sub GetAnimalDisplacement

    set %screenydisp -32

    if %tametype in GE_ZD_L_M_TF__IG_NG__ZF_PF_EG_CO_TG_PG_VD

        set %screenydisp -25

    if %tametype in AH

        set %screenydisp -45

    if %tametype in DG_AG_WC_RF_WG_TC

        set %screenydisp -15

return

 

sub SetReagentContainer

    if %tameid <> N/A

    {

        event sysmessage You must wait until you are finished taming.

        return

    }

    event sysmessage Target the container to drop reagents.

    gosub GetTargetId

    set %regcont #ltargetid

return

 

sub FindClosestItem

    finditem %1 G_18

    set %findid #findid

    set %findtype #findtype

    set %finddist #finddist

    if #findcnt > 1

    {

        for %i 1 #findcnt

        {

            finditem %1 %i G_16

            if #findkind <> -1 && #finddist < %finddist

            {

                set %findid #findid

                set %findtype #findtype

                set %finddist #finddist

            }

        }

    }

return

 

sub GetTargetId

    set #ltargetid N/A

    set #targcurs 1

    GetTargetIdLoop:

    if #targcurs = 1

        goto GetTargetIdLoop

return

 

sub PathfindWait

    set %moveres unknown

    menu get dontmove

    if #menures = #true

        return

    if #charposx = %1 && #charposy = %2

    {

        set %moveres success

        return

    }

    set %js #jindex

    event pathfind %1 %2 %3

    wait 10

    set %je #jindex

    for %ji %js %je

    {

        scanjournal %ji

        if pathfinding in #journal

        {

            set %movex #charposx

            set %movey #charposy

            set %movetimer #systime + 500

            PathfindWaitLoop:

            if #systime < %movetimer

                goto PathfindWaitLoop

            if %movex = %1 && %movey = %2

            {

                set %moveres success

                return

            }

            if %movex = #charposx && %movey = #charposy

            {

                set %moveres stopped

                return

            }

            set %movex #charposx

            set %movey #charposy

            set %movetimer #systime + 500

            goto PathfindWaitLoop

        }

        if can't_get_there in #journal

        {

            set %moveres error

            return

        }

    }

return

 

sub GetContainerPos

    finditem %1 C

    if #findkind = -1

        return #false

    if #findtype = ZJF 5 ; backpack

        set %contposx #findx + 22

        set %contposy #findy + 16

        set %contdropx #findx + 22

        set %contdropy #findy + 12

        return #true

    if #findtype = CKF 5 ; bag

        set %contposx #findx + 22

        set %contposy #findy + 15

        set %contdropx #findx + 21

        set %contdropy #findy + 10

        return #true

    if #findtype = LKF 5 ; pouch

        set %contposx #findx + 22

        set %contposy #findy + 13

        set %contdropx #findx + 25

        set %contdropy #findy + 7

        return #true

 

return #false

'Ultima Online > 스크립트' 카테고리의 다른 글

[EasyUo]Necromancy  (0) 2015.02.18
[EasyUo]Magery  (0) 2015.02.18