Jump to content


Photo

How does Lurtz switch to Meleebow?


  • Please log in to reply
4 replies to this topic

#1 Imladhrim

Imladhrim
  • Members
  • 51 posts
  • Projects:Otherland

Posted 08 January 2007 - 04:27 PM

Greetings!

I've created two Wizard Weapons in weapons.ini

one is based on the CaH Melee Weapon
the other launches a tiny firbolt damage nugget

Since Lurtz can use his Bow both for Ranged and Melee Combat
I thought, I could do the same for the Wizard's Staff.

Right now I added the following Code to createaheroweaponupgrades.inc

//-------------------------------------------------------------
// Wizard Staff	1 Weapon upgrade. violett light
//-------------------------------------------------------------
WeaponSet
	Conditions			   = WEAPONSET_CREATE_A_HERO_WS_07		//CLOSE_RANGE	 CONTESTING_BUILDING
	Weapon				   = PRIMARY WizardStaffLightning
	AutoChooseSources	   = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End
WeaponSet
	Conditions = CLOSE_RANGE
	Weapon = PRIMARY WizardStaffLightning
	Weapon = SECONDARY  WizardStaff
	OnlyAgainst = PRIMARY STRUCTURE
End

Behavior = DualWeaponBehavior ModuleTag_WSMelee
	SwitchWeaponOnCloseRangeDistance = 30
End

But it doesn't work.

Any Ideas?

Edited by Imladhrim, 08 January 2007 - 04:31 PM.


#2 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 08 January 2007 - 04:35 PM

Try adding WEAPONSET_CREATE_A_HERO_WS_07 to the conditions of the close range weapon.
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#3 Imladhrim

Imladhrim
  • Members
  • 51 posts
  • Projects:Otherland

Posted 08 January 2007 - 08:20 PM

No, not working

I only managed to achieve that he uses the faster attack speed of the WizardStaff to fire the WizardStaffLightning Projectiles, whenever enemies come close to him.

I fear, the CLOSE_RANGE condition forces him in meleemode, even while the actual target is still a bit away..

Are there any "conditions" like
while target close use club
while target far use arrow

?
Or is there a way to achieve such a behavior?

#4 Grim

Grim

    Mad Axe

  • Project Team
  • 537 posts
  •  T3A Team Chamber Member
  • Division:T3A Moderator

Posted 09 January 2007 - 02:43 PM

Don't forget you need 2 different anims for the weapons. In code, keep in mind weapon PRIMARY means suffix _A, SECONDARY _B, etc
Then, if you want to have two weapons, one for close range, the other for ranged, you need two weaponsets, one with "None" and one with "CLOSE_RANGE".
The DualWeaponBehavior will decide at what distance the CLOSE_RANGE weaponset will work.

In the end, you should have something like that:

WeaponSet
	Conditions			   = None
	Weapon				   = PRIMARY WizardStaffLightning
	AutoChooseSources	   = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End
WeaponSet
	Conditions = CLOSE_RANGE
	Weapon = SECONDARY  WizardStaff
	AutoChooseSources	   = SECONDARY FROM_PLAYER FROM_SCRIPT FROM_AI
End

Behavior = DualWeaponBehavior ModuleTag_WSMelee
	SwitchWeaponOnCloseRangeDistance = 30
End

EDIT: I didn't see it was for CAH, try the following code then. However as CAH code can be complex, i can't confirm it's working.

WeaponSet
	Conditions			   = WEAPONSET_CREATE_A_HERO_WS_07
	Weapon				   = PRIMARY WizardStaffLightning
	AutoChooseSources	   = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End
WeaponSet
	Conditions = WEAPONSET_CREATE_A_HERO_WS_07 CLOSE_RANGE
	Weapon = SECONDARY  WizardStaff
	AutoChooseSources	   = SECONDARY FROM_PLAYER FROM_SCRIPT FROM_AI
End

Behavior = DualWeaponBehavior ModuleTag_WSMelee
	SwitchWeaponOnCloseRangeDistance = 30
End

Edited by Grim, 09 January 2007 - 02:47 PM.

Posted Image

#5 Imladhrim

Imladhrim
  • Members
  • 51 posts
  • Projects:Otherland

Posted 10 January 2007 - 09:39 AM

Solved!
After some time spent with other problems, i tried to tackle this one again..
Result: the only problem from my first attempts was a spelling mistake :p

I used Grims advice and added another rule, so that my Wizard would always use the meleeweapon while attacking buildings

WeaponSet
	Conditions			   = WEAPONSET_CREATE_A_HERO_WS_07
	Weapon				   = PRIMARY WizardStaffLightning
	Weapon 					 = SECONDARY  CreateAHeroWizardStaff
	OnlyAgainst 			= SECONDARY STRUCTURE
	AutoChooseSources	   = PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
End
WeaponSet
	Conditions = CLOSE_RANGE
	Weapon = SECONDARY  CreateAHeroWizardStaff
	AutoChooseSources	   = SECONDARY FROM_PLAYER FROM_SCRIPT FROM_AI
End

Behavior = DualWeaponBehavior ModuleTag_WSMelee
	SwitchWeaponOnCloseRangeDistance = 25
End

That alone did not work, .. i saw the effect .. but no animations..
Luckily I remembered Grims advice about animations .. so edited createaheroanims.inc
I copyed anything with a "_A" and changed that Letter to "_B" in the Copy

Sometimes the AI acts a bit stupid (takes longer to aquire new enemies, does not switch back to longrange mode right after the last meleerange kill, runs towards archers to kill them with the Melee Weapon, instead of fireing on them) .. but most of the time it works flawless.

Thanks guys

Edited by Imladhrim, 23 January 2007 - 12:46 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users