Jump to content


Photo

What is wrong with this code?


  • Please log in to reply
3 replies to this topic

#1 The_Morgul_Lord

The_Morgul_Lord
  • Members
  • 21 posts

Posted 26 June 2010 - 04:55 PM

I am trying to increase the attack speed and damage done by mirkwood archers. Here is my code:

CODE
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;Mirkwood Archers
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Object ElvenMirkwoodArcher

CommandPoints = 100

WeaponSet
Conditions = None
Weapon = PRIMARY SuperBow
Weapon = TERTIARY SuperBowBombard
AutoChooseSources = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
AutoChooseSources = TERTIARY FROM_PLAYER FROM_SCRIPT ; Not AI.
End
End


Object ElvenMirkwoodArcherHorde

CommandPoints = 1000

WeaponSet
Conditions = None
Weapon = PRIMARY SuperMissileHordeRangefinder
Weapon = TERTIARY SuperMissileHordeRangefinderBombard
AutoChooseSources = TERTIARY FROM_PLAYER FROM_SCRIPT ; Not AI.
End
End


;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;WEAPONS
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Weapon SuperBow
AttackRange = 400


RangeBonusMinHeight = 10
RangeBonus = 1
RangeBonusPerFoot = 1 ; ;#MULTIPLY( ELVEN_MIRKWOOD_ARCHER_RANGE .01 )

WeaponSpeed = 350 ; dist/sec
MinWeaponSpeed = 250
MaxWeaponSpeed = 490 ; dist/sec Upper limit on scaling, when attacking past nominal "max" range
FireFX = FX_RohanArcherBowWeapon
ScaleWeaponSpeed = Yes ; Used for lob weapons, scales speed proportional to range
HitPercentage = 100 ;When this weapon is used it will hit exactly 50% of the time.
ScatterRadius = 16.0 ;When this weapon misses it can randomly miss by as much as this distance.

AcceptableAimDelta = 20 ; prevent twitchy reaiming in horde on horde
DelayBetweenShots = 0
PreAttackDelay = 450
PreAttackRandomAmount = 200
PreAttackType = PER_POSITION
FiringDuration = 0

ClipSize = 1
AutoReloadsClip = Yes
AutoReloadWhenIdle = 1
ClipReloadTime = Min:ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MIN Max:ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MAX
ContinuousFireOne = 0
ContinuousFireCoast = ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MAX

AntiAirborneVehicle = Yes
AntiAirborneMonster = Yes
HitPassengerPercentage = 20%
CanBeDodged = Yes ; Will check for a DodgePercent on the target to have a second chance at failing HitPercent

ProjectileNugget ; Default arrow
ProjectileTemplateName = GoodFactionArrow
WarheadTemplateName = SuperBowWarhead
ForbiddenUpgradeNames = Upgrade_RohanFireArrows
End
ProjectileNugget ; Fire arrow avialble through fire upgrade
ProjectileTemplateName = GoodFactionFireArrow
WarheadTemplateName = RohanArcherBowFireWarhead
RequiredUpgradeNames = Upgrade_RohanFireArrows
End
End

Weapon SuperBowBombard
AttackRange = 300
MinimumAttackRange = #SUBTRACT( ELVEN_MIRKWOOD_ARCHER_BOMBARD_MINRANGE 75 )

RangeBonusMinHeight = 10
RangeBonus = 1
RangeBonusPerFoot = 1 ; ;#MULTIPLY( ELVEN_MIRKWOOD_ARCHER_BOMBARD_MAXRANGE .01 )

WeaponSpeed = 350 ; dist/sec
MinWeaponSpeed = 250
MaxWeaponSpeed = 490 ; dist/sec Upper limit on scaling, when attacking past nominal "max" range
FireFX = FX_RohanArcherBowWeapon
ScaleWeaponSpeed = Yes ; Used for lob weapons, scales speed proportional to range
HitPercentage = 0 ;Always scatter
ScatterRadius = ARCHER_BOMBARD_SCATTER_RADIUS ;When this weapon misses it can randomly miss by as much as this distance.


AcceptableAimDelta = 20 ; prevent twitchy reaiming in horde on horde
DelayBetweenShots = 0
PreAttackDelay = 450
PreAttackRandomAmount = 200
PreAttackType = PER_POSITION
FiringDuration = 0

ClipSize = 1
AutoReloadsClip = Yes
AutoReloadWhenIdle = 1
ClipReloadTime = Min:ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MIN Max:ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MAX
ContinuousFireOne = 0
ContinuousFireCoast = ELVEN_MIRKWOOD_ARCHER_BOW_RELOADTIME_MAX

AntiAirborneVehicle = Yes
AntiAirborneMonster = Yes
HitPassengerPercentage = 20%
CanBeDodged = Yes ; Will check for a DodgePercent on the target to have a second chance at failing HitPercent

NoVictimNeeded = Yes
BombardType = Yes

ProjectileNugget ; Default arrow
ProjectileTemplateName = GoodFactionArrowBombard
WarheadTemplateName = SuperBowBombardWarhead
ForbiddenUpgradeNames = Upgrade_RohanFireArrows
End
ProjectileNugget ; Fire arrow avialble through fire upgrade
ProjectileTemplateName = GoodFactionFireArrowBombard
WarheadTemplateName = RohanArcherBowBombardFireWarhead
RequiredUpgradeNames = Upgrade_RohanFireArrows
End
End

Weapon SuperBowWarhead
ProjectileCollidesWith = ENEMIES NEUTRAL STRUCTURES WALLS
RadiusDamageAffects = ENEMIES NEUTRALS NOT_SIMILAR ;ALLIES
HitStoredTarget = Yes ; Always hits initial target.
DamageNugget ; A basic Nugget that just does damage
Damage = 450
Radius = 0.0 ; HitStoredTarget means we hurt the person we launched at. And nobody else. So a miss hurts nobody.
DelayTime = 0
DamageType = PIERCE
DamageFXType = GOOD_ARROW_PIERCE
DeathType = NORMAL
End
End

Weapon SuperBowBombardWarhead
ProjectileCollidesWith = ENEMIES NEUTRAL STRUCTURES WALLS
RadiusDamageAffects = ENEMIES NEUTRALS NOT_SIMILAR ;ALLIES
HitStoredTarget = No
DamageNugget ; A basic Nugget that just does damage
Damage = 450
Radius = 0.0 ; HitStoredTarget means we hurt the person we launched at. And nobody else. So a miss hurts nobody.
DelayTime = 0
DamageType = PIERCE
DamageFXType = GOOD_ARROW_PIERCE
DeathType = NORMAL
End
End

Weapon SuperMissileHordeRangefinder
AttackRange = 400

RangeBonusMinHeight = 10
RangeBonus = 1
RangeBonusPerFoot = 1 ; ;#MULTIPLY( ELVEN_MIRKWOOD_ARCHER_RANGE .01 )

DelayBetweenShots = 1000
LeechRangeWeapon = Yes
AcceptableAimDelta = 45
AntiAirborneVehicle = Yes
AntiAirborneMonster = Yes
CanFireWhileMoving = Yes ; When aboard a ship.
FinishAttackOnceStarted = No
HordeAttackNugget
End
End

Weapon SuperMissileHordeRangefinderBombard
AttackRange = 300
MinimumAttackRange = ELVEN_MIRKWOOD_ARCHER_BOMBARD_MINRANGE

RangeBonusMinHeight = 10
RangeBonus = 1
RangeBonusPerFoot = 1 ; ;#MULTIPLY( ELVEN_MIRKWOOD_ARCHER_BOMBARD_MAXRANGE .01 )

DelayBetweenShots = 1000
LeechRangeWeapon = Yes
AcceptableAimDelta = 45
AntiAirborneVehicle = Yes
AntiAirborneMonster = Yes
CanFireWhileMoving = Yes ; When aboard a ship.
FinishAttackOnceStarted = No
NoVictimNeeded = Yes
BombardType = Yes
ScatterRadius = ARCHER_BOMBARD_SCATTER_RADIUS ; Only used for cursor radius

HordeAttackNugget
End
End



The problem is that when I try to click on enemies to attack them, the cursor turns into the red circle with a slash, and my archers cant attack. They cant attack anything. Also, when I have this added to my code in the beginning, various errors pop up.

CODE
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;Mirkwood Archers
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Object ElvenMirkwoodArcher

CommandPoints = 100

WeaponSet
Conditions = None
Weapon = PRIMARY SuperBow
Weapon = TERTIARY SuperBowBombard
AutoChooseSources = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
AutoChooseSources = TERTIARY FROM_PLAYER FROM_SCRIPT ; Not AI.
End
End

ReplaceModule ModuleTag_02
Body = ActiveBody ModuleTag_ElvenMirkwoodArcher
MaxHealth = 20000
End
End


LocomotorSet
Locomotor = HumanLocomotor
Condition = SET_NORMAL
Speed = 200

End
End


Object ElvenMirkwoodArcherHorde

CommandPoints = 1000

WeaponSet
Conditions = None
Weapon = PRIMARY SuperMissileHordeRangefinder
Weapon = TERTIARY SuperMissileHordeRangefinderBombard
AutoChooseSources = TERTIARY FROM_PLAYER FROM_SCRIPT ; Not AI.
End
End

LocomotorSet
Locomotor = HumanLocomotor
Condition = SET_NORMAL
Speed = 195
End
End


It seems like it all depends on the order. If LocomotorSet comes first, then it will say unknown "WeaponSet", and if I change the ReplaceModule to first, something else will come up unknown. It all worked until I added WeaponSet.

Edited by The_Morgul_Lord, 26 June 2010 - 04:56 PM.


#2 Puppeteer

Puppeteer

    title available

  • Global Moderators
  • 2,947 posts
  • Location:United Kingdom
  •  Faute de Mieux
  • Division:Community
  • Job:Magazine Staff/Global Moderator

Posted 26 June 2010 - 06:06 PM

Order doesn't matter.
You cannot create your own ranged weapons in map.ini. You will have to use an already-existing ranged weapon (ie. not SuperBow, maybe an obsolete one) and modify the projectile in the map.ini file with a spawn weapon upon collision module to create a NEW ranged warhead (SuperBowWarhead, for instance).
AddModule
  Behavior = FireWeaponWhenDeadBehavior ModuleTag_DIELIKETHIS
	StartsActive = Yes
	DeathWeapon = SuperBowWarhead
  End
  End

Edited by Puppeteer, 26 June 2010 - 06:26 PM.


#3 The_Morgul_Lord

The_Morgul_Lord
  • Members
  • 21 posts

Posted 30 June 2010 - 01:25 AM

Thanks Puppeteer, but that still did not work. I added it under GoodFactionArrow. The damage was still the same as before. This was the code I added.

CODE

Object GoodFactionArrow

AddModule ModuleTag_SuperBowWarheadCreate
Behavior = FireWeaponWhenDeadBehavior ModuleTag_DIELIKETHIS
StartsActive = Yes
DeathWeapon = SuperBowWarhead
End
End
End


And

CODE

Weapon SuperBowWarhead
ProjectileCollidesWith = ENEMIES NEUTRAL STRUCTURES WALLS
RadiusDamageAffects = ENEMIES NEUTRALS NOT_SIMILAR ;ALLIES
HitStoredTarget = Yes ; Always hits initial target.
DamageNugget ; A basic Nugget that just does damage
Damage = 9999999
Radius = 0.0 ; HitStoredTarget means we hurt the person we launched at. And nobody else. So a miss hurts nobody.
DelayTime = 0
DamageType = HERO
DamageFXType = GOOD_ARROW_PIERCE
DeathType = NORMAL
End
End


I kep the standard bow the same, and that bow creates the GoodFactionArrow and the ElvenMirkwoodArcherBowWarhead. I changed the damage on the original warhead as well, and it still does default damage. Any ideas or do you know what I am doing incorrectly?

#4 Puppeteer

Puppeteer

    title available

  • Global Moderators
  • 2,947 posts
  • Location:United Kingdom
  •  Faute de Mieux
  • Division:Community
  • Job:Magazine Staff/Global Moderator

Posted 04 July 2010 - 01:33 PM

That is because in the Object GoodFactionArrow's ini, it has this code
Behavior = BezierProjectileBehavior ModuleTag_04
; To tweak a Bezier path
;  DetonateCallsKill = Yes
	FirstHeight = 9; Height of Bezier control points above highest intervening terrain
	SecondHeight = 9
	FirstPercentIndent = 20%; Percentage of shot distance control points are placed
	SecondPercentIndent = 90%
	FlightPathAdjustDistPerSecond = 50; Can allow a max speed this can attempt to follow a target. Units are their velocity we can tag. (45 is default human speed)
	GroundHitFX = FX_GondorArrowDeath
	CurveFlattenMinDist = 100.0
  End
See how the DetonateCallsKill has a ; before it? Replace this module, but remove the ; ie.
ReplaceModule ModuleTag_04
  Behavior = BezierProjectileBehavior ModuleTag_04_Override
	DetonateCallsKill = Yes
	FirstHeight = 9
	SecondHeight = 9
	FirstPercentIndent = 20%
	SecondPercentIndent = 90%
	FlightPathAdjustDistPerSecond = 50
	GroundHitFX = FX_GondorArrowDeath
	CurveFlattenMinDist = 100.0
  End
 End
Forgot about that...

and that bow creates the GoodFactionArrow and the ElvenMirkwoodArcherBowWarhead

Good, leave the original weapon's name and warhead modules untouched - the rest of the code can be edited.

By the way, when you've sorted this, you might want to find an obscure/obsolete weapon, because GoodFactionArrow is used by so many units - eg. the BFME1 Haradrim Lancers have their weapons still left in.

Edited by Puppeteer, 04 July 2010 - 01:35 PM.



Back to Worldbuilder


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users