Jump to content


Photo

Script Question


  • Please log in to reply
1 reply to this topic

#1 RangerOfIthilien

RangerOfIthilien
  • Members
  • 14 posts

Posted 29 April 2021 - 12:51 PM

Hi folks,

There is something which I would like to understand (at least try to). I have 2 Questions.

 

==================================== Q 1

I made somthing simple but it doesn't work, so I just want to know what I am doing wrong.

 

So, I created my Test Hero in 2.01 and want to give him Upgrades with Script. 

;hero.ini
Behavior = AIUpdateInterface ModuleTag_03
    AutoAcquireEnemiesWhenIdle = Yes ATTACK_BUILDINGS
    MoodAttackCheckRate = 500
    AILuaEventsList = TestHeroFunctions
End
 
Scripts I took from Data1.big.
;scriptevents.xml
    <EventList Name="TestHeroFunctions" Inherit="BaseScriptFunctions">
        <EventHandler EventName="OnCreated" ScriptFunctionName="GainUpg" DebugSingleStep="false"/>
    </EventList>
 
;scripts.lua
function GainUpg(self)
    ObjectGrantUpgrade( self, "Upgrade_TestBuilding" )
end
 
So, this doesn't work and my hero didn't get Upgrade_TestBuilding, any ability, weapon Upg / armor or attribut which I connect with this upg doesn't trigger. Ofc, if this upg I put in his experiance.level or buy upg, thigs are working, but I don't understand why Script stuff doesn't working.
===========================================================================================================
 
 

==================================== Q 2
is Inherit="BaseScriptFunctions" matters ? I mean there are others like InfantryFunctions, CavalryFunctions, GondorCavalryFunctions...
Does anyone know What is the difference between theses stuff ? How to use I mean at what condition ? Does anyone have any list of this Inherit names or know where I can find it ?
============================================================================================================
 
Thanks in advance  :aarambo:

 



#2 JUS_SAURON

JUS_SAURON

    El Shaddai

  • Members
  • 1,581 posts
  • Location:Trinidad
  • Projects: BFME2 MOD - Power Of The Ring
  •   INI Coder

Posted 16 May 2021 - 06:55 PM

I never work with LUA , so I cant fix your exact problem 

But there are many ways to give a hero an upgrade

 

1. At the start , use 

 

Behavior = GrantUpgradeCreate ModuleTag_ActLikeAnOldUpgradexx
UpgradeToGrant = Upgrade_NewUpgrade 
GiveOnBuildComplete = Yes ; The ExemptStatus UnderConstruction hack doesn't work on foundation buildings.
End
 
2. After a set time ,
 
 Behavior = ObjectCreationUpgrade MakeTheFreeTreb2xxXY
TriggeredBy = Upgrade_NewUpgrade
GrantUpgrade = Upgrade_NewUpgrade2
Delay = 60000.0
 
Offset = X:0.0 Y:0.0 Z:0.0
FadeInTime = 600
End
 
3. In experience.ini , as the unit upgrades as it fights
You can use existing Upgrade_ObjectLevel4 
 
4. with map scripts , Just use exiting names as needed
 
5. When near an object , not used much but possible , if you have an attribute aura that gives an upgrade
 
Hope this helps 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users