logo   login
right
Home Forums Downloads Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Forum Info
Forum Members: 18,537
Total Threads: 8,626
Posts: 94,205

Administrators:
DeeZire, Redemption

There are currently 102 users online.
Partner Links

Free Credit Repair

Learn the Ticket Broker Secrets
Advertisements


Generals & Zero Hour Editing Discuss any modding related issues to do with Generals and Zero Hour here.

Reply
 
LinkBack Thread Tools
Old 03-22-2005, 09:07 AM   #1 (permalink)
Senior Member
 
Join Date: Sep 2001
Posts: 734
Send a message via ICQ to Flyby
Default TOWED ARTILLERY

TOWED ARTILLERY

As promised, here is the detailed explanation on how to make towable artillery:

The system uses the RIDERS logic with an object that is actually the gun.
The whole trick is to store the truck into the gun and give the gun a different look so it looks and feels like a towingvehicle+gun.
The advantage is that you can differentiate locomotor, weapon, commandset and set a specific towing unit that is able to only tow this type of gun.

What do you need before starting to code?
-an empty chassis model with the gun as turret
-a model of a truck or towing vehicle
-a model with the 2 combined, specially setup as a trailer/cab (see on the CVtanker on how to do that)

the code :
1) guntemplate
In the riderchangecontain module, you only need 2 riderslots to make this working:

Code:
  Behavior = RiderChangeContain ModuleTag_56
    Rider1 = RidersDummy RIDER1 WEAPON_RIDER1 STATUS_RIDER1 GunCommandSet1 SET_SLUGGISH
    Rider2 = VehicleTransport RIDER2 WEAPON_RIDER2 STATUS_RIDER2 GunCommandSet2 SET_NORMAL
    ScuttleDelay          = 5000
    ScuttleStatus         = TOPPLED
    Slots                 = 1
    InitialPayload        = VehicleTransport 1
    ScatterNearbyOnExit   = No
    HealthRegen%PerSec    = 0
    DamagePercentToUnits  = 100%  
    BurnedDeathToUnits    = No    
    AllowInsideKindOf     = VEHICLE
    ExitDelay         = 250
    NumberOfExitPaths = 1 
    GoAggressiveOnExit = Yes 
   End
a ) As the towed gun comes out of the factory towed by a vehicle, you need to load it up with the initial vehicle (VehicleTransport) inside.
InitialPayload = VehicleTransport 1

b ) Only allow 1 vehicle at the time and although a bit redundant allow only VEHICLES to enter the unit.

c ) When the gun is being towed, we can't have the unit shoot at other units, so you'll need to set WEAPON_RIDER2 so that it isn't able to target any enemy unit.
Code:
     WeaponSet
       Conditions = WEAPON_RIDER2
       Weapon = PRIMARY none
    End
d ) For the WEAPON_RIDER1 you can use any normal weapon you wish.

e ) You can change the commandset for the detached or towed gun, so you can differ in commands when driving around or preparing to fire.

f ) Using the rider logic you can also define different locomotors. If you make a locomotor with speed =0 then can make an immovable gun that can turn in place , because it is a turret.

2) ridersdummy
When you use the normal evacuation button with the riders logic, your unit becomes uncontrollable and destroys it self after the time given by "Scuttledelay="
To solve this problem we have to fall back to an OCL.
By using an OCL, we can use a specific tag, used with the overlord, which allows a dummy unit to be created inside our container.

Code:
ObjectCreationList OCL_DitchRider
  CreateObject
    ObjectNames       = RidersDummy
    Count             = 1
    ContainInsideSourceObject = Yes
  End
End
The problem now is how are we going to bring it into the interface?
Although you can probably do it with an upgrade also, I found Sleipnir's method more elegant then mine, as it save the use of upgrades for other stuff, and uses a special power instead.

So below the riderchangecontainer module of your gun unit, you also need to insert this:

Code:
  Behavior    = OCLSpecialPower ModuleTag_DitchRider
    SpecialPowerTemplate = SpecialAbilityCombatBikeDitchRider
    OCL                  = OCL_DitchRider
  End
As you see we're using a special power to initiate the OCL.

You then need to add this entry as special power on the specialpower.ini, using one of the unused enum's :

Code:
SpecialPower SpecialAbilityCombatBikeDitchRider
  Enum              = SPECIAL_CIA_INTELLIGENCE
  ReloadTime        = 0  ; in milliseconds
  PublicTimer       = No
End
To have an interface to this special power we'll trick the user in believing he's evacuating, where in reality he's using a special power:

Code:
CommandButton Command_ForceDummy
  Command                 = SPECIAL_POWER
  SpecialPower            = SpecialAbilityCombatBikeDitchRider
  Options                 = NEED_SPECIAL_POWER_SCIENCE OK_FOR_MULTI_SELECT MUST_BE_STOPPED
  TextLabel               = CONTROLBAR:Evacuate
  ButtonImage             = SSEvacButton
  ButtonBorderType        = SYSTEM 
  DescriptLabel           = CONTROLBAR:ToolTipEvacuate
End
As you can see, we use the SSEvacButton to disguise the creation of an OCL.
The end user believes he's emptying the unit, where in reality he creates a new unit inside the container, effectively pushing the original unit out of the container.

So, the truck comes out of the container, forced out by the dummy, yet when you reorder the truck into the gun, the dummy gets forced out, leaving it onto the map.
After a while your map may hold a lot of these orphaned dummy’s. We solve this as follow:

Code:
;------------------------------------------------------------------------------
Object RidersDummy

  EditorSorting = VEHICLE
  TransportSlotCount  = 1              
  KindOf = PRELOAD VEHICLE CLICK_THROUGH NO_SELECT

  Body = ActiveBody ModuleTag_02
    MaxHealth       = 1
    InitialHealth   = 1
  End

  Behavior = AIUpdateInterface ModuleTag_03
  End

;  Behavior = LifetimeUpdate ModuleTag_04
;   MinLifetime = 1   
;   MaxLifetime = 1 
;  End

  Behavior = DeletionUpdate ModuleTag_05; Not LifetimeUpdate, since I can't die.  This will DestroyObject me. 
    MinLifetime = 1
    MaxLifetime = 1
  End

End
As you see, we're using the deletionupdate and not the lifetimeupdate. The difference is that with a liftime update the "unit lost" voice is triggered, where as with the deletionupdate it magically disappears.
The nice thing about this is that the deletion only starts working, the moment the unit leaves the container. Hence it doesn't interfere with the proper working of our 100% working towed guns!!!
As extra, I can confirm that you can use a fully, with infantry loaded, truck and store it into the container and get it with all infantry intact out again.


As bonus
I'd like to add a variation of this,
made by Sleipnir,
that exploits the use of different locomotors, effectively allowing you to switch locomotors on the fly and on command !


Code:
WhateverUnit.ini 
Code:	
; In your Unit  
Locomotor = SET_NORMAL NormalLocomotor  
Locomotor = SET_SLUGGISH SlowLocomotor  
Locomotor = SET_SUPERSONIC FastLocomotor   

Behavior = RiderChangeContain ModuleTag_16  
Rider1 = LocomotorDummy1 RIDER1 WEAPON_RIDER1 STATUS_RIDER1 DefaultCommandSet SET_NORMAL  
Rider2 = LocomotorDummy2 RIDER2 WEAPON_RIDER2 STATUS_RIDER2 DefaultCommandSet SET_SUPERSONIC  
Rider3 = LocomotorDummy3 RIDER3 WEAPON_RIDER3 STATUS_RIDER3 DefaultCommandSet SET_SLUGGISH   
ScuttleDelay = 150000  
ScuttleStatus = TOPPLED  
Slots = 1  
InitialPayload = LocomotorDummy1 1  
ScatterNearbyOnExit = No  
HealthRegen%PerSec = 0  
DamagePercentToUnits = 100%  
BurnedDeathToUnits = No  
AllowInsideKindOf = INFANTRY  
ExitDelay = 0  
NumberOfExitPaths = 1  
GoAggressiveOnExit = No  
DoorOpenTime = 0  
End   

Behavior = OCLSpecialPower ModuleTag_SwitchLocomotor1  SpecialPowerTemplate = SpecialAbilitySwitchtoLocomotor1  
OCL = OCL_SwitchLocomotor1  
End  

Behavior = OCLSpecialPower ModuleTag_SwitchLocomotor2  SpecialPowerTemplate = SpecialAbilitySwitchtoLocomotor2  
OCL = OCL_SwitchLocomotor2  
End  

Behavior = OCLSpecialPower ModuleTag_SwitchLocomotor3  SpecialPowerTemplate = SpecialAbilitySwitchtoLocomotor3  
OCL = OCL_SwitchLocomotor3  
End  	

	
;where X is 1 2 or 3  

Object LocomotorDummyX  
Side = GLA  
TransportSlotCount = 1  
EditorSorting = SYSTEM  
KindOf = PRELOAD CLICK_THROUGH INFANTRY IGNORED_IN_GUI  
End	


Commandbutton.ini 

;where X is 1 2 or 3  
CommandButton Command_SwitchtoLocomotorX  
Command = SPECIAL_POWER  
SpecialPower = SpecialAbilitySwitchtoLocomotorX  
Options = NEED_SPECIAL_POWER_SCIENCE OK_FOR_MULTI_SELECT MUST_BE_STOPPED  
TextLabel =  
ButtonImage =  
ButtonBorderType = SYSTEM  
DescriptLabel =  
End	


Specialpower.ini 
Code:	
;where X is 1 2 or 3  
SpecialPower SpecialAbilitySwitchtoLocomotorX  
Enum = SPECIAL_CIA_INTELLIGENCE  
ReloadTime = 0; in milliseconds  
PublicTimer = No  
End	


Objectcreationlist.ini 
Code:	
;where X is 1 2 or 3  
ObjectCreationList OCL_SwitchtoLocomotorX  
CreateObject  
ObjectNames = LocomotorDummyX  
Count = 1  
ContainInsideSourceObject = Yes  
End  
End
Please respect the copyrights on this and the variation upon it.
That's all I ask. For the rest, it is free to use for everyone.
Flyby is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-22-2005, 10:35 AM   #2 (permalink)
Senior Member
 
Join Date: Jul 2004
Location: London, UK
Posts: 376
Send a message via MSN to AntiSocialKindaGuy
Default

Aye, the logic is as I expected, yet as I posted on Sleip I never got the change of locomotors to work using bike logic, only change of weaponsets. Maybe I'll attack it again in a few days time.
AntiSocialKindaGuy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-22-2005, 11:37 AM   #3 (permalink)
Member
 
Join Date: Oct 2004
Location: Slovakia
Posts: 58
Default

Great work !!!
Anyway, this should be moved into Member written tutorials, shouldn´t it ?
Retnuh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-22-2005, 12:00 PM   #4 (permalink)
Senior Member
 
Join Date: Feb 2003
Location: USA
Posts: 853
Send a message via AIM to mastermind2003 Send a message via MSN to mastermind2003
Default

Mind if I format this a bit and put it on GenDev? Proper credit will be given, as always.
mastermind2003 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-22-2005, 12:34 PM   #5 (permalink)
Senior Member
 
Join Date: Mar 2003
Location: Rep. of Ireland
Posts: 373
Default

What the HELL happened to the expand option for the code windows???

excellent code though, sort of what I expected, interesting way of twisting perspectives with the bike code, this may be interesting to use for a carryall like feature, implement every vehicle with bike code and allow only a carryall unit to enter, of course, you would have to code new graphics and a locomoter for each vehicle, seems like an inefficient way to approach it but if the rolls are reversed you would only be able to pick up 7 units.
Waraddict is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Artillery Calling AntiSocialKindaGuy Generals & Zero Hour Editing 2 03-14-2006 05:39 PM
Deployable Artillery from TS fire87 Red Alert 2 & Yuri's Revenge Editing 13 08-21-2005 08:38 PM
New GLA artillery The_Hunter Generals & Zero Hour Editing 5 12-21-2004 01:39 AM
Artillery buildup. Waspo Generals & Zero Hour Editing 4 12-05-2004 06:33 PM
Towed units ErikM Generals & Zero Hour Editing 2 02-09-2004 03:39 PM


All times are GMT -4. The time now is 12:06 PM.


Design By: Miner Skinz.com
Powered by vBulletin® Version 3.7.0 Release Candidate 2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.