``` unit Q2; interface uses Classes, SysUtils; procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); procedure Main2(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); implementation //取当前角色所在地图怪物数量 procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); var ACount: Integer; begin ACount := Player.Map.MonCount; //地图上的全部怪物总数 ACount := Player.Map.GetMonCountEx('白野猪'); //地图上白野猪总数 end; //根据地图ID取怪物数量 procedure Main2(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); var AMap:TEnvirnoment; ACount: Integer; begin AMap := Gamelib.FindMap('0'); //取比奇 if AMap <> nil then begin ACount := AMap.MonCount; //地图上的全部怪物总数 end; end; end. ```