Page 1 of 1

Remove HUD

Posted: Wed Oct 14, 2009 11:12 pm
by myers73
So, im messing around with free cam, and then exit. I like playo=ing without the HUD. so i say to myself, run a script to remove it. well here it is, and the HUD is still there.
Hidden/Spoiler:
[code]print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
print("user_script_1: Taking control of ScriptPostLoad()...")

--check for possible loading errors
if us1_ScriptPostLoad then
print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
print("user_script_1: Exited")
return
end

--backup the current ScriptPostLoad function
us1_ScriptPostLoad = ScriptPostLoad

--this is our new ScriptPostLoad function
ScriptPostLoad = function()
print("user_script_1: ScriptPostLoad(): Entered")

--only do these changes when in SP
--if we wanted them done in MP too, we should check to make sure that we are the server's host: ScriptCB_GetAmHost()
if not ScriptCB_InMultiplayer() then
--build the FakeConsole list
ff_rebuildFakeConsoleList()

--do the FakeConsole commands we want to happen each time a new map starts (when ScriptPostLoad() is normally called)
ff_DoCommand( "Lock Vehicles" ) --prevents everyone from entering vehicles (not good on space maps...)
ff_DoCommand( "Remove Award Effects" ) --no more graphical hues or annoying sounds when you get awards
ff_DoCommand( "cheats.nohud_on" ) --removes HUD
ff_healthRegen( 30, "humans" ) --human health regen
--set the max health to 180 for all added unit classes
for i=1,table.getn(uf_classes) do
SetClassProperty(uf_classes, 'MaxHealth', 240)
end


--give humans a health regeneration
--ff_healthRegen( 30, "humans" )

--clear the FakeConsole table to save memory
gConsoleCmdList = {}
end

--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
us1_ScriptPostLoad()
print("user_script_1: ScriptPostLoad(): Exited")
end

print("user_script_1: Have control of ScriptPostLoad()")
else
print("user_script_1: Warning: No ScriptPostLoad() to take over")
print("user_script_1: Exited")
return
end

print("user_script_1: Exited")[/code]

Re: Remove HUD

Posted: Thu Oct 15, 2009 12:10 pm
by Teancum
I know the command to turn the HUD off in the Fake Console is ToggleQOSDisplay, but I don't know that it can be triggered via lua script - I've never had to. If it can that would help with modders who make cutscenes for their maps. Do you know if your script is actually getting run? I see you have a lot of print statements in there for logging.

Re: Remove HUD

Posted: Thu Oct 15, 2009 3:58 pm
by myers73
yes, the script is being run, the health change to 240 for all units is working, but the health regen is not working, it was originally where it is -- out, so i moved it to where it is now. it works on seemingly random AI units, i think only the first time that that particular unit spawns.