SphereCommunity
Auto loot self - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Auto loot self (/Thread-Auto-loot-self)



Auto loot self - htid4life - 08-02-2014 09:43 PM

hey guys i am trying to make this work so players can just Dclick there body and get there stuff back in there backpack..

Code:
[events e_auto_selfloot]
on=@death
Forcont <findlayer.21.uid> 0
  tag.contp=<contp>
endfor

ON=@itemdclick
if (<act.link>==<src.uid>) && (<act.type>==t_corpse)
  local.cycle=0
  ref1=<act.findcont.<local.cycle>.uid>
  for 0 <act.rescount>
    if !(<ref1.attr> & attr_move_never)
        ref1.bounce
        //ref1.cont = <src.findlayer.21.uid>
        If (<ref1.tag0.contp>)
          ref1.contp=<ref1.tag0.contp>
          ref1.tag.contp=
        endif
    else
        local.cycle += 1
    endif
    ref1=<act.findcont.<local.cycle>.uid>
  endfor
  src.sysmessage You take back all your belongings.
  src.findlayer.21.open
endif

but im having no luck with it..


RE: Auto loot self - XuN - 08-02-2014 10:13 PM

At first, I would move the @Death to @DeathCorpse, in some cases you may block the death but the items will get tagged anyways.

Second, I would use [typedef t_corpse] to override its default behaviour, since the @dclick in a corpse will fire less times than @ItemDClick which leads in less checks.
Having the corpse in mind... a Forcont (like you did in the @Death) can place the items back in your backpack.


RE: Auto loot self - htid4life - 08-02-2014 10:14 PM

ok thanks will attempt it now lol ty


RE: Auto loot self - Extreme - 08-03-2014 05:46 AM

PHP Code:
[TYPEDEF T_CORPSE]
ON=@DCLICK
IF <LINK> == <SRC>
 IF <
RESCOUNT>
  
FORCONT <UID>
   
CONT <SRC>
  ENDFOR
 ENDIF
ENDIF