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

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Mon Jul 06, 2020 6:50 am
All times are UTC + 0
 Forum index » Modding Central » Red Alert 2 Editing Forum » Ares (Unofficial Forum)
Convert into unit if cell is empty, otherwise explode [Ares]
Moderators: Ares Support Team at PPM, Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [7 Posts] View previous topic :: View next topic
Author Message
Millennium
Commander


Joined: 09 Mar 2008
Location: Osaka (JP)/Hong Kong/Germany

PostPosted: Tue Jun 30, 2020 2:57 pm    Post subject:  Convert into unit if cell is empty, otherwise explode [Ares] Reply with quote

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

Back to top
View user's profile Send private message
G-E
General


Joined: 09 Feb 2015

PostPosted: Tue Jun 30, 2020 8:56 pm    Post subject: Reply with quote

Doesn't this belong in the Ares sub?
_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Millennium
Commander


Joined: 09 Mar 2008
Location: Osaka (JP)/Hong Kong/Germany

PostPosted: Thu Jul 02, 2020 8:56 am    Post subject: Reply with quote

Probably, you are correct. I appended the thread title for clarification.
_________________
Mao Zedong wrote:

Our mission, unfinished, may take a thousand years.  

Back to top
View user's profile Send private message
Mr.Hymn
Cyborg Engineer


Joined: 01 May 2020

PostPosted: Fri Jul 03, 2020 10:25 am    Post subject: Reply with quote

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.


11fsdafsad.gif
 Description:
 Filesize:  2.58 MB
 Viewed:  94 Time(s)

11fsdafsad.gif



Back to top
View user's profile Send private message
Mr.Hymn
Cyborg Engineer


Joined: 01 May 2020

PostPosted: Fri Jul 03, 2020 10:30 am    Post subject: Reply with quote

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?

Back to top
View user's profile Send private message
Millennium
Commander


Joined: 09 Mar 2008
Location: Osaka (JP)/Hong Kong/Germany

PostPosted: Fri Jul 03, 2020 1:46 pm    Post subject: Reply with quote

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.  

Back to top
View user's profile Send private message
Mr.Hymn
Cyborg Engineer


Joined: 01 May 2020

PostPosted: Yesterday, at 6:26 pm    Post subject: Reply with quote

Sorry for a bit long.

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

Ammo=6
ReloadAmount=1
EmptyReloadAmount=6
Reload=50
EmptyReload=300
InitialAmmo=6

NoAmmoWeapon=1
NoAmmoAmount=0

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

Ammo=5
InitialAmmo=1
EmptyReload=20
ReloadAmount=1
EmptyReloadAmount=1
Reload=20

CanPassiveAquire=yes
CanRetaliate=yes
AttackFriendlies=yes
Sensors=yes
SensorsSight=255
DetectDisguise=yes
DetectionDistance=255
OpportunityFire=yes
GuardRange=255
RadarVisible=no
RadarInvisible=yes
DefaultToGuardArea=yes
HasStupidGuardMode=false
Explodes=yes

Category=Civilian
Strength=150
Armor=magic
TechLevel=-1
Crushable=no
Insignificant=yes
Sight=4
Speed=4
Owner=British,French,Germans,Americans,Alliance,Russians,Confederation,Africans,Arabs,YuriCountry
AllowedToStartInMultiplayer=no
Cost=10
SensorsSight=10
Soylent=200
Points=1
;Ammo=10
Fraidycat=yes
Civilian=yes
Nominal=yes
Pip=yellow
VoiceSelect=CowSelect
VoiceMove=CowMove
VoiceAttack=CowMove
VoiceFeedback=CowFear
VoiceSpecialAttack=CowMove
DieSound=CowDie
AmbientSound=CowAmbient
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=0   ; This value MUST be 0 for all building addons
ImmuneToVeins=yes
Size=2
GuardRange=-2
IFVMode=12
Natural=yes
UseOwnName=true

[DEMOCOWSUICIDE]
Projectile=Invisible
Damage=600
Warhead=Cow2AlienWH
Anim=RING1
Range=-2
ROF=10
Suicide=yes
Ammo=5

[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)

; high explosive (shrapnel)
[CowBombHE]
CellSpread=2
PercentAtMax=.5
Wall=yes
Wood=yes
Verses=100%,100%,100%,70%,35%,35%,85%,75%,50%,100%,100%
Conventional=yes
Rocker=yes
InfDeath=2
Sparky=no
Bright=yes
ProneDamage=100%
Report=CowMove
PreImpactAnim=COWDEMO
AnimList=COWEXP

[Cow2AlienWH] ;Explosion
Verses=100%,100%,100%,100%,100%,100%,100%,250%,20%,100%,100%
PreImpactAnim=Cow2Alien
AnimList=COWEXP
CellSpread=2
PercentAtMax=.5
Wall=yes
Wood=yes
AffectsAllies=no
Conventional=yes
Rocker=yes
InfDeath=3
Sparky=no
Bright=yes
ProneDamage=100%

;art
[Cow2Alien]
Image=COWCANNON2
MakeInfantry=2
Shadow=no
StartSound=RoachDie
Loop=3
MakeInfantryOwner=neutral
Layer=ground

[COWEXP]  ; Crazy Ivan Explosion
Image=CRIVEXP
Next=Cow2Alien
Report=ExplosionCrazyIvan
Crater=yes
Normalized=yes
Translucent=yes
UseNormalLight=yes

[COWDEMO]
Image=COWCANNON2 ;COWWANDER
MakeInfantry=4
Shadow=no
MakeInfantryOwner=neutral
StartSound=CowDie
Layer=ground

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [7 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Red Alert 2 Editing Forum » Ares (Unofficial Forum)
Jump to:  
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.1605s ][ Queries: 13 (0.0302s) ][ Debug on ]