I received a lot of good help on this code and eventually got it to load withou slic errors but still its not working as intended (in fact not at all). Can anyone provide some help on this?
My next bet is to change it from disband to sleep because maybe disband is causing the problem but sleep is kind of important in enemy territory.
Code:
HandleEvent(DisbandUnit) 'GiftUnit' pre { unit_t tmpUnit; location_t tmpUnitLoc; int_t tmpUnitType; int_t tmpWe; int_t tmpThey; unit_t tmpNewUnit; tmpUnit = unit[0]; tmpUnitType = unit[0].type; tmpUnitLoc = unit[0].location; tmpWe = unit[0].owner; tmpThey = CellOwner(tmpUnitLoc); if (tmpThey > 0 && tmpThey != tmpWe) { // Alternative options: // if(HasAgreement(tmpWe, tmpThey, 36)) { // 36 = Military Pact // if(HasAgreement(tmpWe, tmpThey, 38)) { // 38 = Alliance if (!(AtWarWith(tmpWe, tmpThey))) { KillUnit(tmpUnit); CreateUnit(tmpThey, tmpUnitType, tmpUnitLoc, 0, tmpNewUnit); } } }
Comment