SkyMix_RMT
9 years ago
I want to have units from angry mob already start with AK47 and be individual units, like a rebel, and not all make part of a group, so I made this piece of code, but it makes the map crash everyime I try to play on it, I haven't found anything wrong with the code, can you help?
Thanks!


Object GLAInfantryAngryMobPistol01

;**** ART Parameters ***
 ReplaceModule ModuleTag_01
  Draw = W3DModelDraw ModuleTag_01_Override

    OkToChangeModelColor = Yes

    IgnoreConditionStates = PREATTACK_A FIRING_A BETWEEN_FIRING_SHOTS_A RELOADING_A
    ; "WHILE" (Default) CARRYING AK47 
    ;---------------------------------------------------------
    DefaultConditionState ;Idle with AK Slung
      Model = UIMOB01_SKN
      IdleAnimation = UIMOB01_SKL.UIMOB01_IDD1 0 6
      IdleAnimation = UIMOB01_SKL.UIMOB01_IDD2 0 6
      IdleAnimation = UIMOB01_SKL.UIMOB01_CHD  0 6
      IdleAnimation = UIMOB01_SKL.UIMOB01_STD
      AnimationMode = ONCE
      AnimationSpeedFactorRange 0.9 1.1
      TransitionKey = TRANS_STAND_AK
    End

    ConditionState = MOVING
      Animation = UIMOB01_SKL.UIMOB01_RND 
      AnimationMode = LOOP
      Flags = RANDOMSTART
      TransitionKey   = MOVING_AK
    End

    ConditionState = DYING
      Animation = UIMOB01_SKL.UIMOB01_DD1    
      Animation = UIMOB01_SKL.UIMOB01_DD2
      AnimationMode = ONCE
      TransitionKey = TRANS_Dying
    End

    ConditionState = SPECIAL
      Animation = UIMOB01_SKL.UIMOB01_CHD
      AnimationMode = ONCE
    End

    ; Drawing AK47
    ConditionState  = PREATTACK_B
      Animation     = UIMOB01_SKL.UIMOB01_ATD1_ST ; start firing
      AnimationMode = ONCE
    End
    AliasConditionState = PREATTACK_B FIRING_B
    AliasConditionState = PREATTACK_B BETWEEN_FIRING_SHOTS_B

    ; Firing Gun
    ConditionState = FIRING_B
      Animation = UIMOB01_SKL.UIMOB01_ATD1_LP ; looping firing
      AnimationMode = LOOP
      WeaponFireFXBone = SECONDARY MuzzleAK
      WeaponMuzzleFlash = SECONDARY MuzzleAKFX
      TransitionKey = TRANS_FIRING_AK
    End
    AliasConditionState  = BETWEEN_FIRING_SHOTS_B


    ConditionState  = RELOADING_B
      Animation     = UIMOB01_SKL.UIMOB01_ATD1_ED ; end firing
      AnimationMode = ONCE
    End


    ; This transition allows him to put his gun away when he's finished attacking.
    TransitionState = TRANS_FIRING_AK TRANS_STAND_AK
      Animation     = UIMOB01_SKL.UIMOB01_ATD1_ED ; end firing
      AnimationMode = ONCE
    End

;    ;Throwing bottle----------------------------------------------------------------
;    ConditionState = PREATTACK_C 
;      Animation     = UIMOB01_SKL.UIMOB01_ATCA_BF ; the wind up
;    End
;    AliasConditionState = PREATTACK_C FIRING_A
;    AliasConditionState = PREATTACK_C RELOADING_A
;    AliasConditionState = PREATTACK_C BETWEEN_FIRING_SHOTS_A 
;
;    ConditionState = FIRING_C 
;      Animation     = UIMOB01_SKL.UIMOB01_ATCA_AF ; the release and follow-thru
;      TransitionKey = TRANS_THROW
;    End
;    AliasConditionState = FIRING_C BETWEEN_FIRING_SHOTS_A
;
;    ConditionState RELOADING_C
;      Animation =UIMOB01_SKL.UIMOB01_IDA1
;      WaitForStateToFinishIfPossible = TRANS_THROW ; universal hub for follow-thru
;    End
;    AliasConditionState = RELOADING_C RELOADING_A
;    AliasConditionState = RELOADING_C FIRING_A
;    AliasConditionState = RELOADING_C BETWEEN_FIRING_SHOTS_A


;    TransitionState = TRANSXXX TRANS_THROW
;      Animation     = UIMOB01_SKL.UIMOB01_XXXXXXXXputaway gun and take out bottle
;    End

;    TransitionState = TRANS_THROW TRANS_FIRING_A
;      Animation     = UIMOB01_SKL.UIMOB01_XXXXXXXXputaway bottle and get PISTOL
;    End

;    TransitionState = TRANSXXXAK TRANS_THROW
;      Animation     = UIMOB01_SKL.UIMOB01_XXXXXXXXputaway AK and take out bottle
;    End

;    TransitionState = TRANS_THROW TRANS_FIRING_AK
;      Animation     = UIMOB01_SKL.UIMOB01_XXXXXXXXputaway bottle and get AK
;    End

    ;--------------------------------------------------------

    TransitionState = TRANS_Dying TRANS_Flailing
      Animation = UIMOB01_SKL.UIMOB01_A_ADTE1
      Animation = UIMOB01_SKL.UIMOB01_D_ADTE1
      AnimationMode = ONCE
    End

    ConditionState = DYING EXPLODED_FLAILING
      Animation = UIMOB01_SKL.UIMOB01_A_ADTE2
      Animation = UIMOB01_SKL.UIMOB01_D_ADTE2
      AnimationMode = LOOP
      TransitionKey = TRANS_Flailing
    End

    ConditionState = DYING EXPLODED_BOUNCING
      Animation = UIMOB01_SKL.UIMOB01_A_ADTE3
      Animation = UIMOB01_SKL.UIMOB01_D_ADTE3
      AnimationMode = ONCE
      TransitionKey = None
    End
  End

;**** DESIGN parameters ***

  DisplayName      = OBJECT:AngryMob
  Side = GLA
  EditorSorting = INFANTRY
  TransportSlotCount = 1                 ;how many "slots" we take in a transport (0 == not transportable)

  WeaponSet
    Conditions = None
    Weapon = PRIMARY GLAAngryMobAK47NoDamageWeapon ; for atttacking in AK-proof conditions
    Weapon = SECONDARY GLAAngryMobAK47Weapon
  End

  ArmorSet
    Conditions      = None
    Armor           = HumanArmor
    DamageFX        = InfantryDamageFX
  End

  VisionRange = 150
  ShroudClearingRange = 150
  Prerequisites
    Object = GLABarracks
  End
  BuildCost = 100
  BuildTime = 0.0           

  ExperienceValue = 5 5 5 5    ;Experience point value at each level
  ExperienceRequired = 0 150 450 900  ;Experience points needed to gain each level
  IsTrainable = Yes             ;Can gain experience
  CrushableLevel         = 0  ;What am I?:        0 = for infantry, 1 = for trees, 2 = general vehicles

  ; *** AUDIO Parameters ***
  VoiceSelect = AngryMobVoiceSelect
  VoiceMove = AngryMobVoiceMove
  VoiceGuard = AngryMobVoiceMove
  VoiceAttack = AngryMobVoiceAttack
  
;**** ENGINEERING Parameters *** ;MOB01
  RadarPriority = UNIT
  KindOf = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS INFANTRY SALVAGER

 ReplaceModule BodyTag_01
  Body = ActiveBody BodyTag_01_Override
    MaxHealth       = 50.0
    InitialHealth   = 50.0
  End
 End

 ReplaceModule ModuleTag_03
  Behavior = AIUpdateInterface ModuleTag_03_Override
    AutoAcquireEnemiesWhenIdle = Yes
  End
 End

 RemoveModule ModuleTag_04
 End

  Locomotor = SET_NORMAL AngryMobNormalLocomotor
  Locomotor = SET_WANDER AngryMobWanderLocomotor
  Locomotor = SET_PANIC AngryMobPanicLocomotor

 ReplaceModule BehaviorTag_01
  Behavior = PhysicsBehavior BehaviorTag_01_Override
    Mass = 5.0
  End
 End
End

Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Sponsor
Gameanater
9 years ago
It would be much easier to start off with an actual Rebel and work from there, replacing Art code and weaponry as needed. Trust me, I've learned this the hard way.



"Always mod the unit closest in function, not in appearance, to what you want.
For example, if you want to convert an A10 Thunderbolt into a controllable unit, start with a Raptor."

Any old friends still on here can add me on discord @jcdenton2187. I'm far more likely to respond there.
SkyMix_RMT
9 years ago
Yes of course! Why didn't I think of that? I did that to transform the biohazardtech to a minigun carrying guy!
I'll try to do that.
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Gameanater
9 years ago

Yes of course! Why didn't I think of that? I did that to transform the biohazardtech to a minigun carrying guy!
I'll try to do that.

Originally Posted by: SkyMix_RMT 



Mkay. :b


Wait, that was a map.ini though, right?
Any old friends still on here can add me on discord @jcdenton2187. I'm far more likely to respond there.
SkyMix_RMT
9 years ago
What do you mean?
The coding above belongs to a map.ini, if that's what you meant.
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Gameanater
9 years ago
Oh whoops. I somehow missed that fact.

Anyway, I'm not a versatile in map.ini'ing, but it'd be worth a try to mod a Rebel instead.
Any old friends still on here can add me on discord @jcdenton2187. I'm far more likely to respond there.
SkyMix_RMT
9 years ago
Yeah i'm working on it right now.
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Gameanater
9 years ago
'Kay. Let me know how it goes.


BTW, may I use your Epic Biohazard Tech Guy in my demo map for my mod?
Any old friends still on here can add me on discord @jcdenton2187. I'm far more likely to respond there.
SkyMix_RMT
9 years ago
Ok I tried to use a rebel preset and replace the models and weapons, but I still got a crash haha.
And yes you may use it freely and change it as you like i'm absolutely fine with it!

Edit~: Ok this is weird now, I still get a crash even without the code :S
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Gameanater
9 years ago
Well darn, that's a bummer. D:


Lol thanks!
Any old friends still on here can add me on discord @jcdenton2187. I'm far more likely to respond there.
Annihilationzh
9 years ago

Ok this is weird now, I still get a crash even without the code :S

Originally Posted by: SkyMix_RMT 


That's a pain in the butt. I hope for your sake you won't have to filter through a lot of code to find the error.

"Always mod the unit closest in function, not in appearance, to what you want.
For example, if you want to convert an A10 Thunderbolt into a controllable unit, start with a Raptor."

Originally Posted by: Gameanater 


Well that's one fancy way to quote someone.

Oh whoops. I somehow missed that fact.

Originally Posted by: Gameanater 


You absolutely deserve to be teased for that. 😛
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.
SkyMix_RMT
9 years ago
I fixed it.
For some stupid reason, command & conquer does not like when I edit the map.ini using notepad, everytime I use notepad to change a bit of code like the damage of a weapon the map.ini stops working and it will always make the game crash even if I remove most of the code.
Fortunately, I always have a working backup of the map.ini.
So I used notpad+ to change the exact same code I did before with notepad, and it worked.
So yeah, no more notepad!

Still, I have the same problem, the code from the original topic still makes the game crash, and still I don't know why.
When I remove it with notepad+ it works, so the problem is from that code.

EDIT:
I replaced the code with this one:


Object GLAInfantryAngryMobPistol01

  VoiceSelect = AngryMobVoiceSelect
  VoiceMove = AngryMobVoiceMove
  VoiceGuard = AngryMobVoiceMove
  VoiceAttack = AngryMobVoiceAttack

  RemoveModule ModuleTag_04
End

It works, the unit doesn't die like it would normally do, it's selectable and moveable, it can shoot stuff. But it doesn't have a health bar, or a GUI, and also makes no sound when selected or ordered to move, don't know why.

Yet another EDIT:
Adding this to the code fixes the Health bar, GUI, and sounds problem.

KindOf = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS INFANTRY SALVAGER
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord