_______________________________________________________________________ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Adding Deployables:by Drumstix42- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- --- --- --- --- --- --- --- - _______________________________________________________________________ This tutorial will go over the very basic over-view of adding a deployable to the game but not an actual deployable itself, like most of the other "How To's" tutorials. This is pretty much ment for reference as in if you were adding your own deployable that you could use this as a guide. I will be releasing actual deployables and how and where to add them, and then other ones that just give you the code, and if you need help, then you just look here. Thought I'd just re-explain my manner of 'linking-tutorials' that hopefully save space, and save me time =P. Here it goes: _______________________________________________________________________ STEP #1: ----- -------------- DeployableFileName.cs -------------- ----- Your deployable file should go into your scripts/packs folder. Your main code will mostly be in this file, and then more or less in deployables.cs depending mostly on were 'you' want to put the functions. Explained in another tutorial ZOD explained the following: ---------------------------------------------------------------------------------- Some explanation is required. For a normal deployable object you need three datablocks, one for the inventory item, one for the image, and one for the deployed object. You also need some functions. The testObjectTooClose() function is used by the game to test an area to see if you can deploy an item there. The testObjectTooClose() function simply searches for players within the $MinDeployableDistance (already defined). The testNoTerrainFound() and onPickup() functions are simply there to prevent problems. The onDestroyed() function decrements the count of deployed platforms and deletes it from the game. ---------------------------------------------------------------------------------- These functions would be used like so: function YourDeployableNameImage::testObjectTooClose(%item) { //code here } ...and same for the other 3 he explained. One other thing is that in the 2 functions: testNoTerrainFound() and onPickup() These 2 functions are usually just blank and used to prevent console errors. I'm not too sure about their use otherwise for I have not messed around with deployables a whole bunch. STEP #2: ----- -------------- inventoryHud.cs -------------- ----- For those of you who have added weapons, you should know this step is pretty easy. It's pretty much the same with a deployable. You would first add your deployable to the $InvPack array list. $InvPack[12] = "NameToShowOnHud"; //remember to change number correctly Next we have an option about our deployable to show or not show in a Non-Team based game type. If we did NOT want it to be allowed in a non-team based game we would then add to the $NTInvPack array list: $NTInvPack[12] = "NameToShowOnHud"; //remember to change number correctly Then we would add to the $NameToInv array list: $NameToInv["NameToShowOnHud"] = "Deployable'sDatablockName"; STEP #3: ----- -------------- defaultGame.cs -------------- ----- In the function: function DefaultGame::clearDeployableMaxes(%game) ...we will need to add the deployable to teh clear list: $TeamDeployedCount[%i, DeployableDatablockName] = 0; This will make sure each time a new games starts, the amount of this deployable will be set at zero and be reset each new game. NOTE: Instead of putting DeployableDatablockName, I'll just put YourDeployable to make things eazier =P. STEP #4: ----- -------------- hud.cs -------------- ----- Next you'll have to add the deployable to the $BackpackHudData array list. It will need 2 lines. You can just delete the Team Rabbit 2 stuff there, since you should have it disabled anyway: $BackpackHudData[19, itemDataName] = "YourDeployable"; //remember the numbers! $BackpackHudData[19, bitmapName] = "gui/hud_new_packenergy"; //change to mini-hud icon you want STEP #5: ----- -------------- player.cs -------------- ----- Very simple step. Add just 1 line to each armor you want to have your deployable. 1= true;they can have it. 0= false;they can't have it. max[YourDeployable] = 1; STEP #6: ----- -------------- deployables.cs -------------- ----- If you did decide to have all your functions and datablocks in your deployable file, which I prefer, then all you need to do here is add your deployable max and exec it. I think you can place your max in the file itself, but sometimes it's better to keep it with all the rest for easier finding of it later: For max, find the $TeamDeployableMax array list around line 16 and add in your deployable: $TeamDeployableMax[YourDeployable] = 10; //change to you liking Then for the exec, your best place would probably be the bottom of the file. Later on you can still places underneath it, but for now, stick down at the bottom: exec("scripts/packs/DeployableFileName.cs"); /---------------------------------------------------------------------------------------\ Once again, there you have it nice and simple on 'How To' add a deployable to Tribes 2. Be ready for some actually deployables coming sometimes soon =D -Drumstix42 \---------------------------------------------------------------------------------------/