umswe.setarchive("umswe\\umswe.mpq")

 -- enable
if umscore then

	-- load required files
	umswe.registertgd("UI\\TriggerData.txt","UI\\TriggerStrings.txt","trig")
	umswe.registerflag("event",0)
	umswe.registerflag("condition",1)
	umswe.registerflag("action",2)
	umswe.registerflag("call",3)
	umswe.registerflag("minversion",0)
	umswe.registerflag("global",1)
	umswe.registerflag("comparable",2)
	
	-- modify trigger type flags
	umswe.settypeflag(trig,"event",global,1)
	umswe.settypeflag(trig,"triggercondition",global,1)
	umswe.settypeflag(trig,"triggeraction",global,1)
	umswe.settypeflag(trig,"boolexpr",global,1)
	umswe.settypeflag(trig,"heroskillcode",global,1)
	umswe.settypeflag(trig,"boolexpr",comparable,1)
	umswe.settypeflag(trig,"heroskillcode",comparable,1)
	
	-- fixed event strings
	umswe.fixtgdstr(trig,event,"","TriggerRegisterDestDeathInRegionEvent","region","rect")
	umswe.fixtgdstr(trig,event,"","TriggerRegisterEnterRectSimple","region","rect")
	umswe.fixtgdstr(trig,event,"","TriggerRegisterLeaveRectSimple","region","rect")
	
	-- fixed action script names
	umswe.setscriptname(trig,action,"","DestroyLightningBJ","DestroyLightning")
	umswe.setscriptname(trig,action,"","DestroyTimerDialogBJ","DestroyTimerDialog")
	umswe.setscriptname(trig,action,"","DialogClearBJ","DialogClear")
	umswe.setscriptname(trig,action,"","RemoveWeatherEffectBJ","RemoveWeatherEffect")
	umswe.setscriptname(trig,action,"","ResetTerrainFogBJ","ResetTerrainFog")
	umswe.setscriptname(trig,action,"","DestroyTextTagBJ","DestroyTextTag")
	umswe.setscriptname(trig,action,"","LoadGameBJ","LoadGame")
	umswe.setscriptname(trig,action,"","RenameSaveDirectoryBJ","RenameSaveDirectory")
	umswe.setscriptname(trig,action,"","RemoveSaveDirectoryBJ","RemoveSaveDirectory")
	umswe.setscriptname(trig,action,"","CopySaveGameBJ","CopySaveGame")
	umswe.setscriptname(trig,action,"","SaveGameCacheBJ","SaveGameCache")
	umswe.setscriptname(trig,action,"","FlushGameCacheBJ","FlushGameCache")
	umswe.setscriptname(trig,action,"","UnitUseItemDestructable","UnitUseItemTarget")
	umswe.setscriptname(trig,action,"","SetItemLifeBJ","SetWidgetLife")
	umswe.setscriptname(trig,action,"","SetItemInvulnerableBJ","SetItemInvulnerable")
	umswe.setscriptname(trig,action,"","SetItemDroppableBJ","SetItemDroppable")
	umswe.setscriptname(trig,action,"","SetItemDropOnDeathBJ","SetItemDropOnDeath")
	umswe.setscriptname(trig,action,"","SetItemPlayerBJ","SetItemPlayer")
	umswe.setscriptname(trig,action,"","DestroyLeaderboardBJ","DestroyLeaderboard")
	umswe.setscriptname(trig,action,"","LeaderboardSetStyleBJ","LeaderboardSetStyle")
	umswe.setscriptname(trig,action,"","DestroyMultiboardBJ","DestroyMultiboard")
	umswe.setscriptname(trig,action,"","DestroyQuestBJ","DestroyQuest")
	umswe.setscriptname(trig,action,"","QuestSetCompletedBJ","QuestSetCompleted")
	umswe.setscriptname(trig,action,"","QuestSetFailedBJ","QuestSetFailed")
	umswe.setscriptname(trig,action,"","QuestSetDiscoveredBJ","QuestSetDiscovered")
	umswe.setscriptname(trig,action,"","QuestSetTitleBJ","QuestSetTitle")
	umswe.setscriptname(trig,action,"","QuestSetDescriptionBJ","QuestSetDescription")
	umswe.setscriptname(trig,action,"","QuestItemSetCompletedBJ","QuestItemSetCompleted")
	umswe.setscriptname(trig,action,"","QuestItemSetDescriptionBJ","QuestItemSetDescription")
	umswe.setscriptname(trig,action,"","DestroyDefeatConditionBJ","DestroyDefeatCondition")
	umswe.setscriptname(trig,action,"","DefeatConditionSetDescriptionBJ","DefeatConditionSetDescription")
	umswe.setscriptname(trig,action,"","FlashQuestDialogButtonBJ","FlashQuestDialogButton")
	umswe.setscriptname(trig,action,"","KillSoundWhenDoneBJ","KillSoundWhenDone")
	umswe.setscriptname(trig,action,"","SetSoundDistanceCutoffBJ","SetSoundDistanceCutoff")
	umswe.setscriptname(trig,action,"","SetSoundPitchBJ","SetSoundPitch")
	umswe.setscriptname(trig,action,"","AttachSoundToUnitBJ","AttachSoundToUnit")
	umswe.setscriptname(trig,action,"","PlayThematicMusicBJ","PlayThematicMusic")
	umswe.setscriptname(trig,action,"","DestroyEffectBJ","DestroyEffect")
	umswe.setscriptname(trig,action,"","IssueTargetDestructableOrder","IssueTargetOrder")
	umswe.setscriptname(trig,action,"","IssueTrainOrderByIdBJ","IssueImmediateOrderById")
	umswe.setscriptname(trig,action,"","IssueUpgradeOrderByIdBJ","IssueImmediateOrderById")
	umswe.setscriptname(trig,action,"","IssueTargetItemOrder","IssueTargetOrder")
	umswe.setscriptname(trig,action,"","ForGroupMultiple","ForGroupBJ")
	umswe.setscriptname(trig,action,"","GroupTargetDestructableOrder","GroupTargetOrder")
	umswe.setscriptname(trig,action,"","GroupItemTargetOrder","GroupTargetOrder")
	umswe.setscriptname(trig,action,"","GroupTrainOrderByIdBJ","GroupImmediateOrderById")
	
	-- removed script names
	umswe.setscriptname(trig,action,"","IssueTargetOrder","")
	umswe.setscriptname(trig,action,"","IssuePointOrderLoc","")
	umswe.setscriptname(trig,action,"","IssueImmediateOrder","")
	umswe.setscriptname(trig,action,"","GroupTargetOrder","")
	umswe.setscriptname(trig,action,"","GroupPointOrderLoc","")
	umswe.setscriptname(trig,action,"","GroupImmediateOrder","")
	
	-- fixed action strings
	umswe.fixtgdstr(trig,action,"","SetDoodadAnimationRectBJ","region","rect")
	umswe.fixtgdstr(trig,action,"","SetCameraBoundsToRectForPlayerBJ","region","rect")
	umswe.fixtgdstr(trig,action,"","EnumDestructablesInRectAllMultiple","region","rect")
	umswe.fixtgdstr(trig,action,"","EnumDestructablesInRectAll","region","rect")
	umswe.fixtgdstr(trig,action,"","AddWeatherEffectSaveLast","region","rect")
	umswe.fixtgdstr(trig,action,"","SetBlightRectBJ","region","rect")
	umswe.fixtgdstr(trig,action,"","EnumItemsInRectBJMultiple","region","rect")
	umswe.fixtgdstr(trig,action,"","EnumItemsInRectBJ","region","rect")
	umswe.fixtgdstr(trig,action,"","MoveRectToLoc","region","rect")
	umswe.fixtgdstr(trig,action,"","SetStackedSoundBJ","region","rect")
	umswe.fixtgdstr(trig,action,"","ShowUnitHide","region","rect")
	umswe.fixtgdstr(trig,action,"","ShowUnitShow","region","rect")
	umswe.fixtgdstr(trig,action,"","CreateFogModifierRectBJ","region","rect")
	umswe.appendtgdcaption(trig,action,"","DisplayTextToForce","(Auto-Timed)")
	umswe.appendtgdcaption(trig,action,"","DisplayTimedTextToForce","(Explicitly Timed)")
	
	-- fixed call script names
	-- umswe.setscriptname(trig,call,"integer","UnitInventorySizeBJ","UnitInventorySize")
	-- umswe.setscriptname(trig,call,"real","GetLightningColorABJ","GetLightningColorA")
	-- umswe.setscriptname(trig,call,"real","GetLightningColorRBJ","GetLightningColorR")
	-- umswe.setscriptname(trig,call,"real","GetLightningColorGBJ","GetLightningColorG")
	-- umswe.setscriptname(trig,call,"real","GetLightningColorBBJ","GetLightningColorB")
	-- umswe.setscriptname(trig,call,"string","GetAbilityName","GetObjectName")
	-- umswe.setscriptname(trig,call,"string","GetAbilityEffectBJ","GetAbilityEffect")
	-- umswe.setscriptname(trig,call,"string","GetAbilitySoundBJ","GetAbilitySound")
	-- umswe.setscriptname(trig,call,"heroskillcode","GetLearnedSkillBJ","GetLearnedSkill")
	
	-- fixed call strings
	umswe.fixtgdstr(trig,call,"boolean","RectContainsItem","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","RectContainsUnit","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","IsUnitGroupInRectBJ","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectCenterX","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectCenterY","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectMinX","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectMinY","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectMaxX","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectMaxY","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectWidthBJ","region","rect")
	umswe.fixtgdstr(trig,call,"real","GetRectHeightBJ","region","rect")
	umswe.fixtgdstr(trig,call,"location","GetRectCenter","region","rect")
	umswe.fixtgdstr(trig,call,"location","GetRandomLocInRect","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","OffsetRectBJ","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","Rect","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","RectFromLoc","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","GetEnteringUnit","region","rect/region")
	umswe.fixtgdstr(trig,call,"boolean","GetLeavingUnit","region","rect/region")
	umswe.fixtgdstr(trig,call,"boolean","RandomDestructableInRectSimpleBJ","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","RandomDestructableInRectBJ","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","RandomItemInRectSimpleBJ","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","RandomItemInRectBJ","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","GetUnitsInRectAll","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","GetUnitsInRectOfPlayer","region","rect")
	umswe.fixtgdstr(trig,call,"boolean","GetUnitsInRectMatching","region","rect")
	
	-- improved call hints
	umswe.appendtgdhint(trig,call,"location","GetRectCenter","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetRandomLocInRect","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","OffsetLocation","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","PolarProjectionBJ","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","CameraSetupGetDestPositionLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetCameraTargetPositionLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetCameraEyePositionLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","Location","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetDestructableLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetOrderPointLoc","Save it to a variable and later remove it")
	umswe.appendtgdhint(trig,call,"location","GetSpellTargetLoc","Save it to a variable and later remove it")
	umswe.appendtgdhint(trig,call,"location","GetItemLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","WaygateGetDestinationLocBJ","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetPlayerStartLocationLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetUnitLoc","The point has to be saved in a variable in order to use it and then removed to prevent memory leaks")
	umswe.appendtgdhint(trig,call,"location","GetUnitRallyPoint","Save it to a variable and later remove it")
	
	umswe.appendtgd(trig,"umswe\\TriggerDataAddon.txt", "umswe\\TriggerStringsAddon.txt") -- add all the new stuff

else -- disable
	
	umswe.deletefile("UI\\TriggerData.txt")
	umswe.deletefile("UI\\TriggerStrings.txt")
	
end
