# +---------------------------------- # | Territory scripts # +---------------------------------- # War Master NPC Territoy_World_Script: type: world events: # +---------------------------------- # | On Server start # +---------------------------------- on server start: - run Load_Territories instantly - run Save_Territories delay:5m Load_Territories: type: task Script: - if { - yaml "load:/Data/Territories.yml" id:Territories - narrate "Loading Territories..." } else { - yaml create id:Territories - narrate "Couldn't find Territories.yml file." - narrate "Creating new Territories.yml file" - yaml id:Territories set Territories.Test.Nation:Unclaimed - yaml id:Territories set Territories.Test.Cost:10000 - yaml id:Territories set Territories.Test.Bordering_Regions:->:Testland - yaml id:Territories set Territories.Test.Bordering_Regions:->:Testling - yaml "savefile:/Data/Territories.yml" id:Territories } Save_Territories: type: task Script: - yaml "savefile:/Data/Territories.yml" id:Territories - run Save_Territories delay:10m War_Master_Assignment: type: assignment interact scripts: - 10 War_Master_Nation1 actions: on assignment: # These triggers enable interaction with an NPC via chatting, clicking and entering proximity - trigger name:chat state:true - trigger name:click state:true - trigger name:proximity state:true - lookclose state:true War_Master_Nation1: type: interact steps: 1: Click Trigger: Script: - if { - narrate "[War Master] -> You<&co> What can I do for you?" - zap step:2 } else { - narrate "[War Master] -> You<&co> Move a long peasent. I only server our leader." } 2: Click Trigger: Script: - narrate "[War Master] -> You<&co> What can I do for you?" chat Trigger: 1: Trigger: "/regex:(?i).*claim.*|.*invade.*|.*conquer.*/" Script: - if { - narrate "[War Master] -> You<&co> What region would you like to lay claim to?" } else if { - narrate "[War Master] -> You<&co> What region would you like to invade?" } else if { - narrate "[War Master] -> You<&co> What region would you like to conquer?" } - zap step:Invade proximity Trigger: exit: Script: - narrate "RESET Warmater" - zap step:1 Invade: Click Trigger: Script: - narrate "[War Master] -> You<&co> What region would you like to invade?" chat Trigger: 1: Trigger: "/regex:.+/" Script: - if ]> { - define region - narrate "" # Check If the region is unclaimed - if == "" { # Check that the leader owns a bordering region. - foreach { - narrate "bordering region<&co> %value%" - if == { - narrate " SUCCESS You own a bordering region." } else { - narrate "[War Master] -> You<&co> To invade %region%, you must first conquer a bordering territory." - zap step:1 - determine cancelled } # Check if the leader can afford it. - if < .cost]> { - narrate "[War Master] -> You<&co> We don't have enough ducats to to make claim to this land sir." - wait 1 - narrate "[War Master] -> You<&co> Claiming will cost us at least .cost]> ducats." - zap step:1 } else { - narrate "[War Master] -> You<&co> Claiming is going to cost at least .cost]>. Are you sure you want to claim this territory?" - zap step:Invasion_Confirmation } # Else if it's already owned } else { # Check if the leader can afford it. - if < .cost]> { - narrate "[War Master] -> You<&co> We don't have enough ducats to to make such an invasion sir." - wait 1 - narrate "[War Master] -> You<&co> Invading will cost us at least .cost]> ducats." - zap step:1 } else { - narrate "[War Master] -> You<&co> Invading is going to cost at least .cost]>. Are you sure you want to do this?" - zap step:Invasion_Confirmation } } } else { - narrate "[War Master] -> You<&co> I've never heard of ." - wait 1 - narrate "[War Master] -> You<&co> Look at the map and tell me what region you would like to conquer." } } proximity Trigger: exit: Script: - narrate "RESET Warmater" - zap step:1 Invasion_Confirmation: chat Trigger: 1: Trigger: "/regex:(?i).*Yes.*|.*Yeah.*|.*sure.*/" Script: - if ]> { - narrate "[War Master] -> You<&co> Are you sure you want to invade ?" - zap step:Invastion_Confirmation } else { - narrate "[War Master] -> You<&co> Very well. Come see me again if you ever need help with war." } proximity Trigger: exit: Script: - zap step:1