The Beauty of Destruction

From WiCWiki

Jump to: navigation, search

Contents

The Beauty of Destruction

This chapter will be dedicated to destruction in the form of Tactical Aids, but also the protection/destruction of buildings and other map objects.

The Rain of Doom (Or scripted Tactical Aid) If you have played World in Conflict you may be prepared to agree with me that the explosions and tactical aid graphics looks really awesome. To be able to take control of all the destruction and graphical goodies the TA’s will deliver, the TA_Wrapper was created.


This section will start with an explanation of the different parts of the wrapper and then give an example how to create and start a terrifying RAIN OF DOOM.


The TA_Wrapper looks like this:

TA_Wrapper ( aTAName, anAreaList, aAmount, aDelay, aTimer, aAllowedIterations, aDirection )


aTAName

This is a string, the name of the TA you want to call down.

All the names can be found in the supportweapons.juice file located in the wic\maps folder.

aAreaList

This is a list of areas the TA’s will drop down in. If there is more then one area in the list, the TA will randomly pick one. [ ‘aArea1’, ‘aArea2’ ]

aAmount

This is an integer deciding how many TA’s that will be dropped.

aDelay

This is an integer setting the timeframe in which anAmount of TA’s will be spread out and dropped in.

aTimer

This is an integer setting the time when the wrapper iterates and start the whole process again: repeating itself. This will only apply if anAllowedIterations is more than 1.


aAllowedIterations

This integer decides the number of times the wrapper will repeat itself.

-1 will set the repeat to infinite.

aDirection

This is a direction vector setting the incoming direction of the TA. If set to None the incoming direction will be random.


Wrapper Setup

Now that we have all the components presented, we will slowly build the TA_Wrapper. For the first parameter, we open the wic\maps\supportweapons.juice and then start behaving like a kid in a candy store. Which Tactical Aid should one chose? Will it be used only as map decoration or will it have a more damage/story driven use? Many questions may popup when choosing the right TA, but for this example I will chose the soviet Heavy Artillery Barrage. Parameter two is the list of areas to drop the TA in. Place areas in WICED and add them in your list. I will add four areas to my list.


At this stage the wrapper looks like this:


TA_Wrapper( ‘SINGLEPLAYER_HeavyArtilleryBarrage_USSR’, [ ‘aTAArea1’, ‘aTAArea2’, ‘aTAArea3’, ‘aTAArea4’ ], ?, ?, ?, ?, ? )


The next parameter, aAmount, I will set to 3. As with other parameters in the TA_Wrapper, you have to take in consideration the main usage of the TA and choose after that.

The next decision I take is to have the TA’s drop down every minute and then have them start dropping within a 10 sec timeframe each time. The timeframe will give a small displacement so not all three of the TA’s will drop at the same time.

I also want this heavy artillery barrage to continue until I say it to stop, so I set the aAllowedIterations parameter to -1.

The last parameter I don’t really care about in this case. But if it had been for example a napalm TA you might want a more exact direction to make the most of it. I will put None here, but you can leave it altogether.

The Wrapper should now look like this.

TA_Wrapper( ‘SINGLEPLAYER_HeavyArtilleryBarrage_USSR’, [ ‘aTAArea1’, ‘aTAArea2’, ‘aTAArea3’, ‘aTAArea4’ ], 3, 60, 10, -1, None )


Next I will put the Wrapper in a variable. Primary I do this for my own sake, for handling and control. But it is also important to for save/load reasons. I add this to mapvars.py.


HardRain = None


In server.py I add the wrapper to the newly created variable.


mapvars.HardRain = TA_Wrapper( ‘SINGLEPLAYER_HeavyArtilleryBarrage_USSR’, [ ‘aTAArea1’, ‘aTAArea2’, ‘aTAArea3’, ‘aTAArea4’ ], 3, 60, 10, -1, None )


Now its time to start the Wrapper. Take the variable you added before and add .Start(). More useable methods will be explained in the next part of this chapter.


mapvars.HardRain.Start()


When you start a TA, keep the delay value you entered earlier in mind. This value will delay the TA drops after you have started it with .Start(). In the above case the rain of doom will not begin until one minute has passed after Wrapper start.


Useable TA Methods

In this section some useable methods available for the Wrapper will be explained.

ChangeTA( aTA )

This will change the TA used in the wrapper.

All the names can be found in supportweapons.juice in the maps folder.

ex.

mapvars.HardRain.ChangeTA( ‘SINGLEPLAYER_Artillery_NATO’ )

ChangeAmount( aAmount )

This changes the amount of TA’s used in the wrapper.

ex.

mapvars.HardRain.ChangeAmount( 5 )

ChangeDelay( aDelay )

This methods changes the delay time.

ex.

mapvars.HardRain.ChangeDelay( 120 )

ChangeTimer( aTimer )

This changes the timeframe the TA’s will drop in.

ex.

mapvars.HardRain.ChangeTimer( 20 )

ChangeTimerInstant( aTimer )

This changes the timeframe the TA’s will drop in intantly, ei. before text TA iteration.

ex.

mapvars.HardRain.ChangeTimerInstant( 15 )

AddArea( someAreas )

This will add areas to the list used to drop TA on. You can add a single area or a list of areas.

ex.

mapvars.HardRain.AddArea( [ ‘AnotherArea1’, ‘AnotherArea2’ ] )           

ChangeAreas( someAreas )

This replaces the current list with this new list.

ex.

mapvars.HardRain.ChangeAreas( [ ‘NewArea1’, ‘NewArea2’ ] )

RemoveArea( someAreas )

This will remove a single area or areas from a list.

If the area you are trying to remove don’t exist in the list, may cause the game to crash.

ex.

mapvars.HardRain.Removearea( ‘aTAArea1’ )

HardStop( )

This will stop the TA iterations, even those already on the way.

ex.

mapvars.HardRain.HardStop( )

Stop( )

This will stop the TA iterations.

ex.

mapvars.HardRain.Stop( )              

Start( )

This method Starts the TA_Wrapper.

ex.

mapvars.HardRain.Start( )             

IsStarted( )

This returns True if the TA_Wrapper is started.


Ex.

If  mapvars.HardRain.IsStarted():


Changes delay time if the TA is started.

mapvars.HardRain.ChangeDelay( 30 )         


To Protect and Sever

Being able to drop down TA to wreck havoc is in most cases fine. But sometimes you may want to destroy a map object or a building in one devastating blow. Or you might want to do the complete opposite and protect a certain building from harm.

In this section we will cover both the destruction and protection of buildings and game objects.

TA_DestroyBuilding

If there is a building you want to destroy on a map, the best choice is to use TA_DestroyBuilding. The function sets the building health to 1% of its current health and then drops a TA on top of it.

TA_DestroyBuilding( aDelay, aBuildingToBlow, aDirection, aSupportWeapon )


aDelay

This is a time value setting the delay time the function will begin.



aBuildingToBlow

This is a string with the name of the building. You can find the name in WICED.



aDirection

This is the direction vector of the incoming TA. If set to None it will chose a random direction. The default is set to None so this parameter can be skipped if you want.



aSupportWeapon

This is a string, the name of the Tactical aid to use. The names can be found in supportweapons.juice in the maps folder. There is a default TA set for this parameter, 'SINGLEPLAYER_Artillery_USSR_SingleProjectile'. So you can skip adding a name if you want to.

If the support weapon chosen is of the slower kind, the combination with the health being set to 1% can make the destruction look awkward sometimes.


Examples.


1. TA_DestroyBuilding( 0, ‘Barn__0’ , None )


2. Direction1 = Vector2Position( GetVector( GetPosition( 'areaTA1' ), GetPosition( 'areaTA2' ) ) )

TA_DestroBuilding( 30, ‘Mansion_01__0’, Direction1, ‘SINGLEPLAYER_Artillery_USSR’ )


TA_DestroyObject

If you want to destroy anything else than a building, a bridge for example, you have to use TA_DestroyObject. The function sets the objects health to 1% of its current health and then drops a TA on top of it.



TA_DestroyObject( aDelay, anObjectToBlow, aDirection, aSupportWeapon )


aDelay

This is a time value setting the delay time the function will begin.



anObjectToBlow

This is a string with the name of the object. You can find the name in WICED.



aDirection

This is the direction vector of the incoming TA. If set to None it will chose a random direction. The default is set to None so this parameter can be skipped if you want.



aSupportWeapon

This is a string, the name of the Tactical aid to use. The names can be found in supportweapons.juice in the maps folder. There is a default TA set for this parameter, 'SINGLEPLAYER_Artillery_USSR_SingleProjectile'. So you can skip adding a name if you want to.


If the support weapon chosen is of the slower kind, the combination with the health being set to 1% can make the destruction look awkward sometimes.


Examples.


1. TA_DestroyObject( 0, ‘Aquaduct__6’ , None )


2. Direction1 = Vector2Position( GetVector( GetPosition( 'areaTA1' ), GetPosition( 'areaTA2' ) ) )

TA_DestroObject( 30, ‘Pickup__1’, Direction1, ‘SINGLEPLAYER_Artillery_USSR’ )




Setting Health

There might be situations you don’t want to totally destroy only damage a building or an object. Then you can use the following functions.



wicg.DamageBuilding( aName, aDamageValue ) -Used to damage Buildings


wicg.DamageGameObject( aName, aDamageValue ) -Used to damage Objects


aName

This parameter is the name of the Building or the game Object. It can be found using WICEd.



aDamageValue

This is an integer setting the damage amount dealt to the Building or the Game Object.


Example.

  1. lowers the building ‘Barn__0’s current health with 500
wicg.DamageBuilding( ‘Barn__0’, 500 )    


There is also a way to set a buildings current health. You can even set the current health to become higher then the max health. This however will cause a graphical problem as the buildings healthbar will extend its designated space and continue to the right. There is at the moment no way to change the max health of a building with scripting.


wicg.SetBuildingData( aName, aStateName, aNewValue )


aName

This is the name of the building you want to modify.



aStateName

This is the state name you want to change. In this case ‘health’.



aNewValue

This is the new value of the chosen state.



example:

wicg.SetBuildingData( ‘Mansion_01__1’, 'health', 10000 )



Invulnerability

If you want to protect a vital building, a group or a game object from harm, you can make them invulnerable.

Some of the Invulnerable-functions are misspelled in the code. So, yes…you will have to use the ‘Invurnable’ version sometimes.

theBuildings[ aName ].myIsVulnerable = aFlag

MakeDestructibleObjectInvurnable( aName, aFlag )



The functions for buildings and objects differs a bit, but have the same kind of parameters.



aName

This is the name of the Building or game object you want to change the invulnerability for.



aFlag

This is a Boolean value, either True or False. The difference between the two functions is that for buildings True equals that the building is destroyable, while True for objects equals its not destroyable.


example:

This is the different code for an object and a building. These functions will make them invulnerable. The Car needs to be True and the building needs to be False.


1. MakeDestructibleObjectInvurnable( ‘Europe_MediumCar__0’, True ) theBuildings[ ‘Winery__1’ ].myIsVulnerable = False


This is the different code for an object and a building. These functions will make them vulnerable. The Car needs to be False and the building needs to be True.


2. MakeDestructibleObjectInvurnable(‘Europe_MediumCar__0’, False )

         theBuildings[ ‘Winery__1’ ].myIsVulnerable = True                    

To make a group invulnerable you use a single line of code that looks like this.

mapvars.grpRescueArty.SetInvulnerable( True )


The parameter is simply a Boolean true or false. True means the group will be invulnerable. If you don’t want the group to be invulnerable no more, just use the same function but with ’False’ as parameter.

If you add new units to the group they won’t be invulnerable, it is just the units that are already there when you use the function that will be affected.


Chapter 17: AI setup and usage < > Chapter 19: The first whole event
Personal tools
User Created Content