Tactical Aid

From WiCWiki

Jump to: navigation, search

Contents

  • When you finished this lesson your TA menu will be active with points and a bunch of TAs.


Tactical aids

Tactical aids are a big and fun part of WiC. There is a bunch of TAs, each of them suitable for different situations and game play. For example, it is not a good idea to add the napalm strike if you don’t want the player to be able to move through forest.


The first thing we have to do is to make sure we can se the TA menu which is hidden by default.

This is the code for making it visible and we write it in the wic\maps\mapname\python\server.py file. The parameter is simply which of the GUI elements you will show.

theGame.ShowGUIChunk( 'support' )

If you start the game you will have a TA menu that looks like this if you open it.


Image:Tactical_aid_001.jpg

This is the code if you want to hide it.


theGame.HideGUIChunk( 'support' )


How to remove TAs and clear the menu

In this example we don’t want the default tactical aids, the ones you can see in the picture. To remove them you have to use a line of code. The same code is used if you want to clear the TA menu during a map as well.


The code you have to write to clear the menu, with or without a queue:

queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].ClearSupportWeapons )
thePlayers[ PLAYER_HUMAN ].ClearSupportWeapons( )

You don’t have to write it in the same place as the ShowGUIChunk code. Now you will have a reinforcements menu that looks like this and won’t open if you click it.

Image:Tactical_aid_002.jpg

All the TAs is listed in the supportweapons.juice file which you can find here

root\maps\supportweapons.juice 


Add tactical aids to the menu

The code to add TAs to the menu is pretty simple. It looks like this without the queue.

thePlayers[ PLAYER_HUMAN ].AddSupportWeapon( 'Bunkerbuster_NATO' )
thePlayers[ PLAYER_HUMAN ].AddSupportWeapon( 'HeavyArtilleryBarrage_NATO' )
thePlayers[ PLAYER_HUMAN ].AddSupportWeapon( 'DaisyCutter_NATO' )
thePlayers[ PLAYER_HUMAN ].AddSupportWeapon( 'TacticalNuke_NATO' )

It is pretty much the same if you use a queue.

queMyQueue.AddFunction( thePlayers[ PLAYER_HUMAN ].AddSupportWeapon, 'DaisyCutter_NATO' )


The name is simply the name of the tactical aid from the supportweapons.juice. When it’s TA added to the player like in this example make sure that it is the right faction “_NATO” in this case, else it won’t work.


We will cover the AIs TA and TA you can place yourself later.


It might be a good idea to add an event string to let the player know that he now can use tactical aids. The predefined script event about that you can use the TA menu is...

AddScriptEventAll('myTAMenu’)

You can read more about this in the chapter about event strings.

Try it out!

You can place this code either in allunits.py for example in the Player function (without the action queue) or in your server.py file. Just make sure you have the ShowGuiChunk function and that you call the function with this code. Now you can start the game and take a look at your tactical aid menu.

queMyque.AddFunction( theGame.ShowGUIChunk, 'support' )
queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].ClearSupportWeapons )
queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].AddSupportWeapon, 'Bunkerbuster_NATO' )
queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].AddSupportWeapon, 'HeavyArtilleryBarrage_NATO' )
queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].AddSupportWeapon, 'DaisyCutter_NATO' )
queMyque.AddFunction( thePlayers[ PLAYER_HUMAN ].AddSupportWeapon, 'TacticalNuke_NATO' )
queMyque.Execute()

Image:Tactical_aid_003.jpg

It should look something like this (except from the TA points which we will cover in the next paragraph).


If you add new tactical aids to the player during the game there’s an excellent event string you can use. It contains the phrase "New tactical aid added".

queLastStandStart.AddEventString( 'myNewTA' )    


Some information about TA points

By default TA points trickle in as you kill enemies or takes command points. It’s a good if not necessary thing to have a max limit of TA points accessible to the player.

The code looks like this.

thePlayers[PLAYER_HUMAN].myMaxTacticalAid = 40

The function “AddTAToPlayer” will increase the players max limit of TA points. If you send in a negative value the players TA points will decrease.

queDestroyHideoutsComplete.AddFunction( AddTAToPlayer, 60 )

There is an event string that we often use in combination with “AddTAToPlayer”.

queDestroyHideoutsComplete.AddEventString( 'myTACapRaised' )

If you want to give the player points to use, not the cap here, the points you usually earn by kill enemies or take command points, the code looks like this.

thePlayers[PLAYER_HUMAN].myTacticalAid = 100

This will not affect the players’ points if the max value is reached.


Goodie TAs

We as gods of the maps can add ambient explosions which we call ‘Goodie TA’. This is tactical aids added by us for different reasons for example to destroy objects or just for the look of it. Check it out in the chapter ‘The beauty of destruction or how we set us up the bomb’.


Appendix

Changed files in this chapter:

Allunits.py

Changes in the allunits.py file.


def Player( ):

    [More code here.]

    thePlayers[ PLAYER_HUMAN ].myCurrentAP = ( thePlayers[ PLAYER_HUMAN ].myMaxAP - GetUnitCost( [ 'NATO_Tank_Leopard2', 'NATO_Tank_Leopard2' ] ) )

    # Set Tactical aid point cap.
    thePlayers[PLAYER_HUMAN].myMaxTacticalAid = 40

    # Add units to the reinforcements meny
    [More code here.]
Chapter 12: Secondary Objective < > Chapter 14: Debug Viewer
Personal tools
User Created Content