UserFunction; Player_BequeathResearch - HWRM/KarosGraveyard Wiki

Description

Transfers all of Player1's completed research to Player2.

function Player_BequeathResearch(iPlayer1, iPlayer2)
    local iRace1 = Player_GetRace(iPlayer1) + 1
    local iRace2 = Player_GetRace(iPlayer2) + 1
    if (iRace1 == iRace2) then
        dofilepath([[data:scripts/building and research/]] .. races[iRace1][1] .. [[/research.lua]])
        for k, iCount in research do
            if ((Player_HasResearch(iPlayer1, iCount.Name) == 1) and (Player_HasResearch(iPlayer2, iCount.Name) == 0)) then
                Player_GrantResearchOption(iPlayer2, iCount.Name)
            end
        end
    else
        print("Player" .. iPlayer1 .. " and Player" .. iPlayer2 .. " are of different races.")
    end
end

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial