First, find the Unit ID of the boss you want to respawn. To get this, extract the war3map.w3u and search for the unit, and display rawcodes, write down the one you find.
Search the war3map.j and find where the boss drops/actions/etc are handled. There are a couple ways this could be done. The first way it could be done is to assign the boss to a Unit variable when the boss is created, and then hardcode each boss function to use this variable. Or they could use a generic Unit event and check that GetUnitTypeId(GetTriggerUnit()) == 'rawcode'. Which method they use will impact how you code the respawn functionality.
Find the death event for that specific unit or unit type. This will also probably be where it drops the items, so you can search for one of the item rawcode/ID and do a search on it to find this if you want. At the very end of the death function for that unit, call a PolledWait(30) or however long you want to wait, then call CreateUnit for the type of the boss that died. For a very basic one, you can respawn the boss at the same location he died by storing the x and y coordinates in a local variable with GetUnitX(unit) and GetUnitY(unit). You also need to manage whatever triggers were linked to this boss. If it's coded generically and uses Unit IDs, then you won't need to do anything. If it uses a specific trigger created for ONLY that boss, then you need to remake those triggers again.
From here, you can get more advanced by using the original location of the boss, rather than the location where it died. You can also add a Timer and a TimerWindow for a respawn delay, but this will be significantly harder.
|