Joined: 09 Mar 2008 Location: Osaka (JP)/Hong Kong/Germany
Posted: Tue Jun 30, 2020 2:57 pm Post subject:
Convert into unit if cell is empty, otherwise explode [Ares]
For Continuum, for a long time, it was planned to give the "Eastasia" faction air-drop abilities that were different from the common paradrop in some respect other than simply paradropping different units. The first air-drop invented as part of this project was the aerial deployment of jumpjet infantry, which has already been presented. Another idea was the aerial deployment of drones which would combine aerial bombardment with air-dropping reinforcements. If impacting on a unit or structure, the air-dropped ordnance would explode instantly, while, when dropped on an empty cell, it would become a controllable unit. On first glance, this is easy to do, by simply using a MakeInfantry setting on an explosion animation invoked by a normal bomb weapon. However, this has the drawback that the explosion would be seen regardless of whether the projectile impacts on a unit or building, or an empty cell. In addition, if an animation has a "Next=" specified in artmd.ini, then that "Next=" will be played, even if the animation also converts to infantry. Thus, it is not possible to simply use a dummy animation that converts to a unit if the cell is empty, and only plays an explosion animation specified by "Next=" if the conversion to infantry fails. Another approach would be to give the warhead the explosion as an AttachEffect.Animation, so that it is played only if the projectile hits a unit or building. This has the issue that if the unit in question is moving, the explosion will move with it. However, by now, we might see what a solution could look like. I have not completely coded this solution yet, but the following approach might work (for any kind of weapon, not just air-dropping):
1. Give the weapon's warhead an animation.
2. This animation should be invisible and convert to the infantry you want the weapon to generate.
3. Give the weapon's warhead an "AttachEffect.Animation=".
4. This animation should be invisible and spawn a debris.
5. This debris should be set to last only an instant and not to fly off.
6. The debris should have the explosion animation set as its ExpireAnim.
The only restriction that seems to apply is that the warhead cannot have CellSpread. The damage the weapon is supposed to do if hitting a unit or structure can be tied to the weapon itself, or to the explosion animation (or, indeed, to the AttachEffect.Animation). If it is not tied to the weapon, the weapon cannot be used to gain veterancy. If it is tied to the weapon, then it cannot have CellSpread. This is because up to three infantry units can exist in the same cell, and hitting a cell with one or two infantry units inside it would always allow the animation to convert to its MakeInfantry. If the warhead had CellSpread, it would inflict damage to them even though this conversion would occur. However, in either case, the warhead cannot have CellSpread, as this would inflict the AttachEffect.Animation on all the surrounding units, even if the MakeInfantry is created. If CellSpread damage is intended, damage and warhead for it can be tied to the ExpireAnim explosion instead, at the cost of the weapon not generating veterancy. The warhead of the weapon in this case merely determines whether the projectile actually hit something (and thus explodes), and does not model the explosion itself (which affects objects outside the small area in which they would actually collide with the projectile itself).
Edit:
v. 2.0
Another drawback has been brought to my attention. This is that if the projectile impacts upon TerrainObject, which are not eligible for AttachEffect, but block a cell for MakeInfantry, then the projectile will neither explode, nor convert. This demands a different solution: TerrainObjects will trigger ShrapnelWeapons. Thus the projectile's explosion can be tied to a ShrapnelWeapon. However, ShrapnelWeapons are also triggered by hitting InfantryType or VehicleType. Using AttachEffect spawning debris as suggested in the previous solution, we would get two explosions on InfantryTypes and VehicleTypes - one from the debris, one from the ShrapnelWeapon. To avoid this, the AttachEffect, and thus the warhead, should only affect BuildingTypes, as BuildingTypes do not trigger ShrapnelWeapon. However, if AttachEffect is limited to BuildingTypes, a further simplification is possible: as BuildingTypes do not move, we do not need to detour through using a debris animation: it's sufficient to simply have an AttachEffect.Animation that is the damage-dealing explosion, applied by an AttachEffect that is applied by a warhead that only affects buildings, with the explosion instead invoked on InfantryType and VehicleType objects by a ShrapnelWeapon (with ProjectileRange=0). _________________
Mao Zedong wrote:
Our mission, unfinished, may take a thousand years.
Last edited by Millennium on Thu Jul 02, 2020 8:55 am; edited 2 times in total QUICK_EDIT
I have tried something but not as complex as you do but it seems can't be done with the lat part. I made the UFO to fly by the target and teleport down the cow and the cow once landed will do skittering animation (IsFlamingGuy) but once animation is done, no explosion can be done because IsFlamingGuy somehow block or ignore any animation damage or even not playing next= or even expireanim=. I'm a bit confused here. So I made the bomb that drop a cow (Cow as projectile) when landed it spawn actual cow on emtpy spot (neutral side) then the cow will wander around for a few seconds and explode. It's working but not seems effective much. Still don't know how to make this happenned.
Maybe use PreImpactAnim and put the MakeInfantry that have cellrangefinder or something like guard area and if bomb is drop near the building these infantry should attack them with suicide explosion? Have very small range to make sure target must be inclose range so you can have unit on empty cell and explode when near target. Is it possible? QUICK_EDIT
Joined: 09 Mar 2008 Location: Osaka (JP)/Hong Kong/Germany
Posted: Fri Jul 03, 2020 1:46 pm Post subject:
Mr.Hymn wrote:
I have tried something but not as complex as you do but it seems can't be done with the lat part. I made the UFO to fly by the target and teleport down the cow and the cow once landed will do skittering animation (IsFlamingGuy) but once animation is done, no explosion can be done because IsFlamingGuy somehow block or ignore any animation damage or even not playing next= or even expireanim=. I'm a bit confused here. So I made the bomb that drop a cow (Cow as projectile) when landed it spawn actual cow on emtpy spot (neutral side) then the cow will wander around for a few seconds and explode. It's working but not seems effective much. Still don't know how to make this happenned.
Yes, odd enough, I saw your attempt at this which you posted in cxtian39's thread around the same time I posted my convoluted method. I'd love to see actual code for my method. Could you post yours? _________________
Mao Zedong wrote:
Our mission, unfinished, may take a thousand years.
Here is my code. My code will actually drop a cow (cow projectile) then preimpactanim but use MakeInfantry logic so cow spawn on that spot (neutral side) then cow exploded and spawn an alien. I believe you will have an idea to do something similar.
I made the cow to reload the ammo after spawned so they can wander around for a few seconds otherwise the cow will most likely explode real quick after spawn.
Code:
; rules
[DISKATK];gs changed to K, as per the Master Name Doc (thank god for that, or this would never straighten out)
UIName=NOSTR:Light Disk
Name=Light Disk
Prerequisite=YAWEAP,YATECH
PrerequisiteOverride=EXPCALAB
Primary=CowBomb ;CowLauncher
Secondary=DiskAbductor
Strength=500
Passengers=100
SizeLimit=100
PipScale=Passengers
;Category=AirPower
Category=Transport
Armor=light
IsTilter=yes
TooBigToFitUnderBridge=true
TechLevel=1
Turret=yes
PassengerTurret=no
TurretSpins=yes;gs unit is one big turret so it can use existing permaspin
Sight=9
Speed=25
CrateGoodie=no
Crusher=no;yes
Owner=YuriCountry
Cost=1200
Soylent=1200
Points=25
ROT=100;gs super fast turn, ie turn on spot
AllowedToStartInMultiplayer=no
IsSelectableCombatant=yes
VoiceSelect=FloatingDiscSelect
VoiceMove=FloatingDiscMove
VoiceAttack=FloatingDiscAttackCommand
VoiceSecondaryWeaponAttack=FloatingDiscSteal
VoiceFeedback=
CrashingSound=FloatingDiscDie
MoveSound=FloatingDiscMoveLoop
CreateSound=FloatingDiscCreated
BalloonHover=yes ; ie never land
Locomotor={92612C46-F71F-11d1-AC9F-006008055BB5} ;Jumpjet
SpeedType=Hover
MovementZone=Fly
MoveToShroud=yes
ThreatPosed=20 ; This value MUST be 0 for all building addons
ConsideredAircraft=yes
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=14
DamageParticleSystems=SparkSys,SmallGreySSys
DamageSmokeOffset=100, 100, 275
Weight=3.5
VeteranAbilities=STRONGER,FIREPOWER,SIGHT,FASTER
EliteAbilities=SELF_HEAL,STRONGER,FIREPOWER,ROF
Accelerates=false
ZFudgeColumn=8
ZFudgeTunnel=13
Size=6
OmniFire=yes
OpportunityFire=yes
;ElitePrimary=CowBomb ;CowLauncher
JumpjetSpeed=25 ;params not defined use defaults (old globals way up top called Jumpjet controls)
JumpjetClimb=8 ;
JumpjetCrash=15 ; Climb, but down
JumpJetAccel=10
JumpJetTurnRate=100;gs superfast turn on spot, from 2
JumpjetHeight=750
JumpjetWobbles=.1 ; ! value of zero stop wobbles? NO! Wobbles of zero means div by 0 crash. "How many wobbles would you like?" "0" "You must have wobbles!!! I kill you!"
JumpjetDeviation=15
JumpjetNoWobbles=yes ; Really small numbers on two lines above don't actually slow down the wobbling since it is the amplitude of a sinusoidal curve
Crashable=yes ; JJ plummets down like aircraft
TiltCrashJumpjet=yes; can handle tilting while falling without freaking out
DeathWeapon=BlimpBombEffect
DeathWeaponDamageModifier=.1;gs needs a death weapon or it will do one laser blast's worth of crash damage. This gives control
SelfHealing=yes
[DEMOCOW]
UIName=Name:COW
Name=Animal Cow
Image=COW
Primary=DEMOCOWSUICIDE
;Explodes=yes
DeathAnims=COWEXP
DeathWeapon=CowBomber
NotHuman=yes
EligibleForDelayKill=yes ;If hit with a DelayKill weapon, this building will timed explode instead of instantly die
[CowBomber]
Damage=600 ; Damage is used only for death explosion
ROF=50
Burst=5
Range=1.5 ; you can't change the target, but you can change yourself for CellRangefinding, so target could still be far side infantry
CellRangefinding=yes
Projectile=Invisible
Warhead=Cow2AlienWH
FireInTransport=no;can't fire out of the BattleFortress
[CowBomb]
Damage=1
Burst=1
ROF=100
Range=1.5
CellRangefinding=yes
Projectile=CowBombP
Anim=ABDUCTRAY
Speed=20
Warhead=CowBombHE
Report=CowFear ;KirovAttack
OmniFire=yes ; Don't need to turn even though I have no turret (Need since if I am directly over my target it will baffle the CloseEnough test for the facing)
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