So im writing a pot chugging script. The issue im having is when my character is holding a two handed weapon, the script will not disarm. However, when i step through the script line-by-line, the disarm works. I dont know where the error is.
sub ConsumeItem
while h in #charstatus || #LLIFTEDKIND = 1
{
wait 0
}
Finditem %1 C_ , #backpackid
retry:
if %1 = ZLF
{
event macro 58 0
goto skip
}
gosub TM_AdvJournalSync Apple
set #lobjectid #findid
event macro 17 0
if %1 = CBS
{
gosub TM_AdvJournalScan Apple VALID not_strong_enough
wait 10
if #result = #TRUE
{
goto retry
}
}
if %1 = NUF
{
gosub TM_AdvJournalScan Apple VALID free_hand
wait 10
if #result = #TRUE && %Disarm = #true
{
gosub Disarm
goto retry
}
if %disarm = #false
{
event ExMsg #charid 0 2498 Can't use cure pot with two handed weapon!
}
if %Disarmed = #true
{
set %Disarmed #false
event macro 37 0
wait 10
}
skip:
wait 10
return
sub Disarm
finditem %weapon C_ , #charid
set %CurWep #findid
exevent drag %CurWep
wait 10
exevent dropc #backpackid
wait 10
return