Jump to content


Photo

How to make a unit Periodaclly spawn a unit

help code coding

  • Please log in to reply
1 reply to this topic

#1 SarumanBitch

SarumanBitch
  • New Members
  • 4 posts

Posted 07 May 2020 - 09:55 PM

For example, I want Shelob to Spawn an Egg which after a short time will die and spawn 1 spiderling thus theoratically over time you can produce an army of single spiderling units simply by having Shelob on the Battlefield. 

 

I have attempted to code this MANY MANY MANY times, however in all cases, it works for the Human player without issue but after one or 2 spawnings from an Ai controlled Shelob, the game abruptly crashes to desktop with a Runtime Error.

 

Any thoughts or help would be appreciated.



#2 JUS_SAURON

JUS_SAURON

    El Shaddai

  • Members
  • 1,581 posts
  • Location:Trinidad
  • Projects: BFME2 MOD - Power Of The Ring
  •   INI Coder

Posted 09 May 2020 - 09:09 PM

Post some code

This is how i would do this

 

Have Shelob spawn an invisible object , then that dies into an egg ,then that dies into a spidering

test at each stage , by checking the spawned items i.e replace the final item by with Aragorn  and see if that is where the crash is

Make the invisible object visible by giving it a model for testing 

 

Here is a bit of code for the invisible object 

 

Then you would  have make your OCL's in the necessary way

 

Nice idea BTW 

Object GandalfFakeHeal
CanPathThroughGates	= Yes 
CommandPoints = 0



  ; *** ART Parameters ***
  Draw = W3DScriptedModelDraw ModuleTag_01
    DefaultModelConditionState
      Model = NONE
		;ParticleSysBone = NONE FireSmokeMedium ; remove ; to test
    End    
     
  End


   
; ***DESIGN parameters ***
	Side = Men
	IsTrainable		= No
	EditorSorting = UNIT
	ThingClass = HORDE_UNIT


  TransportSlotCount = 1
  ArmorSet
    Conditions      = None
    Armor           = NoArmor
    DamageFX        = None
  End
  VisionRange = 121
  DisplayName = OBJECT:Prop
  CrushableLevel = 0  ;What am I?:        0 = for infantry, 1 = for trees, 2 = general vehicles
 
 
  ; *** AUDIO Parameters ***
  VoiceSelect = NoSound
  VoiceMove = NoSound
  VoiceAttack = NoSound
  VoiceFear = NoSound
  VoiceGuard = NoSound
;  SoundDie = NoSound
;  SoundDieFire = NoSound
  SoundStealthOn = NoSound
  SoundStealthOff = NoSound
  
  UnitSpecificSounds
    VoiceGarrison         = NoSound
    VoiceEnter            = NoSound
    VoiceEnterHostile     = NoSound
    VoiceGetHealed        = NoSound
  End

 ; *** ENGINEERING Parameters ***

	  RadarPriority = NOT_ON_RADAR
        KindOf = PRELOAD SHRUBBERY  OPTIMIZED_PROP     PATH_THROUGH_EACH_OTHER    IGNORED_IN_GUI  NO_BASE_CAPTURE  IGNORE_FOR_VICTORY UNATTACKABLE NOT_AUTOACQUIRABLE
	
	Body = ActiveBody ModuleTag_02
		MaxHealth         = 10                  ;BALANCE Townsman Health
		MaxHealthDamaged  = 5
		RecoveryTime      = 5000
	End
 
Behavior = AnimalAIUpdate ModuleTagWanderAround
		FleeRange = 50			; how close enemies have to be before we panic
		FleeDistance = 100      ; how far the animal will run once spooked
		WanderPercentage = 5	;percentage of the time we should move
		MaxWanderDistance = 50  ;maximum distance to move at once
		MaxWanderRadius = 40  ; how far to wander on our own
		UpdateTimer = 10000		; temp disable		11     ; how often do we want to check for enemies
	End
        
         BountyValue = 25

	Behavior = LifetimeUpdate ModuleTag_LifetimeUpdate
	; This one displays the timer, but the one in the uint does the work 
		MinLifetime		=   18000  
		MaxLifetime		=   360000 
		DeathType		= FADED
	End	


 LocomotorSet
		Locomotor = WargLocomotor
		Condition = SET_NORMAL 
		Speed     = 80 ;80
	End	

  Behavior = PhysicsBehavior ModuleTag_04
  End
 
  	Behavior = SlowDeathBehavior ModuleTag_FadeoutDeath
		DeathTypes			= NONE +FADED
		DeathFlags			= DEATH_1
		FadeDelay			= 0
		FadeTime			= 3500
		DestructionDelay	= 4000
                OCL = INITIAL OCL_AnewThing
	End

	Behavior = SlowDeathBehavior ModuleTag_05
		DeathTypes = ALL -FADED
		SinkDelay = 3000
		SinkRate = 0.70     ; in Dist/Sec
		DestructionDelay = 8000
	End
 
  Behavior = SquishCollide ModuleTag_06
    ;nothing
  End


 
	 

	 

	 

Behavior = SlavedUpdate ModuleTag_Slave
		GuardMaxRange		= 250
		GuardWanderRange	= 30
	End

 
 
  Geometry = CYLINDER
  GeometryMajorRadius = 0.8
  GeometryHeight = 0.8
  GeometryIsSmall = Yes
  Shadow = SHADOW_DECAL
  ShadowSizeX = 8
  ShadowSizeY = 4
  ShadowTexture = ShadowI
End






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users