Results 1 to 8 of 8

Thread: Question regarding LUA

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Question regarding LUA

    Is the number listed there after effect the percentage chance of gaining the ancilleriy?

    events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
    function (context)
    if conditions.CharacterType("General", context) and conditions.CharacterTrait("C_General_Scout", context) == 1 and conditions.CharacterTurnsInEnemyLands(context) >= 0 and conditions.CharacterWonBattle(context) and not conditions.CampaignName("episodic_1", context) and not conditions.CampaignName("episodic_3", context) and not conditions.CharacterCultureType("tribal", context) then
    if conditions.DateInRange(1700, 1900, context) then
    effect.ancillary("Ancillary_Army_Military_Surveyor", 2, context)
    end
    return true
    end




    return false
    end
    --[[ Ancillary_Army_Ottoman_Turncoat_2_Trigger ]]--
    events.CharacterCompletedBattle[#events.CharacterCompletedBattle+1] =
    function (context)
    if conditions.CharacterType("General", context) and not conditions.CharacterFactionName("ottomans", context) and conditions.CharacterFoughtCulture("middle_east", context) and conditions.CharacterWonBattle(context) and conditions.BattleResult("major_victory", context) and not conditions.CampaignName("episodic_1", context) and not conditions.CampaignName("episodic_3", context) and not conditions.CharacterCultureType("tribal", context) then
    if conditions.DateInRange(1700, 1900, context) then
    effect.ancillary("Ancillary_Army_Ottoman_Turncoat", 17, context)
    end
    return true
    end
    return false
    end


    Also where are the events being called from?
    Last edited by Lord_Phan; March 25, 2009 at 02:06 PM.

  2. #2
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Question regarding LUA

    effect.ancillary("Ancillary_Army_Military_Surveyor", 2, context)

    This number is the probability in percent.

    And they're called from the game exe. What you do is add an event listener to a kind of dictionary. This dictionary is then read by Empire.exe and the events are executed appropriately.

    No thing is everything. Every thing is nothing.

  3. #3

    Default Re: Question regarding LUA

    And the "dictonary" are the events.lua ?

    So if i add my own trigger in events.lua and define him in one of the export_*.lua it will be called?
    How can i control when its called? I assume there are triggers for battles and other ones for the campain map.....

  4. #4
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Question regarding LUA

    Quote Originally Posted by Steinig View Post
    And the "dictonary" are the events.lua ?

    So if i add my own trigger in events.lua and define him in one of the export_*.lua it will be called?
    How can i control when its called? I assume there are triggers for battles and other ones for the campain map.....
    All events are listed in events.lua in the root directory of patch.pack

    No thing is everything. Every thing is nothing.

  5. #5
    l33tl4m3r's Avatar A Frakkin' Toaster
    Join Date
    Mar 2009
    Location
    Soldier of Fortune
    Posts
    6,330

    Default Re: Question regarding LUA

    *listens intently regarding effects creation*
    [House of Caesars|Under the Patronage of Carl von Döbeln]

  6. #6

    Default Re: Question regarding LUA

    Jep i get that, but i didnot manage to add my own events.

    It logs only if i use existing ones.

  7. #7
    l33tl4m3r's Avatar A Frakkin' Toaster
    Join Date
    Mar 2009
    Location
    Soldier of Fortune
    Posts
    6,330

    Default Re: Question regarding LUA

    And what I am most curious about;

    Can we create effects, then, can I attach that effect to a building?

    Also;

    What variables can I adjust using said events?

    --

    I had a thread about WHY I wanted to know how to do this;

    http://www.twcenter.net/forums/showthread.php?t=239916
    Last edited by l33tl4m3r; March 26, 2009 at 04:48 PM.
    [House of Caesars|Under the Patronage of Carl von Döbeln]

  8. #8
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Question regarding LUA

    Quote Originally Posted by Steinig View Post
    Jep i get that, but i didnot manage to add my own events.

    It logs only if i use existing ones.
    I'm fairly sure events are hardcoded so you can't add any. I think they're in the C++ LuA-governing code

    Quote Originally Posted by l33tl4m3r View Post
    And what I am most curious about;

    Can we create effects, then, can I attach that effect to a building?

    Also;

    What variables can I adjust using said events?

    --

    I had a thread about WHY I wanted to know how to do this;

    http://www.twcenter.net/forums/showthread.php?t=239916
    I think that effects are also hardcoded. As is the game_interface.

    No thing is everything. Every thing is nothing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •