DeathStalker908
06-04-2010, 11:44 PM
Now you can see other people's health! /OMGGASP
Instructions:
1) Make a new file from Notepad/Wordpad (or anything similar to those 2) and call it HP.lua.
2) Paste the code below into HP.lua and save it under Crowns of Power -> Main -> Addons
function onLoaded()
-- Writes a msg when you first log in
status("HP bar loaded.");
end
addChatCommand("hp");
function chatcmd_hp()
showDialog("HealthAddon")
end
3) Now in the Addons folder, make a new folder called Ui if it doesn't already exist
4) Make a new file and name it HealthAddon.gui
5) Copy + paste the code below into the HealthAddon.gui and save it in Crowns of Power -> Main -> Addons -> Ui
//--- OBJECT WRITE BEGIN ---
new GuiControl(HealthAddon) {
canSaveDynamicFields = "0";
Profile = "GuiModelessDialogProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "640 480";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl(HealthWindow) {
canSaveDynamicFields = "0";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "190 50";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Health Addon";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(HealthAddon); cancel($TehUpdate);";
new GuiTextCtrl(TargetNameText) {
canSaveDynamicFields = "0";
Profile = "GuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "43 41";
Extent = "97 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "";
maxLength = "1024";
};
new GuiProgressCtrl(healthBar) {
canSaveDynamicFields = "0";
Profile = "GuiProgressProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "33 27";
Extent = "119 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "1024";
};
};
};
//--- OBJECT WRITE END ---
function HealthAddon::onWake(%this)
{
HealthAddon.updateFields(%this);
}
function HealthAddon::updateFields(%this)
{
%zyf = getLocalPlayer().getControllingClient().getSelecte dObject().getMaxHP();
%xfa = getLocalPlayer().getControllingClient().getSelecte dObject().getCurrentHP();
%bas = getLocalPlayer().getControllingClient().getSelecte dObject().getShapeName();
TargetNameText.text = "Target Name:" SPC %bas;
//TargetHealth.text = %currHP;
healthBar.setValue(%xfa/%zyf);
healthBar.text = %xfa SPC "/" SPC %zyf SPC "(" @ roundNumber(%xfa/%zyf*100) @ "%)";
$TehUpdate = %this.schedule(100, updateFields);
}
6) Log into CoP, type /hp, and enjoy :O
PS: When you don't have a selected target, it is normal for the HP bar/target name to flicker with weird text
Edit 2: Now the command doesn't have to be capitalized, so you can just type /hp rather than /HP
Instructions:
1) Make a new file from Notepad/Wordpad (or anything similar to those 2) and call it HP.lua.
2) Paste the code below into HP.lua and save it under Crowns of Power -> Main -> Addons
function onLoaded()
-- Writes a msg when you first log in
status("HP bar loaded.");
end
addChatCommand("hp");
function chatcmd_hp()
showDialog("HealthAddon")
end
3) Now in the Addons folder, make a new folder called Ui if it doesn't already exist
4) Make a new file and name it HealthAddon.gui
5) Copy + paste the code below into the HealthAddon.gui and save it in Crowns of Power -> Main -> Addons -> Ui
//--- OBJECT WRITE BEGIN ---
new GuiControl(HealthAddon) {
canSaveDynamicFields = "0";
Profile = "GuiModelessDialogProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "640 480";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl(HealthWindow) {
canSaveDynamicFields = "0";
Profile = "GuiWindowProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "190 50";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Health Addon";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(HealthAddon); cancel($TehUpdate);";
new GuiTextCtrl(TargetNameText) {
canSaveDynamicFields = "0";
Profile = "GuiTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "43 41";
Extent = "97 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "";
maxLength = "1024";
};
new GuiProgressCtrl(healthBar) {
canSaveDynamicFields = "0";
Profile = "GuiProgressProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "33 27";
Extent = "119 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "1024";
};
};
};
//--- OBJECT WRITE END ---
function HealthAddon::onWake(%this)
{
HealthAddon.updateFields(%this);
}
function HealthAddon::updateFields(%this)
{
%zyf = getLocalPlayer().getControllingClient().getSelecte dObject().getMaxHP();
%xfa = getLocalPlayer().getControllingClient().getSelecte dObject().getCurrentHP();
%bas = getLocalPlayer().getControllingClient().getSelecte dObject().getShapeName();
TargetNameText.text = "Target Name:" SPC %bas;
//TargetHealth.text = %currHP;
healthBar.setValue(%xfa/%zyf);
healthBar.text = %xfa SPC "/" SPC %zyf SPC "(" @ roundNumber(%xfa/%zyf*100) @ "%)";
$TehUpdate = %this.schedule(100, updateFields);
}
6) Log into CoP, type /hp, and enjoy :O
PS: When you don't have a selected target, it is normal for the HP bar/target name to flicker with weird text
Edit 2: Now the command doesn't have to be capitalized, so you can just type /hp rather than /HP