SphereCommunity
SkillMakeItem Trigger - Printable Version

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



SkillMakeItem Trigger - kn4tseb - 08-06-2014 07:03 AM

Hey mates, i need some help again, when crafting tailoring or carpentry items... how could i make a reference of the t_sewing_kit of t_carpentry kit used???

ACT The item that was crafted.
ARGO The item that the item was crafted from. // usually resources like hides or logs, etc..
I The character who crafted the item.
SRC The character who crafted the item.

// ITEM where the target was originated from?

is it possible to add a new reference for item kit used?

on those cases it's necesary to double click it to bring the crafting menu up. but i cant figure how to make a reference of this item to store it.. so, forconttype would work but wouldnt be precise in case i have 2 or more of this type items backpacked.... so...
any suggestions?


RE: SkillMakeItem Trigger - Skul - 08-06-2014 07:58 AM

use @skillmakeitem and findtype, example:
Code:
on=@skillmakeitem //player event
if (<serv.skill.<action>.key>==carpentry)
  findtype.t_carpentry.XXX //xxx being function/value to alter
elseif (<serv.skill.<action>.key>==tailoring)
  findtype.t_sewing_kit.XXX //again, function or value to alter
elseif (<serv.skill.<action>.key>==tinkering)
  findtype.t_tinker_tools.XXX //etc..
endif



RE: SkillMakeItem Trigger - kn4tseb - 08-06-2014 08:34 AM

uhmmm what would the function or value to alter be for example???
i dont see how it would make a difference between two same type items..

im trying to recreate somekind of "tailor runic tools" so i need to be as accure as possible identifing whichone is backpacked and used when crafting.


RE: SkillMakeItem Trigger - Skul - 08-06-2014 08:48 AM

ah, ok, you'll need to add the special tool to the SKILLMAKE of the item to be crafted, example:
Code:
SKILLMAKE=TAILORING 60.0, i_sewing_kit_special
RESOURCES=100 i_cloth, 10 i_thread



RE: SkillMakeItem Trigger - kn4tseb - 08-06-2014 08:59 AM

uhmmm.. i still dont get it

if i have i_sewing_kit_special1 and i_sewing_kit_special2 both items have charges (uses)

and when i craft an item i want that a specified one to be its charges decrease by one, how would i be able to make a reference of it?.

this is what i have at the moment.

Code:
ON=@SkillMakeItem
IF strmatch(*t_armor_leather*,<act.type>)
forconttype t_sewing_kit
   if <baseid> == i_sewing_kit_runic_spined || <baseid> == i_sewing_kit_runic_horned || <baseid> == i_sewing_kit_runic_barbed
      ref1 = <uid>
   endif
endfor
IF <REF1>
   ref1.tag0.uses -= 1
   ref1.update
   ref1.<runicarmorsattr> // function
ENDIF

But the thing is what if i have more than one of those items or more than one of this special items... with this code, its not totally accure to specify the item i want to be used..


RE: SkillMakeItem Trigger - Skul - 08-06-2014 09:34 AM

Might be better off creating an [itemdef] for each spine/horned/barbed leather item and a sewing kit for each. I use a spined/horned/barbed leather script on my server and it uses special hides rather than a sewing kit to create. But seeing how you want it done, you might want to check for the 'best' sewing kit (being barbed) and use it accordingly:
Code:
on=@skillmakeitem
if (<act.type>==t_armor_leather)
  if (<findid.i_sewing_kit_runic_barbed>)
    ref1=<findid.i_sewing_kit_runic_barbed>
  elseif (<findid.i_sewing_kit_runic_horned>)
    ref1=<findid.i_sewing_kit_runic_horned>
  elseif (<findid.i_sewing_kit_runic_spined>)
    ref1=<findid.i_sewing_kit_runic_spined>
  endif
  if (<ref1.uid>)
    ref1.tag0.uses -= 1
    ref1.<runicarmorsattr> // function
    if (<ref1.dtag0.uses> < 1)
      ref1.destroy
    endif
  endif
endif



RE: SkillMakeItem Trigger - Ben - 08-06-2014 01:04 PM

If you looking for a way to find out which sewing kit is used when sphere runs makeitem, well your out of luck because sphere doesn't use a specific item, but rather just checks to see if one is present in the pack.
So you will have to keep going with a custom way to pick a specific one.


RE: SkillMakeItem Trigger - kn4tseb - 08-06-2014 02:35 PM

Thx skull, gonna try it, by the way BEN, when crafting tailoring items it's neccesary to double click the i_sewing_kit and a target cursor appears, so, is it possible to add a feature for this trigger to refer the item that creats the target???

thanks in advance Smile


RE: SkillMakeItem Trigger - XuN - 08-06-2014 05:09 PM

Well, actually Sphere doesnt store the tool, as Ben said, you can do something like this for example when double clicking a tool:

Code:
ON=@DClick
src.ctag.current_tool=<uid>

ON=@SkillMakeItem
ref1=<ctag0.current_tool>

Adding something to the source will be adding just this, the only difference is that you won't see it XD.


RE: SkillMakeItem Trigger - kn4tseb - 08-07-2014 08:32 AM

Hahahahaha, thats fine, thank you all Smile