ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: bennyspa on October 29, 2009, 07:38:44 AM

Title:
Post by: bennyspa on October 29, 2009, 07:38:44 AM
Hi, I've written this script but I don't know to finish it.

Can anyone help me with the recalling and the dropping items steps? (and to make it better).

This is the code for the script:

Code: [Select]
;===============================
; Script Name: Chicken Killer & Looting
; Author: Bennyspa
; Version: 0.3
; Client Tested with: 7.0.0.2
; EUO version tested with: 1.5 v.154
; Shard OSI / FS:  Free Server
; Revision Date: NA
; Public Release: 29/10/09
; Purpose: Kill Chickens to obtain feathers.
;===============================

set %chicken C_AG ; NPC to kill
set %weapon XXXXXXX ;Weapon ID


;Kill NPC

    finditem %chicken G_12
    if #findkind <> -1

    set #ltargetid #findid
    event macro 27 0
    wait 10
   
;Search corpse & use weapon on it.

     finditem yfm g_2
    {
    if #findkind = -1
       return
    else
       { 
       ignoreitem #findid
       set #ltargetid #findid
       set #lobjectid %weapon
       event macro 17 0
       target
       event macro 22 0
       wait 10
       }
    }
   
;Looting Feathers

set %featherType VLK
set %featherBag #backpackId

    set !toFind %featherType
    set !toFind %featherType , _ ,
    findItem !toFind C_ , #contId
    if #findcnt <> 0
    {
       for !i 1 #findCnt
       {
          set #findIndex !i
          exEvent drag #findId #findStack
          wait 15
          exEvent dropc %featherBag
          wait 50
       }
    }
   
;Weigth - Recall - Secure Container

   set %RunebookHOME XXXXXXX ;Secure Container Runebook
   set %RunebookNPC XXXXXXX ;NPC Location Runebook
   set %SecureId XXXXXXX ;House Secure ID

   if #weight > 350 ; Change for your PJ
   
       {
{ ;Recall to Secure Container
set #LTARGETID %RunebookHOME
event macro 15 31
wait 50
event macro 22 0
}

{ ;Drop Feathers on Secure Container
}

{ ;Recall to Chicken's Location
}
       }
      
repeat
Title:
Post by: Coragin on October 29, 2009, 07:40:32 AM
TM has some GREAT Runebook handling subs for recalling and gating.  Why try and re-invent the wheel?  Search the script part of the boards and you will find it.  Its simply the best.
Title:
Post by: 12TimesOver on October 29, 2009, 08:51:34 AM
Hi Bennyspa - nice effort so far!!

I would highly recommend TM's runebook subs that can be found Here (http://www.scriptuo.com/index.php?topic=18.0).

If you would entertain an organizational suggestion I would recommend setting all of your variable values at the beginning of the script to make it a little more user-friendly. Also, consider using subroutines within the script with a loop of Gosubs as the mainloop of the script.

So, for example:
Code: [Select]
set %chicken C_AG ; NPC to kill
set %weapon XXXXXXX ;Weapon ID
set %featherType VLK
set %featherBag #backpackId
set %RunebookHOME XXXXXXX ;Secure Container Runebook
set %RunebookNPC XXXXXXX ;NPC Location Runebook
set %SecureId XXXXXXX ;House Secure ID

Mainloop:
   Gosub Recalltochickenspot
   Gosub Findchicken
   Gosub Etc,yougetthepoint
goto Mainloop ;yes there are better ways but for illustrative purposes, here is a goto ;)

As for logic, I notice that you don't have anything in place to move to a chicken when you find one, it assumes you are standing next to the chicken when you kill it. You could scan for the chicken, then when you find it pathfind to it then head to your kill/skin/loot loop.

Just a couple of thoughts to start, hope this is helpful!!

X
Title:
Post by: 12TimesOver on October 29, 2009, 08:53:08 AM
Oh, also, if you are going to scan for a kill then pathfind to it there is no reason not to include all other bird types in your %chicken variable ;)
Title:
Post by: cgeorgemo on October 29, 2009, 09:47:19 AM
Oh, also, if you are going to scan for a kill then pathfind to it there is no reason not to include all other bird types in your %chicken variable ;)
Such as Harpies, Stone Harpies, and Paragon versions of both of these...... I'm thinking of the Harpy nest in Ilshenar
Title:
Post by: 12TimesOver on October 29, 2009, 09:55:25 AM
Oh, also, if you are going to scan for a kill then pathfind to it there is no reason not to include all other bird types in your %chicken variable ;)
Such as Harpies, Stone Harpies, and Paragon versions of both of these...... I'm thinking of the Harpy nest in Ilshenar
And Ravens, Eagles, Blue Jays, or whatever other birds are floating around in the game nowadays.

It also just occurred to me that my point about pathfinding to the kill before killing it was somewhat moot since the attacking of the mob will make it come to you anyhow.
Title:
Post by: cgeorgemo on October 29, 2009, 10:19:57 AM
You'd have to go to the smaller ones if you were a caster they'd drop with one hit.
Title:
Post by: 12TimesOver on October 29, 2009, 10:23:35 AM
You'd have to go to the smaller ones if you were a caster they'd drop with one hit.

Event Macro 27 0 = Attack Last. This is definitely meant for Malee rather than casting.

X
Title:
Post by: cgeorgemo on October 29, 2009, 10:26:04 AM
You'd have to go to the smaller ones if you were a caster they'd drop with one hit.

Event Macro 27 0 = Attack Last. This is definitely meant for Malee rather than casting.

X
You see what happens when you don't know all the Event Macro codes?
Title:
Post by: bennyspa on October 29, 2009, 12:35:42 PM
I'll check this script.

In the script, the pj don't follow the chickens cause they spawn on its side, but it's easy to make the pj follow them, by the way, the script made it before.
Title:
Post by: cgeorgemo on October 29, 2009, 01:01:34 PM
Hi, I've written this script but I don't know to finish it.

Halt ;Ends script

 ;)
Title:
Post by: Endless Night on November 01, 2009, 09:00:57 AM
Hi, I've written this script but I don't know to finish it.

Halt ;Ends script

 ;)

Funny man,.  but i new soon or later you would pickup a few commands ..