Not logged inOpenClonk Forum
Up Topic [QUESTION] Potion brewing

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Caesar
Only players can own buildings, not teams. If I wanted to make the first player owner of the building, I'd do it like:

building->SetOwner(GetPlayerByTeam(team, 0));

global func GetPlayerByTeam(int team, int index) {
  var i;
  for(i = 0; i < GetPlayerCount(); ++i) {
    var player = GetPlayerByIndex(i);
    if(GetPlayerTeam(player) == i)
      if(!index)
        return player;
      else
        --index;
  }
  return NO_OWNER; // [EDIT]
}

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill