Author Topic: Looting Issue  (Read 9380 times)

0 Members and 1 Guest are viewing this topic.

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Looting Issue
« on: February 22, 2017, 06:11:42 PM »
+1
I am trying to to write a bird killer/leather looter script.

The kill sub is working but I can't get the loot to work.  The corpse opens, and then its hidden, but it does not drag the feathers off the corpse.

Any suggestions?

Quote
;========================================
;  Check Corpse
;========================================
sub chkcrpse
milky:
finditem YFM G_3
if #findkind = -1
   {
    return
   }
set %dead #findid
set #ltargetid #findid
set #ltargetkind 1
finditem %knife C_ , #backpackid
set #lobjectid #findid
event macro 17 0
target 1s        ;3s
event macro 22 0
wait 20


finditem %dead
set #lobjectid #findid
event macro 17 0
wait 1s


finditem VLK C_ , %dead
wait 1s
exevent drag #findid #findstack
wait 1s
exevent DropC %rbag
wait 1s
ignoreitem %dead
hideitem %dead
goto milky:



Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Looting Issue
« Reply #1 on: February 22, 2017, 06:19:23 PM »
+2
What you are seeing is what OSI calls "instanced" corpses.  What you need to do is find the corpse, wait a little bit, and then find the corpse again to get the "true" #FINDID. 

Code: easyuo
  1.   finditem YFM G_2
  2.   if #FINDKIND <> -1
  3.   {
  4.     wait 5
  5.     finditem YFM G_2
  6. ; do you looting thing with the resulting #FINDID
  7.   }
  8.  
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline BobOzarius

  • Full Member
  • ***
  • Posts: 103
  • Activity:
    0%
  • Reputation Power: 2
  • BobOzarius has no influence.
  • Respect: +26
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #2 on: February 22, 2017, 08:14:44 PM »
+2
Or wait for the container and use it's id. The corpse id and the container id can be different. Sometimes they are the same. Sometimes they are not. On OSI anyways. Probly due to instanced corpses. But I've seen it happen during solo pvm and when you'd think instanced corpses would be a problem with multiple people attacking the same monster. You're using the corpse id for the container id, which isn't always the same thing. Just assume that the corpse id is different from the corpse container id, and write your script to assume that also and your problems should go away.

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #3 on: February 23, 2017, 02:10:27 PM »
+1
Or wait for the container and use it's id. The corpse id and the container id can be different. Sometimes they are the same. Sometimes they are not. On OSI anyways. Probly due to instanced corpses. But I've seen it happen during solo pvm and when you'd think instanced corpses would be a problem with multiple people attacking the same monster. You're using the corpse id for the container id, which isn't always the same thing. Just assume that the corpse id is different from the corpse container id, and write your script to assume that also and your problems should go away.


Some something like this?

Quote
IF #CONTTYPE = YFM
   {
   set %corpse #contid
   }

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #4 on: February 23, 2017, 02:31:25 PM »
+2
maybe this, this is not tested

Code: easyuo
  1.  
  2. finditem %corpseID G_2
  3. if #findkind = -1
  4.       Return
  5. set #lobjectid #findid
  6. event macro 17 0
  7. ignoreitem #findid
  8.  
  9. IF #CONTTYPE = YFM
  10.    set %corpse #contid
  11. FINDITEM %itemtype C_ , %corpse
  12. Event Drag #findid
  13. Exevent dropc #BACKPACKID
  14.  wait 30
  15.  
  16.  
« Last Edit: February 23, 2017, 05:28:50 PM by The Ghost »

Offline BobOzarius

  • Full Member
  • ***
  • Posts: 103
  • Activity:
    0%
  • Reputation Power: 2
  • BobOzarius has no influence.
  • Respect: +26
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #5 on: February 23, 2017, 04:53:01 PM »
+2
You also probly need to account for the timing of instanced corpses, which this does not do. You'd have to loot it once at the beginning, and then again after a couple minutes when the other corpses become un-instanced. (Is that a word?)  Or if you're finding corpses nonstop, instead of looting it twice, find the corpse, set it to an instanced timer, then loot it just once when it combines the instances. But if you're competing with others, probly better to just loot it twice. So you get your items at least. That %contWait timer probly needs some tweaking also. It looks like it would work correctly, but I'm not sure. It seems to wait as long as it takes for a corpse to open, plus 100ms. But is that too long? After opening a corpse with event macro 17, you have to wait at least 1000ms on OSI to perform another action. That's something to consider. That's why I made the timer 1100. But what if the container opens in 500 ms, you'd have a spare 500 ms you'd have to wait before performing an action, so you'd have to account for that somewhere.

Code: easyuo
  1. set %corpseContSize ; Set this to whatever size the container is for a corpse on your shard
  2. set %corpseLooted n/a
  3. finditem %corpses G_2
  4. if #findcnt > 0
  5. {
  6.   set #lobjectid #findid
  7.   set %contid #contid
  8.   event macro 17
  9.   set %contWait #sysTime + 1100
  10.   while #contsize <> %corpseContSize || #contid = %contid
  11.   {
  12.     if #contid <> %contid
  13.     {
  14.       wait 5
  15.       break
  16.     }
  17.   }
  18.   if %contWait < #sysTime  
  19.   {
  20.     set %corpseLooted #false
  21.     return  ; Return on container error
  22.   }
  23.   set %corpseContId #contid
  24.   finditem %itemTypes c_ , %corpseContId
  25.   {
  26.     if #findcnt > 0
  27.     {
  28.       ; Find and loot whatever you want here
  29.       set %corpseLooted #true
  30.     }
  31.   }
  32.   if %corpseLooted = #true
  33.     ignoreitem %contid
  34. }

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #6 on: February 23, 2017, 05:32:08 PM »
+1
TY Ghost & BobOz!

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #7 on: February 23, 2017, 05:44:19 PM »
+1
Ummm, how would I go about carving the corpse?  Would I open, carve, and open it again?

Offline valen2.0

  • Full Member
  • ***
  • Posts: 229
  • Activity:
    0%
  • Reputation Power: 3
  • valen2.0 has no influence.
  • Respect: +63
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #8 on: February 23, 2017, 05:46:30 PM »
+1
I may be wrong but, I think it would be more efficient if you carve the corpse first. because once you carve it will automatically close the corpse

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #9 on: February 23, 2017, 05:49:17 PM »
+1
Maybe between line 7 & 8? 

Offline valen2.0

  • Full Member
  • ***
  • Posts: 229
  • Activity:
    0%
  • Reputation Power: 3
  • valen2.0 has no influence.
  • Respect: +63
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #10 on: February 23, 2017, 05:53:17 PM »
+1
If you put it there I would make a sub to simply use a knife or the butchers cleaver and try it. I am not sure if it will work because it may reset your last object.

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #11 on: February 23, 2017, 05:56:48 PM »
+1
To setup gump size, is this correct?

Quote
set %corpseContSize 144_212

for OSI
#Contsizex: 144
#Contsizex: 212

Sorry, trying to learn

Offline valen2.0

  • Full Member
  • ***
  • Posts: 229
  • Activity:
    0%
  • Reputation Power: 3
  • valen2.0 has no influence.
  • Respect: +63
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #12 on: February 23, 2017, 05:59:55 PM »
+2
I am too, that's what I have in my notes for setting up #contSize = yournumber_yournumber

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Looting Issue
« Reply #13 on: February 23, 2017, 06:20:13 PM »
+1
So I tried this:

Code: easyuo
  1. set %corpseContSize 144_212; Set this to whatever size the container is for a corpse on your shard
  2. set %corpseLooted n/a
  3. set %itemTypes VLK
  4. set %corpses YFM
  5.  
  6. finditem %corpses G_2
  7. if #findcnt > 0
  8. {
  9.   set #lobjectid #findid
  10.   set %contid #contid
  11.   event macro 17
  12.   set %contWait #sysTime + 1100
  13.   while #contsize <> %corpseContSize || #contid = %contid
  14.   {
  15.     if #contid <> %contid
  16.     {
  17.       wait 5
  18.       break
  19.     }
  20.   }
  21.   if %contWait < #sysTime
  22.   {
  23.     set %corpseLooted #false
  24.     return  ; Return on container error
  25.  

but it is stuck in the loop

Code: easyuo
  1.   set %contWait #sysTime + 1100
  2.   while #contsize <> %corpseContSize || #contid = %contid
  3.   {
  4.     if #contid <> %contid
  5.     {
  6.       wait 5
  7.       break
  8.     }
  9.   }
  10.   if %contWait < #sysTime
  11.   {
  12.     set %corpseLooted #false
  13.     return  ; Return on container error
  14. [/quote]
  15.  
  16.  
« Last Edit: February 23, 2017, 06:38:32 PM by declo »

Offline valen2.0

  • Full Member
  • ***
  • Posts: 229
  • Activity:
    0%
  • Reputation Power: 3
  • valen2.0 has no influence.
  • Respect: +63
  • Referrals: 0
    • View Profile
Re: Looting Issue
« Reply #14 on: February 23, 2017, 06:44:19 PM »
+1
Where exactly is it getting stuck? did you step through it?

Tags: