How to get hull value in code ?
-
well you have to make sure the armour is on there ship
then do a ReqHullStatus that will give you there hull status
then you have to setup a timer for the regen part of it
basicly the time it will take for the regen to happen
then use SetRelativeHealth and add a bit on till it reaches the top
infact i might have a go at it ill let you know how i get on -
well you have to make sure the armour is on there ship
then do a ReqHullStatus that will give you there hull status
then you have to setup a timer for the regen part of it
basicly the time it will take for the regen to happen
then use SetRelativeHealth and add a bit on till it reaches the top
infact i might have a go at it ill let you know how i get onThanks for your kind.
If you finish it, may you can share it ?
-
http://fl-onslaught.com/FLHook_FTL_Regen.zip
have fun let me know how you get on with it ::)
its prity easy to use just make a list up of the Regen stuff
and enter it like so
[HullRegens]
li_turret01_mark01=5000
5000 is the time taken for it to Regen you can use Any object thats just a example
it repairs 2 segments at a time
if your using it on things like BS ships you have to set it prity high
and make sure the players cant mount fighter Regen’s on BS ships
you will find out what i mean when you use it -
-
Hi kosacid:
I have some question:
1.The [HullRegens] li_turret01_mark01=5000, I know the li_turret01_mark01 is a regen able item, but the 5000 is 5 seconds or not ? and its mean is when the li_turret01_mark01 get some hit, it need 5 seconds to regen, right ?
2.I can’t understand what’s “[FTLRestrictions] li_freighter” mean, may you can tell me that ?
3.What’s the “[FTLTimer] FTLTimer=600” of 600 mean ? is minute or seconds ? what’s function it can do ?
Thanks for your help.
-
yes its time in seconds for every regen
[FTLRestrictions] li_freighter means on that ship can ftl
FTL timers is seconds as well the higher the long it takes to charge
the ftl comands are
/ftl 0 0 0 is the default when you target a jh or gate it will dock with it and then you jump to chords 0 0 0
/sftl 0 0 0 will let you jump around in the system your in
/chords will give you exact chords of a object you want to jump to -
"Settings.cpp void LoadSettings()" IniGetSection(set_scCfgFile, "HullRegens", lstRegenDevice); "Settings.cpp setting variables" list <inisectionvalue>lstRegenDevice; "global.h // setting variables" extern list <inisectionvalue>lstRegenDevice; "HKFuncplayers.cpp" HK_ERROR HkInitArmourRegen(uint iClientID) { ClientInfo[iClientID].bCanRegen = false; wstring wscCharname = Players.GetActiveCharacterName(iClientID); list <cargo_info>lstEquipment; int iRemaining; if (HKHKSUCCESS(HkEnumCargo(wscCharname,lstEquipment,iRemaining))) { foreach(lstEquipment, CARGO_INFO, it) { if((*it).bMounted) { foreach(lstRegenDevice,INISECTIONVALUE,it2) { uint iRegenDevice = CreateID((*it2).scKey.c_str()); if ((*it).iArchID == iRegenDevice) { set_ArmourRegenTime = atoi(Trim(GetParam((*it2).scValue, ',', 0)).c_str()); ClientInfo[iClientID].tmRegenTime = timeInMS() + set_ArmourRegenTime; ClientInfo[iClientID].bCanRegen = true; }}}}} return HKE_OK; } "HKCbIServerImpl.cpp PlayerLaunch" HkInitArmourRegen(iClientID); "Hook.h // HkFuncPlayers" HK_ERROR HkInitArmourRegen(uint iClientID); "CLIENT_INFO" //Armour Regen bool bCanRegen; mstime tmRegenTime; "// HkTimers" void HkTimerArmourRegen(); "HkCbIServerImpl.cpp TIMER Timers[] =" {HkTimerArmourRegen, 500, 0}, "HkInit.cpp clear the clientinfo" ClientInfo[iClientID].tmRegenTime = 0; "HkTimers.cpp" //Armour Regen void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<0.9f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} }}}}catch(...) { AddLog("Exception in %s", __FUNCTION__);}}</cargo_info></inisectionvalue></inisectionvalue>
-
Hi kosacid:
Thanks for your reply and time.
You mean that the regen function only can let a ship hull regen, its not an item that can equipment to any ship, and let the ship has regen function ?
If is, how to change it to an item to achieve above function ?
My mod players love your work, we are appreciate your hard work, and I will add your name to my mod let everyone know that’s your help to make the game has more funny.
Here is link that thanks your work in my forum:
-
I find if you change HkTimers.cpp code:
void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<1.0f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} } } } } catch(...) { AddLog("Exception in %s", __FUNCTION__);} }
to:
void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); /*if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;}*/ if (Regen<1.0f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} } } } } catch(...) { AddLog("Exception in %s", __FUNCTION__);} }
will be better.
-
if (Regen<0.19f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.29f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.39f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.49f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.59f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.69f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.79f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.89f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<0.99f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} ```how about that ill look into the extended hold
-
here a way i thought about doing it
using a command
say like /compress cargo
hook will then right it to the players file and destroy the cargo in the hold
then you can load up again with more
when you get to where your going sell the cargo then
do the command /uncomprss cargo
then hook will read the players file and put the cargo back in the hold
this way you can double you cargo holds capacity
all you have to do is make sure a device is on board for the player to be able to do it
you want to give it a go ???