Results 1 to 7 of 7

Thread: Need help with script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Need help with script

    Hello all,
    I am trying to make my first complicated script for my Fourth Age submod for TATW, but it just doesn't work and after testing this 10 times with every time a small change i decided to ask it here.
    Ok, here is the script
    Code:
    ;####################################################################
    ;################Elves for RK#######################################
    ;##########################################################3####3
    monitor_event FactionTurnStart FactionIsLocal FactionType sicily
    	and I_SettlementOwner Ithilien = sicily
    	and I_SettlementOwner North-Ithilien = sicily
    	and I_SettlementOwner South-Ithilien = sicily
    	and DiplomaticStanceFromFaction mongols = Allied
    	add_events
    	event counter elves_accepted
    	event counter elves_declined
    	end_add_events
    	historic_event elves true
    terminate_monitor
    end_monitor
    
    ;-------------- accept --------------
    declare_counter elves_accepted
    
    monitor_conditions I_EventCounter elves_accepted = 1
    	declare_counter go_elves
    	add_events
    	event historic elves_ithilien
    	date 0
    	end_add_events
    	console_command create_building Ithilien elven_house
    	console_command create_building North-Ithilien elven_house
    	console_command create_building South-Ithilien elven_house
    	add_money sicily -5000
    	set_counter go_elves 1	
    terminate_monitor
    end_monitor
    
    ;--------- reject ----------------
    declare_counter elves_declined
    
    monitor_conditions I_EventCounter elves_declined = 1
    	add_events
    	event historic elves_rejected
    	date 0
    	end_add_events
    	set_faction_standing sicily mongols -0,5
    	declare_counter go_elves
    	set_counter go_elves 0
    terminate_monitor
    end_monitor
    This part works but the next part doesnt
    ;###################################################################################3
    ; This script is to disable the recruitement when you are at war with the silvan elves
    monitor_event FactionTurnStart FactionIsLocal FactionType sicily
    	and DiplomaticStanceFactions sicily mongols > AtWar
    	and I_EventCounter go_elves = 1; it wont trigger when you have declined the event
    	and not I_EventCounter elves_war 1; this one and the other elves war will convince firing this event every turn
    	add_events
    	event historic no_elves
    	date 0
    	end_add_events
    	declare_counter no_elves
    	declare_counter elves_war
    	set_counter no_elves 1
    	set_counter elves_war 1
    end_monitor
    ;#################################################################################
    ;This script will enable the recruitement when you are allies again
    monitor_event FactionTurnStart FactionIsLocal FactionType sicily
    	and DiplomaticStanceFactions sicily mongols > Allied
    	and I_EventCounter go_elves = 1; it will only trigger if you have accepted the event
    	add_events
    	event historic elves_again
    	date 0
    	end_add_events
    	set_counter no_elves 0
    	set_counter elves_war 0
    end_monitor
    There will probably be some stupid mistakes an experienced scripter would never make, but I only used the Docudemons and I looked at some other scripts (maybe I should have done some tutorials but i thought it would go fine without, sadly it doesn't )
    Help is very much appreciated!

  2. #2
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: Need help with script

    Code:
     
    ;###################################################################################3
    ; This script is to disable the recruitement when you are at war with the silvan elves
    monitor_event FactionTurnStart FactionType sicily
    and FactionIsLocal 
    and DiplomaticStanceFactions sicily mongols = AtWar
    and I_EventCounter go_elves = 1; it wont trigger when you have declined the event
    and not I_EventCounter elves_war 1; this one and the other elves war will convince firing this event every turn
    add_events
    event historic no_elves
    date 0
    end_add_events
    declare_counter no_elves
    declare_counter elves_war
    set_counter no_elves 1
    set_counter elves_war 1
    end_monitor
    ;#################################################################################
    ;This script will enable the recruitement when you are allies again
    monitor_event FactionTurnStart FactionType sicily
    and FactionIsLocal 
    and DiplomaticStanceFactions sicily mongols = Allied
    and I_EventCounter go_elves = 1; it will only trigger if you have accepted the event
    add_events
    event historic elves_again
    date 0
    end_add_events
    set_counter no_elves 0
    set_counter elves_war 0
    end_monitor
    try this. Basically I changed
    1 - EDITED
    2 I don't know if DiplomaticStanceFactions works with "< or >" so you can play with "=" and the "not"
    3 - EDITED
    cheers
    Last edited by Kiliç Alì; October 16, 2011 at 02:14 PM.

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  3. #3
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Need help with script

    Thanks for your quick answer, i havent got time to test it now but as soon as i can test it i will tell you if it works

  4. #4
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Need help with script

    DiplomaticStanceFactions can take logical operators (<, >, =, etc.) but the first faction is the one that this event is firing on; don't use it as a parameter.

    Code:
    and DiplomaticStanceFactions mongols = AtWar
    not
    Code:
    and DiplomaticStanceFactions sicily mongols = AtWar
    sicily is implied because it is sicily's FactionTurnStart event.

    EDIT: no, sorry, that is incorrect. It doesn't take ANY factions as parameters. Use DiplomaticStanceFromFaction instead...

    Code:
    and DiplomaticStanceFromFaction mongols = AtWar
    Last edited by Withwnar; October 17, 2011 at 04:56 AM.

  5. #5
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Need help with script

    It doesn't work

    EDIT: My log doesn't say anything about the script, so I think there is nothing wrong with it?
    Maybe it just doesn't do what i want it to do?

    EDIT2: I'll do one more test, wait a minute

    EDIT3: I wanted to test the "set_counter no_elves 1", because maybe the problem was with the event, but they both don't work

    EDIT4: Maybe it would be useful if I explain the event to you guys.
    The first part is a yes/no event for building the elven houses.
    That works, the next part is for disabling the recruitement (when you are at war with the mongols) with this line: "set_counter no_elves 1", which I use in EDB as "and not event_counter no_elves 1" The last part is for enabling the recruitement again, when you are allies again ("set_counter no_elves 0")
    Thats how its supposed to work, I hope this will help you

  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Need help with script

    Looks like you're mixing counters and event counters.

    Try set_event_counter instead of set_counter.

    And "set_event_counter xxx 0" instead of "declare_counter xxx".

    I suggest finding a tutorial on counters. Historic events too.
    Last edited by Withwnar; October 17, 2011 at 10:31 AM.

  7. #7
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Need help with script

    Thanks all for your help! +rep @Withwnar I will certainly do that
    YAHHHH IT WORKS MANY THANKS WITHNWAR!!!!

Posting Permissions

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