![]() |
always 200 arrows and bolts in backpack - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: always 200 arrows and bolts in backpack (/Thread-always-200-arrows-and-bolts-in-backpack) Pages: 1 2 |
always 200 arrows and bolts in backpack - Berkley - 02-17-2016 06:17 AM i use this function to restock ammo in some npc's backpack (inventar) Spoiler (Click to View) . it is working but it produces some error warnings too Spoiler (Click to View) . How can I stop the Error Messages? Best regards, Lars RE: always 200 arrows and bolts in backpack - Kanibal - 02-17-2016 06:25 AM This will be better Code: [function f_restock_ammo] RE: always 200 arrows and bolts in backpack - pointhz - 02-17-2016 07:04 AM IF (<name> == 'arrows' || 'crossbow bolt') You cant use that. Use instead: IF STRMATCH("<NAME>","arrows") || STRMATCH("<NAME>","crossbow bolt") RE: always 200 arrows and bolts in backpack - Berkley - 02-17-2016 06:06 PM Many thanks again :-) Best regards, Lars RE: always 200 arrows and bolts in backpack - Berkley - 02-17-2016 07:12 PM (02-17-2016 06:25 AM)Kanibal Wrote: This will be better it' working, but i still have some error outputs with your script 10:03:ERROR:(sphere_citizens.scp,3203)Non container uid=04000ffe2,id=0f3f 10:03:ERROR:(sphere_citizens.scp,3202)Can't resolve <rescount.i_arrow> 10:03:ERROR:(sphere_citizens.scp,3202)Undefined symbol '' ['< 200)'] 3202: if (<rescount.i_arrow> < 200) 3203: serv.newitem = i_arrow, <eval 200 - <rescount.i_arrow>>, <uid> perhaps, because i'm using the nightly from Dec 1st 2015? best regards, Lars RE: always 200 arrows and bolts in backpack - karma - 02-17-2016 07:40 PM Use this: Code: [FUNCTION f_restock ammo] RE: always 200 arrows and bolts in backpack - Berkley - 02-17-2016 08:07 PM (02-17-2016 07:40 PM)karma Wrote: Use this: Thank you very much :-) RE: always 200 arrows and bolts in backpack - karma - 02-17-2016 08:10 PM Ouch sorry, i wrote f_restock ammo instead of f_restock_ammo. Code: [FUNCTION f_restock_ammo] Note that 21 is layer_backpack, so it puts directly the items inside it. RE: always 200 arrows and bolts in backpack - Kanibal - 02-17-2016 10:34 PM Here is a short way Code: [CHARDEF my_npc] RE: always 200 arrows and bolts in backpack - karma - 02-17-2016 10:37 PM Your solution won't work if you call f_restock_ammo before adding the arrows to the char, and you should add them to the backpack, not to the char directly. |