Destroying a single type of item
Posted: Mon May 28, 2012 10:30 pm
Hey guys, sorry for being a bother so soon 
right now im doing some custom scripting for my housing system in game, and ive got a function that recognizes "i wish to place a trash barrel" and locks it down, and i want a function that recognizes the speech "i wish to destroy a trash barrel".
i created the script a couple days ago, and its compiles fine and what not. the problem is destroying the actual item, here is the script:
it needs to only be able to destroy a trash barrel (so they cant go on a rampage and destroy other items or destroy other items accidently) but the script will continue from "if (targ.item == trashbarrel)" even if i target the house sign. the second problem is it wont actually destroy the trash barrel
other then that its working fine, does anyone have an idea as to why these errors are happening?
thanks in advance, mat
right now im doing some custom scripting for my housing system in game, and ive got a function that recognizes "i wish to place a trash barrel" and locks it down, and i want a function that recognizes the speech "i wish to destroy a trash barrel".
i created the script a couple days ago, and its compiles fine and what not. the problem is destroying the actual item, here is the script:
Code: Select all
function DestroyTrashBarrel(parms)
var sign := parms[1];
var owner := parms[2];
var trashbarrel := 0x17057;
var homeinfo := GetObjProperty (sign, "homeinfo");
if (!homeinfo)
return;
endif
if (IsInsidetheHouse(owner, sign));
var targ := Target(owner);
if (targ)
if (targ.item == trashbarrel)
SendSysMessage(owner, "passed the second if.", font := _DEFAULT_TEXT_FONT, color := MESSAGE_COLOR_MESSAGE);
DestroyItem(item);
else
SendSysMessage(owner, "You can only destroy trash barrels...", font := _DEFAULT_TEXT_FONT, color := MESSAGE_COLOR_MESSAGE);
endif
elseif (!targ)
SendSysMessage(owner, "Canceled.", font := _DEFAULT_TEXT_FONT, color := MESSAGE_COLOR_MESSAGE);
return;
endif
elseif (!IsInsidetheHouse(owner, sign));
SendSysMessage(owner, "You must be inside your home to use this command!", font := _DEFAULT_TEXT_FONT, color := MESSAGE_COLOR_MESSAGE);
return;
endif
endfunctionthanks in advance, mat