Jump to content


Photo

Gandalf's coding questions


  • Please log in to reply
13 replies to this topic

#1 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 26 February 2011 - 02:32 AM

I thought I'd make one full topic about my coding questions since i know i'm gonna have many questions in the future and I dont wanna have to keep starting new topics every time.
So my latest question: I've been messing around with unit combo hordes recently and i have no trouble comboing up different hordes. However, theres a a little issue i have. My typical horde has swordsmen stationed in front of archers.
The archers will fire at the enemy, but the swordsmen only attack if the enemy goes right up to them.
So basically, they have to wait for the enemy to go directly up to them.
But i want my swordsmen to be able to break formation and move forward a bit to attack the enemy instead of just standing there. Is this possible? I know it has something to do with the hordes weapon, if i make it "NormalMeleeHordeRangefinder" the swordsmen behave how i want them to but then the archers cannot fire.
If i change it to "NormalRangedHordeRangefinder" the archers can shoot but then the swordsmen just stand still as before.
Is there a workaround way for this? Sorry if im not clear

Edited by Radspakr, 26 February 2011 - 04:46 AM.
Radit:Line breaking


#2 Radspakr Wolfbane

Radspakr Wolfbane

    The John Farnham of modding

  • Members
  • 7,722 posts
  • Location:less than 5 meters from my bed
  • Projects:Comeback tour
  •  The Retired Beard

Posted 26 February 2011 - 04:48 AM

Edit this line to a bigger number.
MeleeAttackLeashDistance = 25

Break dancing into the hearts of millions


#3 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 26 February 2011 - 03:38 PM

Hey rad thanks for the reply. However i tried changing the MeleeAttackLeashDistance number from 25 to 100, and still there is no change. The soldiers still just stand there which is annoying cuz sometimes 1 soldier will be attacking an Orc directly in front of him, but the soldier next to him doesnt help, he just stands there, waiting for another orc to go directly in front of him so he can attack. Might there be a way to configure the horde's weaponset to allow archers to fire and at the same time let the gondor soldiers attack instead of just standing there?

#4 Spartan184

Spartan184

    :)

  • Project Team
  • 1,592 posts
  • Location:Moon
  • Projects:Random Modding Projects
  •  Coder, Map.ini Coder, Mapper, and Beta Tester

Posted 26 February 2011 - 07:28 PM

Well if you go look at "NormalMeleeHordeRangefinder" in the weapon.ini it has only for melee, so maybe adding in the ranged stuff in might make it so archers can attack also. I might try to get this working myself later :)


 

safsignature.png

 


#5 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 26 February 2011 - 08:25 PM

Ok I'll give it a go, thanks Spartan. And if you figure it out, please let me know how its done. Thanks!

#6 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 02 March 2011 - 03:30 AM

I have another question: i noticed that theres audio in the game for when units are ambushed, GondorSoldierVoiceAmbushed, for example. I've never heard this audio ingame, how is it triggered? Like what needs to happen in order for the Ambush audio to play?

#7 Unknown

Unknown

    title available

  • Hosted
  • 1,314 posts
  • Location:England
  • Projects:Work
  •  I changed

Posted 02 March 2011 - 05:23 PM

I have another question: i noticed that theres audio in the game for when units are ambushed, GondorSoldierVoiceAmbushed, for example. I've never heard this audio ingame, how is it triggered? Like what needs to happen in order for the Ambush audio to play?


Check the units ini ._.'

#8 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 02 March 2011 - 06:44 PM

I have another question: i noticed that theres audio in the game for when units are ambushed, GondorSoldierVoiceAmbushed, for example. I've never heard this audio ingame, how is it triggered? Like what needs to happen in order for the Ambush audio to play?


Check the units ini ._.'


From default/unit.ini:

; Object is not ATTACKING or ENGAGED, and takes damage from an enemy who is invisible due to stealth

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


#9 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 03 March 2011 - 04:11 AM

Thankyou very much, this is exactly what i was looking for!

#10 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 04 March 2011 - 11:22 PM

Is is possible to attach attribute modifiers to certain emotions? For example, when units are cheering or taunting the enemy, they recieve a small damage boost and likewise, if they're afraid, they recieve a negative bonus. I'd appreciate any help for this

#11 Lauri

Lauri

    Old man Lauri

  • Hosted
  • 10,438 posts
  • Location:Norway
  • Projects:The 4th Age
  •  The very worst T3A Team Chamber Member

Posted 04 March 2011 - 11:49 PM

It is possible, yes, but you would have to make it last longer than the cheering\taunting itself, because they'll only have it when the anim triggers (the way I know)
It's rather late, so I might forget something!

Rough guide:
Make the attributemodifier :evgr:
Make new references for the various Animation states in the scriptevets.xml

Example:

<ModelConditionEvent Name="WeAreNowAfraid">
<Conditions>+EMOTION_AFRAID</Conditions>
</ModelConditionEvent>
<ModelConditionEvent Name="WeAreNowAfraidNoLonger">
<Conditions>-EMOTION_AFRAID</Conditions>
</ModelConditionEvent>

You'll have to set them up for each anim-state related to fear\cheer\taunt.
Or, acctually, you can just use the BeAfraid ScriptedEvent that is in vanilla.
In your units LUA part, simply make those trigger a power. Now, this power is something you'll have to add to the unit (and is also the power that triggers the attributemodifier. Look at Theodens Glorious Charge)

It's late, and someone else will have to fill you in if you didn't get any of that, which I'm sure you didn't :ex:

T4A_Logo_-_article.png

The 4th Age version 0.8 has been released: Link


#12 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 05 March 2011 - 07:42 PM

Thankyou Lauri, I appreciate the reply. I have never done any LUA coding or scripts before, but i guess its time i learned it. and I think i get most of what you said, I'm gonna have a go at it later today. thanks again!

#13 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 09 March 2011 - 09:28 PM

I've stumbled across a little problem. I've given my Citadel a commandset switcher, so it toggles commandsets between purchasing heroes and purchasing various upgrades. It works perfectly, no problems. However, when the citadel is destroyed, and i try to rebuild it, the "CommandSet Switch" button is still there as an option. So basically, I can either choose to Rebuild my citadel or Switch the commandset. But I only want the Commandset Switcher feature available ONLY when the citadel is built. Is there a way to fix this?

#14 Gandalf17

Gandalf17
  • Members
  • 59 posts
  • Location:United States
  • Projects:Scaled War in the South
  •  Coder

Posted 17 March 2011 - 07:18 PM

I'm having trouble with my Mazgul Morgul Blade ability. The instant I trigger the ability in game, the game crashes. As far as i can tell, I dont see any error in my coding. But I'm probably missing something. Codes are below:

Nazgul.ini
;;; MORGUL BLADE ;;;
	Behavior = SpecialPowerModule ModuleTag_MorgulBladeStarter                      
		SpecialPowerTemplate		= SpecialAbilityNazgulMorgulBladeAttack
		UpdateModuleStartsAttack	= Yes
		StartsPaused			= No
		TriggerFX			= FX_GothmogSwordFlash
		;InitiateSound			= GandalfVoiceAttackWizardBlast	;this plays when he targets, not when he fires
	End

	Behavior = WeaponFireSpecialAbilityUpdate ModuleTag_MorgulBladeWeaponFireUpdate
		SpecialPowerTemplate    = SpecialAbilityNazgulMorgulBladeAttack
		WhichSpecialWeapon		= 2
		SkipContinue			= Yes

		UnpackTime              = 50
		PreparationTime         = 1   
		PersistentPrepTime      = 1500 
		PackTime                = 1100 

		AwardXPForTriggering    = 0		
		StartAbilityRange		= 19.0
		MustFinishAbility		= Yes
		SpecialWeapon			= NazgulMorgulBladeAttack							End
	End

Weapon.ini
;-------------------------------------------------------------------------------
Weapon NazgulMorgulBladeAttack     ; Poison targeted enemy until death
	LeechRangeWeapon      = Yes
	AttackRange           = 20.0
	MeleeWeapon           = Yes
	DelayBetweenShots     = WITCHKING_DELAYBETWEENSHOTS 	; time between shots, msec
	PreAttackDelay        = WITCHKING_SWORD_PREATTACKDELAY 	; 300 is mace swing delay time before contact with target.
	PreAttackType         = PER_SHOT ; Do the delay each time we attack
	FireFX                = FX_GondorSwordHit
	FiringDuration        = WITCHKING_FIRINGDURATION 	; Duration of the mace swing 

	DamageNugget                        ; A basic Nugget that just does damage
		Damage        = 200 ;WITCHKING_DAMAGE				
		Radius        = 0.0
		DelayTime     = 0
		DamageType    = SLASH
		;DamageFXType  = NONE
		DeathType     = NORMAL
		DamageScalar  = 10% NONE +RohanEowyn
	End
	DamageFieldNugget                   ; A Nugget that lays down an area of damage that persists independantly
    		WeaponTemplateName = PersistingMorgulBladeWeapon  
    		Duration = 30000                            
  	End
End

;------------------------------------------------------------------------------
Weapon PersistingMorgulBladeWeapon
  DelayBetweenShots           = 25                ; time between shots, msec
  DamageNugget                        ; A basic Nugget that just does damage
    Damage        = 10.0
    Radius        = 5.0
    DelayTime     = 0
    DamageType    = FLAME
    DamageFXType  = FLAME
    DeathType     = BURNED
  End
End

SpecialPower.ini
;------------------------------------------------------------------------------
SpecialPower SpecialAbilityNazgulMorgulBladeAttack
	Enum			= SPECIAL_WIZARD_BLAST
	ReloadTime		= 60000
	PublicTimer		= No
	;InitiateSound	= GandalfVoiceAttackWizardBlast	;this plays when he fires, not when he targets
End

I think it has something to do with the "DamageFieldNugget" cuz I tried getting a Poison Arrows ability, which also has a "DamageFieldNugget", to work for one of my units and the game also crashed the instant the attack was triggered. But I cant seem to find any error in my code. I'd appreciate any help with this.




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users