Edit: Realized just now that you made the Debug HUD thread so you already know most of this stuff! *facepalm Oh well it doesn't hurt to have this here for others. Yes in
here and
here, the quake 4 one has some commands that don't work on idtech 4 based on Doom 3, is really a trial and error but i can say that "stoptransitions " only work on Quake 4.
btw I'm more or less stuck on that as well, it seams Doom 3 inventory is hardcoded, for example i tried to use the battery definition that comes with doom 3, to have a functional battery in game but it seams id never made the c++ code necessary to support batteries, by the def existence, they tested that, perhaps for the flashlight but then removed the code and went with a weapon based flashlight, using that def i only get a error on the console.
After have said that i think it IS possible to do a script based inventory, this is what i think one should do:
Make gui for the inventory, make a ingame model to attach that gui to (with a model def or on the editor), using the key/val par:
key - gui
val - guis/gui_name.gui
To change values on the gui, using a script or a trigger, you need to go trough the model where that gui is defined:
the cmd for that is:
1- in the GUI inside a WindowDef you first need to make a special key/val for example:
windowDef TextItemName
{
rect 10,5,50,10
visible 1
text "gui::foo" // gui::valueName, valuename can be anything is just a pointer/placeholder for the value - afaik valueName must be unique between parm's but i could be wrong
textalign 0 // or texalign "gui::valueName"
textscale 0.15
font "fonts/micro"
}
update 1 - gui::valueName can be used in logic operations, for example:
if ("gui::player_armor" <= 0) {
set "Lines1::visible" "0" ;
set "Lines1_1::visible" "1" ;
}
2 - Then use in a script -> $gameObject.setGuiParm("foo","bar"); // foo initial parm value -> bar new parm value
To change values on the GUI directly you use:
// onEvent runs every frame, carefull
onEvent
{
set "TextItemName::text" "foo" ;
}
OnNamedEvent // this seams to be called from the c++ code, didn't found a way, for now, to use this from script or even run this directly from the GUI cmd's like onAction.
Use the normal GUI cmd's for example.
windowDef inventory_slot
{
rect 0,0,77,66
visible 1
background "guis/assets/pda/inventory/inventory_slot"
matcolor 1,1,1,1
float "numbON" 1
//notime 1
onMouseEnter
{
// highlights the button
transition "numb::matcolor" "1 1 1 1" "0.6 0.7 0.7 1" "1000";
}
onMouseExit
{
// un-highlights the button
transition "numb::matcolor" "0.6 0.7 0.7 1" "1 1 1 1" "1000";
}
onAction
{
//set "cmd" "play guisounds_menuclickup" ; // this is not working but seams to be supported by the Doom 3 GUI system!
localSound guisounds_menuclickup; // this works
if ( "inventory_slot::numbON" == 1 )
{
set "numb::visible" "0";
set "inventory_slot::numbON" "0";
set "TextItemName::text" "foo"
}
if ( "inventory_slot::numbON" == 0 )
{
set "numb::visible" "1";
set "inventory_slot::numbON" "1";
set "TextItemName::text" "bar"
}
}