Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 4:30 pm
All times are UTC + 0
Improved Method(s) for Deploying Vehicles and Objects
Moderators: Generals Moderators, Global Moderators
Post new topic   Reply to topic Page 1 of 1 [1 Post] Mark the topic unread ::  View previous topic :: View next topic
Author Message
DaFool
Defense Minister


Joined: 07 Nov 2006

PostPosted: Sat Jan 09, 2010 5:37 pm    Post subject:  Improved Method(s) for Deploying Vehicles and Objects Reply with quote  Mark this post and the followings unread

Improved Method for Deploying Vehicles and Objects

It’s been a long time since I wrote a tutorial, and its been longer since I wrote the tutorial about deploying vehicles.  Over the course of modding generals, I’ve picked up a lot of tricks, and I have a better method for deploying objects, actually, I know of 3, but I haven’t fully learned rider logic yet, so I’ll tell you about the two I came across

Both methods are suicide based, and each has strengths and weaknesses.  One method is able to transfer health while the other veterancy.  Both methods allow you to aim where you want your unit to deploy (that is if you want to select the position).  My previous method transferred neither health nor veterancy, and you could not select the position.

*Note: I use unit and object interchangeably*

Method 1: Deploy Method with Transferred Health

This method is great for units (or structures) which don’t gain veterancy.  So if you want that MCV to deploy into a Con Yard, this is your method.

The Weapon: The first step is to get the object to kill itself (annoying it won’t help).  So you need a weapon that will destroy the object, and one which the unit will not fire automatically.

This is weapon I use for making deploying units.  It kills the unit off and doesn’t affect anything around it.
Code:

Weapon GenericUpgradeSuicide
  PrimaryDamage = 1.0
  PrimaryDamageRadius = 0.1
  AttackRange = 1.0
  DamageType = SMALL_ARMS
  DeathType = SUICIDED
  WeaponSpeed = 99999.0            
  ProjectileObject = NONE
  DamageDealtAtSelfPosition = Yes
  RadiusDamageAffects = SELF SUICIDE NOT_SIMILAR
  ClipSize = 1                        
  ClipReloadTime = 0                  
  AutoReloadsClip = No
End


Now, to prevent it from automatically trying to throw itself on any passing by enemies, you need to add a tag that will forbid the unit from firing this weapon:

Code:
    AutoChooseSources = PRIMARY NONE


Put this in the Weapon Set Group, with the Primary being whatever slot your suicide weapon is using.  The unit will not use the weapon ever unless told to do so (if it is the primary, you can force fire to use it).

The next thing you need to do is make your unit able to use the weapon when you tell it to.  Make a command button with the ‘FIRE_WEAPON” command, the weapon slot to that of you weapon, and optionally, for options you can make it “NEED_TARGET POS”.

The OCL

Another essential part of the deploy method is the OCL which the object will become.  Simply create a new OCL which dictates the new object.

The Death

Now that the units dies upon command, and the OCL is made for the new object, all you need to do is tell the unit what to make when it dies.  This involves creating a new CreateObjectDie module, and adding the tag SUICIDED to the others so you will get the desired results.  For example, you don’t want rubble to be create, so you must tell the code not to create rubble when the cause of death is Suicide.  See the code below

Code:
 
 Behavior = SlowDeathBehavior ModuleTag_XX
    DeathTypes = ALL -CRUSHED -SPLATTED -SUICIDED
    DestructionDelay = 200
    DestructionDelayVariance = 100
    FX  = FINAL    FX_XXX
    OCL = FINAL    OCL_XXX
 End

Behavior = DestroyDie ModuleTag_XX
    DeathTypes = NONE +CRUSHED +SPLATTED +SUICIDED
 End

 Behavior  = CreateObjectDie ModuleTag_XX
    DeathTypes = NONE +SUICIDED
    CreationList = OCL_XXX
    TransferPreviousHealth = Yes
 End


The first module makes it so no rubble is produced, the second so the model immediately disappears, and the third creates the new unit, with health transferred.

So this successfully makes an object deploy into another with transferred health.  To make the new object deploy back in a similar way, simply apply the same logic to the deployed version of the object.

Method 2: Deploy Method with transferred Veterancy.

This method is used to have a unit deploy and keep it’s veterancy, however it’s health is rest to full after each deploy.  This method may be considered more appropriate for units deploying into other units, as buildings usually don’t have veterancy.  However, a unit going from almost dead to full health could still be considered a very bad thing.  The rider method is completely superior to this one here, but I again I do not fully understand it, and thus being pragmatic, will tell you how to do what I know.

The Veterans

You will have to make a separate object for each veterancy level.  This involves making a simple clone of the unit, and adding the following module:

Code:
  Behavior = VeterancyGainCreate ModuleTag_XX
    StartingLevel = VETERAN
  End


The starting level can be any of the veterancy levels, and you will need a clone for each level.  (The others are ELITE and HEROIC).

Once you have your clones, you will need to make an OCL for each one.  Be sure you have an OCL for the standard veterancy level too.

The Weapon

You will again need to make a suicide weapon.  However, this weapon will have a FireOCL tag that will be the unit the original one deploys into, Thus, you will need a weapon for each veterancy level.  So overall, you should have 4.

Code:
Weapon GenericUpgradeSuicide
  PrimaryDamage = 1.0
  PrimaryDamageRadius = 0.1
  AttackRange = 1.0
  DamageType = SMALL_ARMS
  DeathType = SUICIDED
  WeaponSpeed = 99999.0            
  ProjectileObject = NONE
  DamageDealtAtSelfPosition = Yes
  RadiusDamageAffects = SELF SUICIDE ALLIES NOT_SIMILAR
  DelayBetweenShots = 0              
  ClipSize = 1                        
  ClipReloadTime = 0                  
  AutoReloadsClip = No
  FireOCL = OCL_XXX
End


This weapon code is not much different than the one from the previous method, however it has the FireOCL.  The weapon should be added just like before, with this line:

Code:
    AutoChooseSources = PRIMARY NONE


You will again need to make a command button for the weapon to be fired.

The WeaponSets

You will need an individual weapon set for each veterancy level (again, 4 in total).  Generals allows each veterancy rank to give a different WeaponSet, so your 4 WeaponSets should have the standard condition (none) plus the following 3:

HERO
ELITE
VETERAN

And each WeaponSet should have the corresponding Weapon with the Corresponding OCL.  Make sure each of the clones has these weapon sets too, but there are some obvious exceptions (For example the heroic cannot possibly be promoted anymore, so he only needs one WeaponSet with the Heroic Suicide Weapon.

Conclusion:  Neither method is really complete, but they each offer something the previous method did not.  The first method is the one I like the most, as units which deploy into structures do not need veterancy.


Key Words: #Tutorials #Modding #Generals #ZeroHour 

_________________
Please, read the signature rules of the forum.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.1397s ][ Queries: 11 (0.0096s) ][ Debug on ]