Jump to content


Photo

Nert's Coding Questions


  • Please log in to reply
129 replies to this topic

#1 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 22 June 2009 - 11:00 PM

I figure I'm going to end up with a lot of questions... so instead of a lot of threads I'll try condensing into one. Bear with my coding newbness.... Currently, two problems:

1) Scatter weapons

I'm trying to make a weapon that fires a pile of rocks, that should scatter off in random directions around the target location. I'm not even sure where to start :p. Tried using a weaponset with several damagenuggets with their own projectiles, but obviously that won't work as the scatter looks like it's calculated before the projectiles spawn, so all of them hit the same place. How should I go about this?

2) Shooting over walls

I'm not sure if anyone has much experience with this area, but still, I'm having an issue with castle walls and units being able to shoot through them (from the outside, hitting buildings inside it). I have a few ideas about how to fix this, but I thought I'd see if anybody has had this problem before. Frankly I think it's because the wall is too low (around 3 metres high) and it's not triggering the collision check. I'll post the code, nothing particularly special about it though, just the Gondor Castle pretty much.

CODE
Object DwarfCampWall

SelectPortrait = BPDwarf_CampWall
Draw = W3DScriptedModelDraw Draw_Wall
OkToChangeModelColor = Yes

WallBoundsMesh = WALLPLANE

DefaultModelConditionState
Model = DBCAMPWALL_SKN
End

ModelConditionState = WORLD_BUILDER
Model = DBCAMPWALL_SKN
End

ModelConditionState = BASE_BUILD
Model = DBCAMPWALL_BLD
End

IdleAnimationState
StateName = STATE_None
End

AnimationState = BASE_BUILD
StateName = STATE_None
Animation
AnimationName = DBCAMPWALL_BLD.DBCAMPWALL_BLD
AnimationMode = ONCE
AnimationSpeedFactorRange = 5 6.5; keep range wide to avoid lockstep anims
End
End

ModelConditionState = JUST_BUILT
Model = DBCAMPWALL_bld
End

AnimationState = JUST_BUILT
StateName = STATE_None
Animation
AnimationName = DBCAMPWALL_BLD.DBCAMPWALL_BLD
AnimationMode = MANUAL
End
Flags = START_FRAME_FIRST
End


ModelConditionState = ACTIVELY_BEING_CONSTRUCTED
Model = DBCAMPWALL_BLD
End
AnimationState = ACTIVELY_BEING_CONSTRUCTED
Animation
AnimationName = DBCAMPWALL_BLD.DBCAMPWALL_BLD
AnimationMode = MANUAL
End
StateName = STATE_None
Flags = START_FRAME_FIRST
End

; DAMAGED ----------------------------------------------------------------------------------------------------------------

ModelConditionState = DAMAGED
Model = DBCAMPWALL_D1
End

AnimationState = DAMAGED
StateName = STATE_None
; EnteringStateFX = FX_MinWallATransitionDamaged
End

; REALLYDAMAGED ----------------------------------------------------------------------------------------------------------------
TransitionState = TRANS_U_IntoReallyDamaged
EnteringStateFX = FX_BuildingReallyDamaged
Animation = D2
AnimationName = DBCAMPWALL_D2.DBCAMPWALL_D2
AnimationMode = ONCE
AnimationBlendTime = 0
End
End

ModelConditionState = REALLYDAMAGED
Model = DBCAMPWALL_D2
End
AnimationState = REALLYDAMAGED
StateName = STATE_ReallyDamaged
Animation = ReallyDamagedanimation
AnimationName = DBCAMPWALL_D2.DBCAMPWALL_D2
AnimationMode = ONCE
End
End

; RUBBLE ----------------------------------------------------------------------------------------------------------------


ModelConditionState = RUBBLE
Model = DBCAMPWALL_D3
ParticleSysBone NONE BuildingChunkBitsTrail
ParticleSysBone NONE ExplosiveMineFire02
End
AnimationState = RUBBLE
Animation = Death
AnimationName = DBCAMPWALL_D3.DBCAMPWALL_D3
AnimationMode = ONCE
End
StateName = STATE_Rubble
EnteringStateFX = FX_WallDie
End

ModelConditionState = POST_RUBBLE
Model = None
End

ModelConditionState = POST_COLLAPSE
Model = None
End

End


;----------------------- AUDIO -------------------------

VoiceSelect = Gui_PlotSelect

SoundOnDamaged = BuildingLightDamageStone
SoundOnReallyDamaged = BuildingHeavyDamageStone

ClientBehavior = AnimationSoundClientBehavior ModuleTag_AnimAudioBehavior
MaxUpdateRangeCap = 800
AnimationSound = Sound:WallDie Animation:GBCASTWALL_UD3.GBCASTWALL_UD3 Frames:0
End


; ***DESIGN parameters ***
DisplayName = OBJECT:DwarfCampWall
EditorSorting = STRUCTURE
Side = Dwarves
BuildTime = TDH_DWARVES_CAMP_WALL_REBUILD_TIME
BuildCost = TDH_DWARVES_CAMP_WALL_REBUILD_COST
ShroudClearingRange = 160

ArmorSet
Conditions = None
Armor = DwarfCampWall
DamageFX = MinasWallADamageFX
End

; *** ENGINEERING Parameters ***
KindOf = STRUCTURE IMMOBILE WALK_ON_TOP_OF_WALL CHUNK_VENDOR SELECTABLE NOT_AUTOACQUIRABLE;;;should this get autoacquired, or not? NO! or attack move will fail to enter the gate!
RadarPriority = STRUCTURE
VisionRange = TDH_DWARVES_CAMP_VISION_RANGE
KeepSelectableWhenDead = Yes
CommandSet = GenericSelfRepairCommandSet

Body = ActiveBody ModuleTag_02
MaxHealth = TDH_DWARVES_CAMP_WALL_HEALTH

GrabObject = EntThrownBuildingRock
GrabFX = FX_WallGrab
GrabDamage = 490
GrabOffset = X:16 Y:0
End

Behavior = BuildingBehavior BuildingModuleTag
NightWindowName = WINDOW_N01
; FireWindowName = WINDOW_F01
; GlowWindowName = WINDOW_G01
; FireName = FIRE01
End

Behavior = GettingBuiltBehavior ModuleTag_GettingBuilt
SelfBuildingLoop = BuildingConstructionLoop; Only played if we DON'T spawn a worker
SelfRepairFromDamageLoop = NoSound ; This doesn't cause an animation, so don't bother playing a sound
SelfRepairFromRubbleLoop = BuildingConstructionLoop
SpawnTimer = -1.0; Negative means no 'autoheal'
RebuildTimeSeconds = TDH_DWARVES_CAMP_WALL_REBUILD_TIME
End

Behavior = SiegeDockingBehavior ModuleTag_SiegeDocking
End

Behavior = KeepObjectDie ModuleTag_IWantRubble
End

Behavior = CastleMemberBehavior ModuleTag_CMB
CountsForEvaCastleBreached = Yes
End

Behavior = AttributeModifierAuraUpdate ModuleTag_WallBonus
StartsActive = Yes;If no, requires upgrade to turn on.
BonusName = WallBonus
RefreshDelay = 2000
ObjectFilter = ALL -MACHINE
;Range = 120 ; Range is overridden to affect people on us since we are a wall
;TargetEnemy = Yes; Alliances are ignored to affect people on us since we are a wall
End

Behavior = FireWeaponWhenDeadBehavior FireDeadTag1
DeathTypes = ALL
StartsActive = Yes
ActiveDuringConstruction = Yes
DeathWeapon = CastleWallDeath
End

Behavior = FireWeaponWhenDeadBehavior FireDeadTag2
DeathTypes = ALL
StartsActive = Yes
ActiveDuringConstruction = Yes
DeathWeapon = StandardWallDeath
End

Geometry = BOX
GeometryMajorRadius = 22.0
GeometryMinorRadius = 120.0
GeometryHeight = 10
GeometryOffset = X:17 Y:0 Z:0

;AdditionalGeometry = CYLINDER
;GeometryMajorRadius = 26.0
;GeometryMinorRadius = 0
;GeometryHeight = 53.0
;GeometryOffset = X:0 Y:0 Z:0

;AdditionalGeometry = CYLINDER
;GeometryMajorRadius = 26.0
;GeometryMinorRadius = 0
;GeometryHeight = 53.0
;GeometryOffset = X:0 Y:0 Z:0

AdditionalGeometry = BOX
GeometryMajorRadius = 20.0
GeometryMinorRadius = 12.0
GeometryHeight = 10.0
GeometryOffset = X:18 Y: 100 Z:0
GeometryName = Bookend

AdditionalGeometry = BOX
GeometryMajorRadius = 18.0
GeometryMinorRadius = 12.0
GeometryHeight = 20.0
GeometryOffset = X:18 Y:-106 Z:0
GeometryName = Bookend

GeometryContactPoint = X:-29.397 Y:0.326 Z:108.421 Swoop
GeometryContactPoint = X: 40 Y:-70 Z:0 Grab
GeometryContactPoint = X:-40 Y:-60 Z:0 Grab
GeometryContactPoint = X: 23 Y:-40 Z:0 Grab
GeometryContactPoint = X:-18 Y:-40 Z:0 Grab
GeometryContactPoint = X: 23 Y: 40 Z:0 Grab
GeometryContactPoint = X:-40 Y: 40 Z:0 Grab
GeometryContactPoint = X: 40 Y: 60 Z:0 Grab
GeometryContactPoint = X:-40 Y: 70 Z:0 Grab


GeometryIsSmall = No
GeometryRotationAnchorOffset = X:0.0 Y:0.0
Shadow = SHADOW_VOLUME
End

Edited by Nertea, 10 August 2010 - 08:41 PM.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#2 Gfire

Gfire

    Nuju

  • Project Team
  • 2,173 posts
  • Location:I have returned from the depths
  • Projects:Finding My Way
  •  The Perfectionist

Posted 22 June 2009 - 11:29 PM

Could you use multiple weapons to have different scatters, that all fire at the same time? I haven't done anything like this, but it really depends on the situation, I guess.
Greetings, community.

#3 m@tt

m@tt

    #######

  • Project Team
  • 4,056 posts
  • Location:England
  • Projects:The Dwarf Holds
  •  T3A Chamber Member

Posted 23 June 2009 - 01:35 AM

Does the Morder Catapult with the skulls toggle do the scatter thing? Or does that throw one lump which fragments when it hits the ground?
Posted Image

#4 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 23 June 2009 - 07:23 AM

It just throws an animated bundle - pretty much the first thing I checked :huh:

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#5 Sûlherokhh

Sûlherokhh

    Sagacious Engineer

  • Project Team
  • 3,754 posts
  • Location:Central Germany
  • Projects:S.E.E., Sage A.I., Code Advisor
  •  'Axe'er of the Gordic Knot

Posted 23 June 2009 - 01:00 PM

Try experimenting with Legolas Multishoot ability. Decrease seperation to almost simultaneously, decrease chance of missile/power to aim for an obvious target (if that is possible, i need to check) and obviously change the missile and remove the streak animation.

Edit: For a hint about how the different settings affect the performance of the module, compare legolas' power with gandalf's lightning, which uses the same behavior with different numbers and FX.

Edited by Sûlherokhh, 23 June 2009 - 01:02 PM.

bannerreal01mittelit3.jpg
Axed Head and A.I. Coder for S.E.E. and ... stuff

".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."


#6 Ringwraith Captain

Ringwraith Captain
  • Members
  • 46 posts

Posted 24 June 2009 - 09:32 PM

To make the rocks scatter, just use
CODE
HitPercentage = 0
ScatterRadius = 5.0

Add those lines to the weapon (if it doesn't already have them), and then add as many ProjectileNuggets as you want rocks to scatter. Just change ScatterRadius to whatever you want. You could also play with HitPercentage - scattering projectiles works best when HitPercentage is 0, but you could change it. For example, set it to like 25, and 1 out of every 4 projectiles would hit the target directly instead of scattering.

As for the wall, it says "DwarfCampWall". Is it about the same height as the Gondor and Rohan Camp walls? Cause if so, then I dont' think theres anyting that can be done. I seem to remember seeing archers shoot thru Gondor and Rohan's camp wall too. But I'm not sure - been a while since I've fired up BFME1.

#7 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 25 June 2009 - 02:46 PM

Well as far as I can tell that last method doesn't work; mainly because all the rocks' scatter gets calculated before the projectiles are spawned. Therefore, they all have the same scatter, and hit the same point. I may actually end up just animating a bunch of rocks drifting apart and give them a large splash, it would be simpler and more regular in terms of the damage the player gets.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#8 Ringwraith Captain

Ringwraith Captain
  • Members
  • 46 posts

Posted 25 June 2009 - 03:09 PM

DId you change ScatterRadius? Cause if you left it at 5.0 like is in the code I posted, then of course you won't be able to see much spread in game. Try making it something like 20, 30, 50, etc. And if you want more even damage over the area, try adding more ProjectileNuggets.
I've used this method before, but with arrows not rocks, and it gives a very nice spread of arrows in the target area, using like 20 or so arrows and a ScatterRadius of 180.

Edited by Ringwraith Captain, 25 June 2009 - 03:10 PM.


#9 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 25 June 2009 - 04:21 PM

Hmm, I will try boosting the scatter radius again (at 100 now). If not, I'll post my code, 'cause there may be some other issue

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#10 MrFurious

MrFurious
  • Members
  • 87 posts
  • Location:The Netherlands
  • Projects:Memories Through Middle-Earth Coder

Posted 25 June 2009 - 07:23 PM

Maybe this code will work:
ProjectileNugget
	AlwaysAttackHereOffset	= X:0 Y:0 Z:0						; it directly on top of us, and just use an empty warhead
	UseAlwaysAttackOffset	= Yes								; so we don't assert.
	ProjectileTemplateName  = <Projectile>
	WarheadTemplateName	 = <Warhead>
End

It's used in BFME2, but maybe it works in BFME1 too. Just add several projectilenuggets, and use different offsets each time.

#11 Rob38

Rob38

    Believer of Hope

  • Hosted
  • 3,567 posts
  • Location:USA
  • Projects:Helm's Deep Last Hope
  •  One who is not afraid of new challenges

Posted 26 June 2009 - 04:45 AM

For shooting over walls, I believe you have to edit the actual projectile arrow object in goodfactionsubobjects.ini I had this issue with my Elven Bombarders and getting them to shoot over the Deeping wall. You have to edit this in the arrow object:

Behavior = BezierProjectileBehavior ModuleTag_04
   ; To tweak a Bezier path
 ;  DetonateCallsKill = Yes
	FirstHeight = 130;73 ; Height of Bezier control points above highest intervening terrain
	SecondHeight = 157;100
	FirstPercentIndent = 30%; Percentage of shot distance control points are placed
	SecondPercentIndent = 70%
	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
That code is what I currently use. The only problem is that I do not know how it affects attacking regular units. It may make the arrow go up and then fall back down on them.

signature_group1.gif

 

16821.png


#12 Mathijs

Mathijs

    Post-modern Shaman

  • Network Leaders
  • 13,756 posts
  • Projects:Age of the Ring
  • Division:Revora
  • Job:Leader

Posted 26 June 2009 - 11:18 PM

The thing is, Nert wants to stop them from firing over a low wall. :xcahik_:

No fuel left for the pilgrims


#13 Kwen

Kwen

    Vileartist

  • T3A Staff
  • 4,865 posts
  • Location:Korea I wish
  • Projects:It'sa secreeet
  •  T3A's First N00b
  • Division:BFME
  • Job:T3A Expert
  • Donated

Posted 28 June 2009 - 01:32 AM

Does he mean firing over a low wall or through a low wall? Because I see no strategical problem with firing arrows over a low wall... because it would most certainly happen in real life...

                           https://www.twitch.tv/vileartist - Yes shameless self-promotion

          ----------------------------------------------------------------------------------------------------------------------

                            "Old modders never die, they just fade away" ~ Hostile


#14 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 28 June 2009 - 06:20 PM

And every single BFME archer fires straight. so the arrows always go through it.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#15 Rob38

Rob38

    Believer of Hope

  • Hosted
  • 3,567 posts
  • Location:USA
  • Projects:Helm's Deep Last Hope
  •  One who is not afraid of new challenges

Posted 28 June 2009 - 08:38 PM

And every single BFME archer fires straight. so the arrows always go through it.

Did you try my suggestion?

signature_group1.gif

 

16821.png


#16 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 28 June 2009 - 09:09 PM

Umm... I don't want to try it :) I don't want to modify the behaviour of arrows in general... I just want units outside to be unable to target things inside my walled camp.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#17 Rob38

Rob38

    Believer of Hope

  • Hosted
  • 3,567 posts
  • Location:USA
  • Projects:Helm's Deep Last Hope
  •  One who is not afraid of new challenges

Posted 28 June 2009 - 09:18 PM

I thought arrows could not fire over walls in BFME?

signature_group1.gif

 

16821.png


#18 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 28 June 2009 - 09:33 PM

Bleeeeh I have a new wall. It's short. Probably not high enough to trigger the collision check.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#19 GothmogtheOrc

GothmogtheOrc

    Ruler of the Morgul Vale

  • Hosted
  • 2,263 posts
  • Location:USA
  • Projects:Kings of the West Mod
  •  T3A Chamber Member - Retired

Posted 28 June 2009 - 09:45 PM

What about this line from Weapon.ini
ProjectileCollidesWith = ENEMIES NEUTRAL STRUCTURES WALLS
Do all the archers weapon's have this? I grabbed it from the rohan fire arrow warhead but didn't see it on the normal warhead. Seems like that would solve your problem...

Edit: meh, went ahead and checked them myself: it's about 50/50. Some archers have it, some don't. Try putting it on all of them or finding one that definately has it and testing with it. I bet that will sove your problem. It's what the catapults use and it works for them. .... ah, although I did just find an EA comment on the catapult that says "Structures is the default, btw."... so maybe the ones that don't have it currently actually do, it just has structures only with the default. So maybe adding walls to all of them would work then.

-Gto

Edited by GothmogtheOrc, 28 June 2009 - 09:51 PM.

Nine%20rings.jpg
Click on my Sig to go to my BFME Modding site where you can download my mods.
KotW%20Morgul%20In-game.jpg
Kings of the West Mod Leader
*Retired. PM me if you need to get a hold of me as I'll get an email notification and should reply within a day or so*


#20 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 28 June 2009 - 10:05 PM

I'll give that a shot. The thing that worries me about that is that it may not affect targeting, just collision. That would be better than nothing, of course, but not ideal.

edit - No effect

Edited by Nertea, 28 June 2009 - 10:37 PM.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users