Hud placement

monoman

New member
Does anyone know about the HUD placement? I'm trying to get the game to recognize 3 partner huds instead of 1.

void main()
{
partnerLife();
}

void partnerLife()
{
if (openborvariant("in_level"))
{
void self = getlocalvar("self");
void type = getentityproperty(self, "type");
void partner = getglobalvar("currentPartner"); //IDENTIFY PARTNER 1
void partner2 = getglobalvar("currentPartner1"); //IDENTIFY PARTNER 2
void partner3 = getglobalvar("currentPartner2"); //IDENTIFY PARTNER 3


if (type == openborconstant("TYPE_NPC"))
{
int xIcon = 81;
int yIcon = 2;
int xName = 96;
int yName = 5;
int xLife = 84;
int yLife = 27;

if (getglobalvar("partnerLifeBar") == "full_hud")
{
// Adjust positions for the second and third partners
if (getglobalvar("currentPartner") != NULL())
{ void partner = getentityproperty(self, "defaultname");
xIcon = 160;
yIcon = 2;
xName = 175;
yName = 5;
xLife = 163;
yLife = 27;
}

if (getglobalvar("currentPartner2") != NULL())
{
xIcon += 239;
yIcon += 2;
xName += 254;
yName += 5;
xLife += 242;
yLife += 27;
}

// Draw partner names
void partnerName = getentityproperty(self, "defaultname");
int font = 1;
drawstring(xName + (strwidth("____" + partnerName, font)), yName, font, "CPU");
}

// Rest of your HUD drawing logic here...

// Set HUD positions
changeentityproperty(self, "iconposition", xIcon, yIcon);
changeentityproperty(self, "nameposition", xName, yName);
changeentityproperty(self, "lifeposition", xLife, yLife);
}
}
}
 
I know about HUD setting but I need to know what script you are quoting above. That script is coded with certain logic so you couldn't expand the script without knowing the logic.
OTOH basically a way to display personal stats is for the entity to display those himself/herself/itself either with script or with special command.
If you have 2 or 3 entities who want to do that too (aside of players), you'd need some compromises. The simplest is to share the screen which is dividing screen into 4 sections, first section for player, second for entity 1, third for entity 2 and fourth for entity 3.

IMO that should be enough, unless you want dynamic HUD position. Ex: screen division changes based on number of those active entities.
 
I know about HUD setting but I need to know what script you are quoting above. That script is coded with certain logic so you couldn't expand the script without knowing the logic.
OTOH basically a way to display personal stats is for the entity to display those himself/herself/itself either with script or with special command.
If you have 2 or 3 entities who want to do that too (aside of players), you'd need some compromises. The simplest is to share the screen which is dividing screen into 4 sections, first section for player, second for entity 1, third for entity 2 and fourth for entity 3.

IMO that should be enough, unless you want dynamic HUD position. Ex: screen division changes based on number of those active entities.
it's an ondraw script.
 
Ex: screen division changes based on number of those active entities.

That would be tough, cause you need extra lines to change position and bar length based on active NPCs.
My suggestion is this order:
1. All NPCs have ondrawscript which draws their own lifebar and name.
2. However, the script also has mechanism to decide NPC order aka which NPC is the first, second and so on. That's based on active NPCs so if say the first NPC isn't available in a level, the script will decide the NPC order for this level.
3. The NPC order is then shared via global variable so each NPC knows where their HUD would be.
4. Total number of active NPCs are also shared so each NPC knows how long their lifebar length should be.

That's my suggestion theory.
 
Back
Top Bottom