AI Scripting ui Project Source Code Changes

 

The following source code changes are required in the ui project to support AI scripting. As with the rest of the Single Player Game tutorial, these changes will be for the TA scripted menu system rather than the regular Quake 3 UI. For those who don't wish to make these changes to the source they have been included in the latest version of the UI avalible on the Downloads page as a dll/qvm and as source code.

The changes made to the UI are to allow the AI scripting to implement an end of game command. When this script command is executed it terminates the game and returns the player to the end game menu. This menu is set, by default to endofGame but it can be changed in the assetGlobalDef section. If this menu does not exist then the player is returned to the main menu.

In ui_main.c in function _UI_SetActiveMenu about line 5831 add :

      trap_Cvar_Set("com_errorMessage", "");
}
}
// ai script
if(trap_Cvar_VariableValue("gameover")==1)
{
if(Menus_FindByName(uiInfo.uiDC.Assets.endname))
Menus_ActivateByName(uiInfo.uiDC.Assets.endname);
else
Menus_ActivateByName(uiInfo.uiDC.Assets.mainname);
}
// end ai script

return;
case UIMENU_TEAM:
trap_Key_SetCatcher( KEYCATCH_UI );

In ui_main.c about line 6289 add :

vmCvar_t	Save_Loading;
vmCvar_t persid;
vmCvar_t gameover; // ai script

In ui_main.c about line 6431 add :

{ &Save_Loading, "Save_Loading", "0", CVAR_INIT},
{ &persid, "persid", "0", CVAR_INIT},
{ &gameover, "gameover", "0", CVAR_INIT}, // ai script


Return to Home Page