include library.player_structure; include library.tcg; include library.utils; trigger OnAttach() { checkStructureForRanchHandScript(self); return SCRIPT_CONTINUE; } trigger OnInitialize() { checkStructureForRanchHandScript(self); return SCRIPT_CONTINUE; } boolean checkStructureForRanchHandScript(obj_id self) { if(!isValidId(self) || !exists(self)) return false; obj_id cellId = getCellId(self, tcg.CELL_NAME); if(!isValidId(cellId) || !exists(cellId)) return false; if(hasObjVar(cellId, tcg.RANCHHAND_CELLCHECK) && !hasScript(cellId, tcg.RANCHHAND_CELL_SCRIPT)) return false; attachScript(cellId, tcg.RANCHHAND_CELL_SCRIPT); return true; }