SphereCommunity
pick and digg - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: pick and digg (/Thread-pick-and-digg)



pick and digg - PurpleHaze - 07-28-2018 07:28 PM

Hi there,
I have a little problem with my pick.
Code:
[ITEMDEF i_pickmagic]
ID=i_pickaxe
NAME=Magic Pickaxe

ON=@Create
MOREY=10

ON=@Targon_Ground
if (<src.targ.type>==t_terrain type)
MOREY=(<eval <morey>>-1)
Return 0
else
Return 1
endif

Terrible problem - my hero simply stands and does not dig.


RE: pick and digg - Darkyhood - 07-28-2018 11:18 PM

(07-28-2018 07:28 PM)PurpleHaze Wrote:  if (<src.targ.type>==t_terrain type)
Should be just t_terrain and you should have this type in your scripts. For debug you can add some logs and fix this problem by self. For example:
Code:
[ITEMDEF i_pickmagic]
ID=i_pickaxe
NAME=Magic Pickaxe

ON=@Create
MOREY=10

ON=@Targon_Ground
if (<src.targ.type>==t_terrain type)
MOREY=(<eval <morey>>-1)
serv.log I can dig!
Return 0
else
serv.log Something wrong!
Return 1
endif



RE: pick and digg - PurpleHaze - 07-29-2018 06:55 AM

Code:
ON=@Targon_Ground
if (<src.targ.type>==t_rock)
MOREY=(<eval <morey>>-1)
serv.log I can dig!
Return 0
else
serv.log Something wrong!
Return 1
endif

I have a message - Something wrong!


RE: pick and digg - Coruja - 07-29-2018 04:24 PM

you're already using an debug msg to track the script behavior, but your msg is not showing the most important value that you're looking for: <SRC.TARG.TYPE>

Code:
ON=@Targon_Ground
SERV.LOG Targ type is '<SRC.TARG.TYPE>'

maybe this should help you get this missing <SRC.TARG.TYPE> value to fix the code


RE: pick and digg - PurpleHaze - 07-31-2018 09:01 AM

01:58:(minew.scp,910)Targ type is '0'
01:58:(minew.scp,916)Something wrong!

My terrain type is - t_Rock

why I cant mine?


RE: pick and digg - fabiohvp - 07-31-2018 01:03 PM

According to wiki you get that target (ground) by ARGN1
http://wiki.spherecommunity.net/index.php?title=@TargOn_Ground

[ITEMDEF i_pickmagic]
ID=i_pickaxe
NAME=Magic Pickaxe

ON=@Create
MOREY=10

ON=@Targon_Ground
if (<serv.ITEMDEF.<ARGN1>.type>==t_terrain)
MOREY=(<eval <morey>>-1)
serv.log I can dig!
Return 0
else
serv.log Something wrong!
Return 1
endif


RE: pick and digg - PurpleHaze - 08-01-2018 05:07 AM

Thank you Brazil friends!