Jump to content


Photo

Hero's Power connected with Building


  • Please log in to reply
3 replies to this topic

#1 Eazy-E 123

Eazy-E 123
  • Members
  • 72 posts

Posted 08 April 2020 - 09:35 PM

Hi,

 

I wanted to know if I can make Power connected with Building.

 

Let's take exp Farm building and any power from Hero : blade master, attribut, summon power ...

 

What I want is:

When hero is nearby farm He can use his Power but if he is Far from Farm his Power is deactivated and he can not use it.

 

Do I need any scripts for that or there is othe way ?

 

Thanks and have a nice day :)

 



#2 Symonius

Symonius
  • Members
  • 51 posts
  • Location:The ancient shield
  • Projects:TROW Mod
  •  Just a winged modder

Posted 22 April 2020 - 07:24 PM

I just did the exact opposite, so i think it can work for you as well.

When my Cirdan stay near a Port he gives to the structure the ability to build a great personal Vessel.

This is the power i gave to Cirda so that at level 3 it can trigger to the port the AttributeModifier ShipwrightKingKnowledge:
;-----------------------------------------------------------------------------
	;	Shipwright King
	;-----------------------------------------------------------------------------	
	Behavior = AttributeModifierAuraUpdate ModuleTag_Shipwright
		StartsActive						= No
		BonusName							= ShipwrightKingKnowledge
		TriggeredBy							= Upgrade_ObjectLevel3
		RefreshDelay						= 2000
		Range								= 300
		AntiCategory						= BUFF
		ObjectFilter						= NONE +PORT
	End
	
	Behavior = UnpauseSpecialPowerUpgrade ModuleTag_ShipwrightLeadership
		SpecialPowerTemplate				= SpecialAbilityFakeLeadership2
		TriggeredBy							= Upgrade_ObjectLevel3
	End

	Behavior = SpecialPowerModule ModuleTag_ShipwrightLeadershipUpdate
		SpecialPowerTemplate				= SpecialAbilityFakeLeadership2
		UpdateModuleStartsAttack			= No
		StartsPaused						= Yes
	End
Then into the AttributeModifier.ini i defined it:
ModifierList ShipwrightKingKnowledge
	Category					= LEADERSHIP
	Upgrade 					= Upgrade_ShipwrightKing Delay:500 
	Modifier 					= PRODUCTION 200%
	Duration					= 3000
	FX						= FX_GenericLeadership
	ReplaceInCategoryIfLongest	= Yes
	IgnoreIfAnticategoryActive	= Yes
End
So as you can see there is the 2nd line of the Modifier that state "Upgrade = Upgrade_ShipwrightKing Delay:500 ".
It means that this attribute gives the Upgrade_ShipWrightKing to the filtered objects and the duration set the expire time in 3 seconds (If Cirdan go away from it).

So basically you just need to add a condition of NeededUpgrade into the object SpecialPower's code or in the relative Button, like:
;------------------------------------------------------------------------------
CommandButton Command_ConstructCirdanVessel
	Command				= UNIT_BUILD
	Object				= ElvenCirdanVessel
	Options			= CANCELABLE NEED_UPGRADE
	NeededUpgrade	  	= Upgrade_ShipwrightKing
	TextLabel			= CONTROLBAR:ConstructCirdanVessel
	ButtonImage			= BCShipwright_GoodBattleship
	ButtonBorderType    		= BUILD
	DescriptLabel       		= CONTROLBAR:ToolTipBuildConstructCirdanVessel
	Radial				= Yes
	InPalantir	   		= Yes
	ShowProductionCount		= Yes
End
I hope this could help you :whathuh:

Edited by Symonius, 22 April 2020 - 11:19 PM.

"All we have to decide is what to mod with the time that is given us"


#3 Eazy-E 123

Eazy-E 123
  • Members
  • 72 posts

Posted 23 April 2020 - 01:14 AM

I just did the exact opposite, so i think it can work for you as well.

When my Cirdan stay near a Port he gives to the structure the ability to build a great personal Vessel.

This is the power i gave to Cirda so that at level 3 it can trigger to the port the AttributeModifier ShipwrightKingKnowledge:

;-----------------------------------------------------------------------------
	;	Shipwright King
	;-----------------------------------------------------------------------------	
	Behavior = AttributeModifierAuraUpdate ModuleTag_Shipwright
		StartsActive						= No
		BonusName							= ShipwrightKingKnowledge
		TriggeredBy							= Upgrade_ObjectLevel3
		RefreshDelay						= 2000
		Range								= 300
		AntiCategory						= BUFF
		ObjectFilter						= NONE +PORT
	End
	
	Behavior = UnpauseSpecialPowerUpgrade ModuleTag_ShipwrightLeadership
		SpecialPowerTemplate				= SpecialAbilityFakeLeadership2
		TriggeredBy							= Upgrade_ObjectLevel3
	End

	Behavior = SpecialPowerModule ModuleTag_ShipwrightLeadershipUpdate
		SpecialPowerTemplate				= SpecialAbilityFakeLeadership2
		UpdateModuleStartsAttack			= No
		StartsPaused						= Yes
	End
Then into the AttributeModifier.ini i defined it:
ModifierList ShipwrightKingKnowledge
	Category					= LEADERSHIP
	Upgrade 					= Upgrade_ShipwrightKing Delay:500 
	Modifier 					= PRODUCTION 200%
	Duration					= 3000
	FX						= FX_GenericLeadership
	ReplaceInCategoryIfLongest	= Yes
	IgnoreIfAnticategoryActive	= Yes
End
So as you can see there is the 2nd line of the Modifier that state "Upgrade = Upgrade_ShipwrightKing Delay:500 ".
It means that this attribute gives the Upgrade_ShipWrightKing to the filtered objects and the duration set the expire time in 3 seconds (If Cirdan go away from it).

So basically you just need to add a condition of NeededUpgrade into the object SpecialPower's code or in the relative Button, like:
;------------------------------------------------------------------------------
CommandButton Command_ConstructCirdanVessel
	Command				= UNIT_BUILD
	Object				= ElvenCirdanVessel
	Options			= CANCELABLE NEED_UPGRADE
	NeededUpgrade	  	= Upgrade_ShipwrightKing
	TextLabel			= CONTROLBAR:ConstructCirdanVessel
	ButtonImage			= BCShipwright_GoodBattleship
	ButtonBorderType    		= BUILD
	DescriptLabel       		= CONTROLBAR:ToolTipBuildConstructCirdanVessel
	Radial				= Yes
	InPalantir	   		= Yes
	ShowProductionCount		= Yes
End
I hope this could help you :whathuh:

 

Thanks man, I already found the way, but I will try your codes too.
I will build Ships with help of Cirdan to go to Valinor   :) 



#4 Symonius

Symonius
  • Members
  • 51 posts
  • Location:The ancient shield
  • Projects:TROW Mod
  •  Just a winged modder

Posted 23 April 2020 - 01:31 PM

Earendil bless your code then 😉

"All we have to decide is what to mod with the time that is given us"





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users