Rayeko
Programmer
- Joined
- Apr 9, 2008
- Messages
- 185
- Reaction score
- 3
Hi,
Well, Im making a script, and it doesn't matter how I put it, it never works..
What the script does, is that when casted it'll check if target is close to any kind of tree/bush, if it returns true, then the target is poisoned. The ONLY way I can do to make it work is by adding one by one like: "" if check.itemid == 2767 ..." but they're like 200~ items so it will be such a problem to make all that u,u
Heres the script:
As I said, the script only works if I put like "if check.itemid == 2767 then.."
If someone can help and tell me whats wrong with it, I'll appreciate![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Thanks in advance ;D
Well, Im making a script, and it doesn't matter how I put it, it never works..
What the script does, is that when casted it'll check if target is close to any kind of tree/bush, if it returns true, then the target is poisoned. The ONLY way I can do to make it work is by adding one by one like: "" if check.itemid == 2767 ..." but they're like 200~ items so it will be such a problem to make all that u,u
Heres the script:
Code:
local poison = createConditionObject(CONDITION_POISON)
setConditionParam(poison, CONDITION_PARAM_DELAYED, true)
setConditionParam(poison, CONDITION_PARAM_MINVALUE, -50)
setConditionParam(poison, CONDITION_PARAM_MAXVALUE, -120)
setConditionParam(poison, CONDITION_PARAM_STARTVALUE, -5)
setConditionParam(poison, CONDITION_PARAM_TICKINTERVAL, 4000)
setConditionParam(poison, CONDITION_PARAM_FORCEUPDATE, true)
function onUse(cid, item, frompos, item2, topos)
target = getCreatureTarget(cid)
targetpos = getCreaturePosition(target)
local able = 0
treesid = {5156,5157,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2717,2718,2719,2720,2722,2725,2726,4006,4007,4008,4009,4014,4015,4016,4017,4019,4020,4021,4022,4023,4024,4025,4026,4028,4030,4031,4032,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4136,4141,4142,4143,4144,4145,4146,4147,4148,4149,4159,4160,4161,4162,4163,4164,4165,4166,4185,7020,7021,7022,7023,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,5390,5391,5392,5393,5394,5395,5396,5397,5398,5399,8797,6423,6424,6425,6426,6427,6428,6429,6430,6431,6432,8139,7024,5093,5094,5095,5096,11709,11710,11711,11712,11713,11714,11715,11716,11717,11718,11719,11720,11721,11485,11486,10911,10912,10869,10870,10871,10872,10873,10874,10875,10876,10877,10792,10793,10794,10795,10796,10797,10798,10799,10800,10801,10802,10803,10804,10805,10786,10787,10777,10778,10727,10728,10729,10730,10731,10732,10733,10504,10505,10506,10143,8313,8314}
bushesid = {2767,2768,2769,2785,2786,2784,4018,4010,4012,4011,4013,4136,4138,4150,4151,4139,4140,11697,11698,11699}
if target > 0 then
for XX = -2, 2 do
for YY = -2, 2 do
for XY = 1, 3 do
check = getThingFromPos({x=(targetpos.x)+XX, y=(targetpos.y)+YY, z=targetpos.z, stackpos=XY})
for tree = 1, 193 do
if check.itemid == treesid[tree] then
isable = 1
break
end
end
for bush = 1, 20 do
if check.itemid == bushesid[bush] then
isable = 1
break
end
end
end
end
end
if able == 1 then
return doTargetCombatCondition(0, target, poison, CONST_ME_NONE)
else
doPlayerSendCancel(cid,"The target isn't close to the nature.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return FALSE
end
else
doPlayerSendCancel(cid,"You must target a creature.")
doSendMagicEffect(getCreaturePosition(cid), 2)
return FALSE
end
end
As I said, the script only works if I put like "if check.itemid == 2767 then.."
If someone can help and tell me whats wrong with it, I'll appreciate
Thanks in advance ;D