SphereCommunity
Fetch Command - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Requests (/Forum-Script-Requests)
+--- Thread: Fetch Command (/Thread-Fetch-Command)



Fetch Command - Saint - 07-12-2015 06:58 PM

Looking for a brain type to add to certain animals that when under your control can fetch one item.

has to check to make sure its moveable and not over a certain weight.


RE: Fetch Command - Diathim - 10-21-2015 03:03 AM

Really, I am not too sure if this will work or not. I did it super quick in NP++ without testing. If not, let me know what is wrong or not working and I can try to fix it as soon as possible for you. Smile

Code:
[speech spk_pets]
on=*fetch*
src.targetf f_pet_fetch What do you want your pet to fetch?
return 1

[function f_pet_fetch]
on=@TargOn_Item
if (<src.targ.attr> &attr_move_never) || (<src.targ.attr> &attr_static)
src.msg Your pet cannot retrieve that.
return 1
endif

if (<src.targ.weight> > 10)
src.msg This will be too heavy for the pet to pickup.
return 1
endif

ref1=<src.targ.uid>
ref2=<uid>
ref3=<src.uid>
run <src.targ.p>
timerf 5,f_pet_pickup
return 1

[function f_pet_pickup]
if (<p> != <src.targ.p>)
timerf 5,f_pet_pickup
return 1
endif

for <ref1> 1 10
if (<uid> == <ref1>)
  ref1.bounce <ref2>
  run <ref3.p>
endif
endfor
retutn 1