How to make HUD like in Z4Keepers

Hello, i want to ask how to create a HUD like in Z4Keepers (i know thats a script question, and choosen forum because question seems so complitexited for #clonkscript).
Here is screenshot what i mean

For ClonkRage or OpenClonk? If you want I can explain my Keepers HUD (later when I am home).

The HUD is shown by the “MessageHelper” (Location: Keepers.c4s/MiscObjects.c4d/MessageHelper.c4d) which uses the function “CustomMessage” to show the text at the upper left corner.

On the following webpages you can find a german description of the function:
  http://wiki.nosebud.de/wiki/CustomMessage
  https://crdocs.clonkspot.org/de/sdk/script/fn/CustomMessage.html

English translation for the parameters:
  szText: Message to be displayed.
  pObj: Object above which to display the message. If unspecified or 0, the message is displayed globally.
  iPlr: Number of the player for whom to display the message.
  iOffX, iOffY: Shift of the message horizontally or vertically from origin point (pObj or middle of the screen) in pixels.
  dwColor: Color of message. 0 for white (0xffffff).
  idMenuDecoId: ID of the menu decoration: She will be drawn around the message.
  sSymbol: The symbol of the message. Either a ID (written as string: “FLNT”) or a portrait (“Portrait:[C4ID]::[color(hex.)]::[number]”)
  iFlags: Additional Flags, for example MSG_NoLinebreak (No automatic line break)

If you tell me what you want to script, I could script that for you. I’ve already used the function “CustomMessage” for some descriptions in my EPIC Remake pack.

In addition to what Viktor said, here is the updating function from Keepers:


public func Update()
{
var iPlr=GetOwner();
var c=GetCrew(iPlr);
var msg="";

var hp_regen = LocalN("iLifeRegen", c) * 36;
hp_regen = Format("%d.%02d", hp_regen/1000, (hp_regen % 1000) / 10);

var karma_regen = LocalN("iKarmaRegen", c) * 36;
karma_regen = Format("%d.%02d", karma_regen/100, (karma_regen % 100));

msg=Format("%s<c ffff00>lvl%d</c> <c ff00ff>%d/%d skills</c>|", msg, aLevels[iPlr], GetSkillCount(iPlr), MAX_SKILL_COUNT);
if©msg=Format("%s<c ff0000>%d</c><c ffff00>hp</c>(<c ff0000>+%s</c>) <c 0000ff>%d</c><c ffff00>karma</c>(<c 0000ff>+%s</c>)|", msg, c->GetPhysical("Energy")/1000, hp_regen, aMaxKarmaEnergy[iPlr], karma_regen);
msg=Format("%s<c ee0000>STR: %d</c> / <c 00ee00>AGI: %d</c> / <c 0000ee>INT: %d</c>|", msg, GetStat(iPlr, STR), GetStat(iPlr, AGI), GetStat(iPlr, INT));
msg=Format("%s<c eeee00>Skillpoints:</c> %d|", msg, GetSkillPoints(iPlr));
msg=Format("%s<c eeee00>EXP:</c> %d%|", msg, GetExp(iPlr, true));

for(var i=0;i<GetLength(aSkills[iPlr]);++i)
{
   var skill=aSkills[iPlr];
  var str="";
  var cnt=aSkillLevels[iPlr];

  str=Format("%s<c ffff00>%dx</c>{{%i}}",str,cnt,skill);
  msg=Format("%s%s|",msg,str);
}
msg=Format("@%s", msg);
CustomMessage(msg,0,iPlr,-30,250+GetLength(aSkills[iPlr])*15,0,0,"Portrait::MSGH::110000::1",1);
}

I got how to make HUDs (CustomMessage), thanks for answers

I shall be very thankful if you script that for me. So im going to make a thing what shall show Energy and Magic Energy of every player (clonk) what is in same team, location is under clonk name, it is planned to look this way: ~Mage portrait~ ~Player name~ ~Health icon~ ~Energy of player(clonk)~ ~Magic icon~ ~Magic energy of player(clonk)~, (simular HUD you has made in your edited CMC).

P.S: Of course i can make that all in scoreboard but all players shall see every player energy&magic

Let's try this effect:

global func FxIntTeamDisplayTimer(object pTarget, int iEffectNumber, int iEffectTime)
{
  var i, j, iPlr, iCount, szText, szPortrait, pClonk;
  var aIndex, aMessages;
  iCount = GetPlayerCount();
  aIndex = aMessages = [];
  for(i = 0; i < iCount; i++) {
    aIndex[ i] = GetPlayerByIndex(i);
    CustomMessage("",0,aIndex[ i],0,0,0,0,0,MSG_Top|MSG_Left);
  }
  for(i = 0; i < iCount; i++) {
    iPlr = aIndex[ i];
    pClonk = GetCursor(iPlr);
    szText = Format("@<c e000ff00>%s</c>|<c e0ff0000> %3d/%d Energy</c>|<c e00080ff> %3d/%d M.Energy</c>",
        GetPlayerName(iPlr),GetEnergy(pClonk),GetPhysical("Energy",0,pClonk)/1000,GetMagicEnergy(pClonk),GetPhysical("Magic",0,pClonk)/1000);
    szPortrait = Format("Portrait:%i::%x::%s",GetPortrait(pClonk,true),GetColorDw(pClonk),GetPortrait(pClonk,false));
    for(j = 0; j < iCount; j++) {
      if(Hostile(iPlr,aIndex[j]))
        continue;
      CustomMessage(szText,0,aIndex[j],25+240*(aMessages[j]++),125,0,0,szPortrait,MSG_Top|MSG_Left|MSG_Multiple);
    }
  }
  return true;
}


Just copy that script in your scenario script and add the function
  AddEffect("IntTeamDisplay",0,1,5);
to your scenario Initialize() function and you'll get this teamdisplay:

Oh my god!:shocked: you made it better than i tought thats possible! very well but first bug, when player in combo menu it is looks this (screenshot). And would be nice to: make 2nd 3rd and next players in team under previous one not next to, and removing the current player from team board (if shortly: player dont have to see self in team board). Anyway i can live with that all if you have no time or etc. And yes, thanks!

P.S: How you made it display endless?
P.S.S: And please write it in PM if you can, because many players allready stolen this script x) )

>How you made it display endless?


If the message starts with an "@" then the message is displayed permanently until it is replaced by another message.

Good to know.

May this effect be used by me?

Let's try this:

global func FxIntTeamDisplayTimer(object pTarget, int iEffectNumber, int iEffectTime)
{
  var i, j, iPlr, iCount, szText, szPortrait, pClonk;
  var aIndex, aMessages;
  iCount = GetPlayerCount();
  aIndex = aMessages = [];
  for(i = 0; i < iCount; i++) {
    aIndex[i] = GetPlayerByIndex(i);
    CustomMessage("",0,aIndex[i],0,0,0,0,0,MSG_Top|MSG_Left);
  }
  for(i = 0; i < iCount; i++) {
    iPlr = aIndex[i];
    pClonk = GetCursor(iPlr);
    if(LocalN("pTargetObject",pClonk))
      pClonk = LocalN("pTargetObject",pClonk);
    szText = Format("@<c e000ff00>%s</c>|<c e0ff0000> %3d/%d Energy</c>|<c e00080ff> %3d/%d M.Energy</c>",
        GetPlayerName(iPlr),GetEnergy(pClonk),GetPhysical("Energy",0,pClonk)/1000,GetMagicEnergy(pClonk),GetPhysical("Magic",0,pClonk)/1000);
    szPortrait = Format("Portrait:%i::%x::%s",GetPortrait(pClonk,true),GetColorDw(pClonk),GetPortrait(pClonk,false));
    for(j = 0; j < iCount; j++) {
      if(Hostile(iPlr,aIndex[j]) || iPlr == aIndex[j])
        continue;
      CustomMessage(szText,0,aIndex[j],25,125+75*(aMessages[j]++),0,0,szPortrait,MSG_Top|MSG_Left|MSG_Multiple);
    }
  }
  return true;
}


Fixed:
- Can't see own clonk
- Clonks are sorted vertically
- (Only one) Bug fixed

Hey, that's only a public community! If you wan't to use it, you do not have to ask for it!