Auto-translated
In general, the implementation with a looped check is not the most optimal option.
Something like this, perhaps (haven't checked in the game)
It doesn't help; the problem remains the same – the quest doesn't fail, no one loses, and the console doesn't show any errors.
And the "1" is there because the quest fails for the first player.
function onObjectCapture( prevOwner, newOwner, hero, object )
if prewOwner == PLAYER_3 and newOwner == PLAYER_2 then
Trigger( OBJECT_CAPTURE_TRIGGER, 'houseElf', nil )
SetObjectiveState ('q4', OBJECTIVE_FAILED, PLAYER_1 )
sleep(10)
Loose()
end
end
Trigger(OBJECT_CAPTURE_TRIGGER, 'houseElf', 'onObjectCapture' )