diff --git a/docs/customization/war-of-emperium.md b/docs/customization/war-of-emperium.md index dfd3014..c391d24 100644 --- a/docs/customization/war-of-emperium.md +++ b/docs/customization/war-of-emperium.md @@ -5,129 +5,133 @@ are not accessible to people who are not in the residing guild. ## agit_controller.txt Open -\[\`npc/guild/agit_controller.txt\`\](https://github.com/HerculesWS/Hercules/blob/stable/npc/guild/agit_controller.txt) +[`npc/guild/agit_controller.txt`](https://github.com/HerculesWS/Hercules/blob/stable/npc/guild/agit_controller.txt) The body of the script should look similar to the following: -`- script Agit_Event -1,{` -` end;` - -[`OnClock`](OnClock "wikilink")`2100: //start time for Tues(2), Thurs(4)` -[`OnClock`](OnClock "wikilink")`2300: //end time for Tues(2), Thurs(4)` -[`OnClock`](OnClock "wikilink")`1600: //start time for Sat(6)` -[`OnClock`](OnClock "wikilink")`1800: //end time for Sat(6)` - -`OnAgitInit:` -` // starting time checks` -` `[`if`](if "wikilink")`((`[`gettime`](gettime "wikilink")`(4)==2) && (`[`gettime`](gettime "wikilink")`(3)>=21 && `[`gettime`](gettime "wikilink")`(3)<23) ||` -`    (`[`gettime`](gettime "wikilink")`(4)==4) && (`[`gettime`](gettime "wikilink")`(3)>=21 && `[`gettime`](gettime "wikilink")`(3)<23) ||` -`    (`[`gettime`](gettime "wikilink")`(4)==6) && (`[`gettime`](gettime "wikilink")`(3)>=16 && `[`gettime`](gettime "wikilink")`(3)<18)) {` -`  `[`if`](if "wikilink")` (!`[`agitcheck`](agitcheck "wikilink")`()) {` -`   `[`agitstart`](agitstart "wikilink")`;` -`   `[`callsub`](callsub "wikilink")` S_DisplayOwners;` -`  }` -`  `[`end`](end "wikilink")`;` -` }` - -` // end time checks` -` `[`if`](if "wikilink")` ((`[`gettime`](gettime "wikilink")`(4)==2) && (`[`gettime`](gettime "wikilink")`(3)==23) ||` -`     (`[`gettime`](gettime "wikilink")`(4)==4) && (`[`gettime`](gettime "wikilink")`(3)==23) ||` -`     (`[`gettime`](gettime "wikilink")`(4)==6) && (`[`gettime`](gettime "wikilink")`(3)==18)) { ` -`  `[`if`](if "wikilink")` (`[`agitcheck`](agitcheck "wikilink")`()) {` -`   `[`agitend`](agitend "wikilink")`;` -`   `[`callsub`](callsub "wikilink")` S_DisplayOwners;` -`  }` -`  `[`end`](end "wikilink")`;` -` }` -` `[`end`](end "wikilink")`;` - -`S_DisplayOwners:` -` `[`setarray`](setarray "wikilink")` .@maps$[0],"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05";` -` `[`setarray`](setarray "wikilink")` .@maps$[5],"gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05";` -` `[`setarray`](setarray "wikilink")` .@maps$[10],"payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05";` -` `[`setarray`](setarray "wikilink")` .@maps$[15],"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05";` -` `[`for`](for "wikilink")`( `[`set`](set "wikilink")` .@i, 0; .@i <= 19; `[`set`](set "wikilink")` .@i, .@i+1 ) {` -`  `[`if`](if "wikilink")` (`[`GetCastleData`](GetCastleData "wikilink")`(.@maps$[.@i],1)) {` -`   `[`Announce`](Announce "wikilink")` "The [" + `[`GetCastleName`](GetCastleName "wikilink")`(.@maps$[.@i]) + "] castle has been conquered by the [" + `[`GetGuildName`](GetGuildName "wikilink")`(`[`GetCastleData`](GetCastleData "wikilink")`(.@maps$[.@i],1)) + "] guild.",bc_all|bc_woe;` -`  }` -`  `[`else`](else "wikilink")` {` -`   `[`Announce`](Announce "wikilink")` "The [" + `[`GetCastleName`](GetCastleName "wikilink")`(.@maps$[.@i]) + "] castle is currently unoccupied.",bc_all|bc_woe;` -`  }` -` }` -` `[`end`](end "wikilink")`;` -`}` +```C +- script Agit_Event FAKE_NPC,{ + end; -### OnClock#### + OnClock2100: //start time for Tues(2), Thurs(4) + OnClock2300: //end time for Tues(2), Thurs(4) + OnClock1600: //start time for Sat(6) + OnClock1800: //end time for Sat(6) + OnAgitInit: + // starting time checks + if((gettime(GETTIME_WEEKDAY) == TUESDAY) && (gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23) + || (gettime(GETTIME_WEEKDAY) == THURSDAY) && (gettime(GETTIME_HOUR) >= 21 &&gettime(GETTIME_HOUR) < 23) + || (gettime(GETTIME_WEEKDAY) == SATURDAY) && (gettime(GETTIME_HOUR) >= 16 &&gettime(GETTIME_HOUR) < 18) + ) { + if(!agitcheck()) { + agitstart(); + callsub(S_DisplayOwners); + } + end; + } -You need one of these labels for each time you want WoE to start or stop, so if you want the WoE to start at 9am and end -at 11am you would need this + // end time checks + if((gettime(GETTIME_WEEKDAY) == TUESDAY) && (gettime(GETTIME_HOUR) == 23) + || (gettime(GETTIME_WEEKDAY) == THURSDAY) && (gettime(GETTIME_HOUR) == 23) + || (gettime(GETTIME_WEEKDAY) == SATURDAY) && (gettime(GETTIME_HOUR) == 18) + ) { + if(agitcheck()) { + agitend(); + callsub(S_DisplayOwners); + } + end; + } + end; -`OnClock0900:` -`OnClock1100:` + S_DisplayOwners: + setarray(.@maps$[0], "aldeg_cas01", "aldeg_cas02", "aldeg_cas03", "aldeg_cas04", "aldeg_cas05"); + setarray(.@maps$[5], "gefg_cas01", "gefg_cas02", "gefg_cas03", "gefg_cas04", "gefg_cas05"); + setarray(.@maps$[10], "payg_cas01", "payg_cas02", "payg_cas03", "payg_cas04", "payg_cas05"); + setarray(.@maps$[15], "prtg_cas01", "prtg_cas02", "prtg_cas03", "prtg_cas04", "prtg_cas05"); + for(set.@i, 0; .@i <= 19;set.@i, .@i+1 ) { + if(GetCastleData(.@maps$[.@i],1)) { + announce(sprintf("The [%s] castle has been conquered by the [%s] guild.", GetCastleName(.@maps$[.@i]), GetGuildName(GetCastleData(.@maps$[.@i],1))), bc_all|bc_woe); + } else { + announce(sprintf("The [%s] castle is currently unoccupied.", GetCastleName(.@maps$[.@i])), bc_all|bc_woe); + } + } + end; +} +``` -===if((gettime(4)==2) && (gettime(3)\>=21 && gettime(3)\<23)) goto L_Start;=== +1. `OnClock####` -`gettime(4)==2` + You need one of these labels for each time you want WoE to start or stop, so if you want the WoE to start at 9am and end + at 11am you would need this -Will check what the day is, 0 = Sun 1 = Mon 2 = Tue etc etc... + `OnClock0900:` + `OnClock1100:` -This is currentally day 2, so this would result in a success if it was a Tuesday -`gettime(3)>=21` +2. `if (gettime(GETTIME_WEEKDAY) == TUESDAY) && (gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23)) goto L_Start;` -Will check the hour of the day, 00 = Midnight 01 = 1am etc... + `gettime(GETTIME_WEEKDAY) == TUESDAY` -This is currentally 9pm (21:00) the \>= mean if the current time is after 9pm return a success + Will check what the day is, 0 = Sun 1 = Mon 2 = Tue etc etc... -`gettime(3)<23` + This is currentally day 2, so this would result in a success if it was a Tuesday -Work the same as above, but will be the end of your WoE, the \< means if the current time is before 11pm (23:00) it will -return a success, if at any point the current time is equal to or more that 11pm it will return a fail + `gettime(GETTIME_HOUR) >= 21` -`if((gettime(4)==2) && (gettime(3)>=21 && gettime(3)<23)) goto L_Start;` + Will check the hour of the day, 00 = Midnight 01 = 1am etc... -Only if everything inside the outer bracket is a success will it goto "L_Start" and start the WoE + This is currentally 9pm (21:00) the `>=` mean if the current time is after 9pm return a success -**Example 1**: It is tuesday, it is 10pm, you have just had to restart the server cause it has crash or whatever, it -runs past that line of code + `gettime(GETTIME_HOUR) < 23` -`if((gettime(4)==2[Hm yes it is `*`{1}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[oh and it is before 23 `*`{1}`*`])) goto L_Start; [I didnt detect any `*`{0}`*` I better goto L_Start]` + Work the same as above, but will be the end of your WoE, the `<` means if the current time is before 11pm (23:00) it will + return a success, if at any point the current time is equal to or more that 11pm it will return a fail -**Example 2**: It is Tuesday, it is 11:30pm + `if (gettime(GETTIME_WEEKDAY) == TUESDAY) && (gettime(GETTIME_HOUR) >= 21 && gettime(GETTIME_HOUR) < 23)) goto L_Start;` -`if((gettime(4)==2[Hm yes it is `*`{1}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[wait no it is after 23 `*`{0}`*`])) goto L_Start; [I detected one or more `*`{0}`*` I better no run this action and let the script carry on]` + Only if everything inside the outer bracket is a success will it goto "L_Start" and start the WoE -**Example 3**: It is Wednesday, it is 10pm + **Example 1**: It is tuesday, it is 10pm, you have just had to restart the server cause it has crash or whatever, it + runs past that line of code -`if((gettime(4)==2[Wait it is not day 2 `*`{0}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[oh and it is before 23 `*`{1}`*`])) goto L_Start; [I detected one or more `*`{0}`*` I better no run this action and let the script carry on]` + `if((gettime(4)==2[Hm yes it is `*`{1}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[oh and it is before 23 `*`{1}`*`])) goto L_Start; [I didnt detect any `*`{0}`*` I better goto L_Start]` -===if((gettime(4)==2) && (gettime(3)==23)) goto L_End;=== + **Example 2**: It is Tuesday, it is 11:30pm -`gettime(4)==2` + `if((gettime(4)==2[Hm yes it is `*`{1}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[wait no it is after 23 `*`{0}`*`])) goto L_Start; [I detected one or more `*`{0}`*` I better no run this action and let the script carry on]` -Same as above, used for checking the day, you will need one of these for everyday you make, that is unless you decide to -have one everyday at the same time then I wont mind, you will need just one, and it wont need to check the day + **Example 3**: It is Wednesday, it is 10pm -`gettime(3)==23` + `if((gettime(4)==2[Wait it is not day 2 `*`{0}`*`]) && (gettime(3)>=21[Yes it is after 21 `*`{1}`*`] && gettime(3)<23[oh and it is before 23 `*`{1}`*`])) goto L_Start; [I detected one or more `*`{0}`*` I better no run this action and let the script carry on]` -This would be the hour you want the WoE to end at, again 1 is needed for every WoE day/time you set -**Example 1**: This query is reached after passing through the first "Example 2" +3. `if((gettime(4)==2) && (gettime(3)==23)) goto L_End;` -It is the same, Tuesday and 11:30pm + `gettime(4)==2` -\[Seems the arguments above me havent picked this query up yet\] + Same as above, used for checking the day, you will need one of these for everyday you make, that is unless you decide to + have one everyday at the same time then I wont mind, you will need just one, and it wont need to check the day -`if((gettime(4)==2[Why yes, it is day 2 `*`{1}`*`]) && (gettime(3)==23[and it is hour 23 `*`{1}`*`])) goto L_End;[I didnt see any `*`{0}`*` better run this` + `gettime(3)==23` -This will then end your WoE + This would be the hour you want the WoE to end at, again 1 is needed for every WoE day/time you set -**Example 2**: This query is reached after passing through the first "Example 3" + **Example 1**: This query is reached after passing through the first "Example 2" -It is Wednesday, it is 10pm + It is the same, Tuesday and 11:30pm -\[Seems the arguments above me havent picked this query up yet\] + \[Seems the arguments above me havent picked this query up yet\] -`if((gettime(4)==2[Why no, it isnt day 2 `*`{0}`*`]) && (gettime(3)==23[and it is not hour 23 `*`{0}`*`])) goto L_End;[I see one or more `*`{0}`*` better not run this or stupid people will post bugs]` + `if((gettime(4)==2[Why yes, it is day 2 `*`{1}`*`]) && (gettime(3)==23[and it is hour 23 `*`{1}`*`])) goto L_End;[I didnt see any `*`{0}`*` better run this` + + This will then end your WoE + + **Example 2**: This query is reached after passing through the first "Example 3" + + It is Wednesday, it is 10pm + + \[Seems the arguments above me havent picked this query up yet\] + + `if((gettime(4)==2[Why no, it isnt day 2 `*`{0}`*`]) && (gettime(3)==23[and it is not hour 23 `*`{0}`*`])) goto L_End;[I see one or more `*`{0}`*` better not run this or stupid people will post bugs]` ## Setting WoE Times @@ -142,21 +146,21 @@ If you still don't understand this, try the WoE Setter NPC I made to guide you t your scripts_custom.conf and talk to the NPC in game with a GM level 99. WoE Controller script - -\[\`npc/custom/woe_controller.txt\`\](https://github.com/HerculesWS/Hercules/blob/stable/npc/custom/woe_controller.txt) +[`npc/custom/woe_controller.txt`](https://github.com/HerculesWS/Hercules/blob/stable/npc/custom/woe_controller.txt) Original guide can be found at -\[\`doc/woe_time_explanation.txt\`\](https://github.com/HerculesWS/Hercules/blob/stable/doc/woe_time_explanation.txt) +[`doc/woe_time_explanation.txt`](https://github.com/HerculesWS/Hercules/blob/stable/doc/woe_time_explanation.txt) ## Turn OFF WoE in Some Castles WoE is a server-wide setting, so it's either ON everywhere, or OFF everywhere. To get around this and "turn off" woe in certain castles, this is what you can do: -1. Edit \[\`npc/scripts_guild.conf\`\](https://github.com/HerculesWS/Hercules/blob/stable/npc/scripts_guild.conf) and +1. Edit [`npc/scripts_guild.conf`](https://github.com/HerculesWS/Hercules/blob/stable/npc/scripts_guild.conf) and comment out the castles you are NOT using for WoE (put // in front of the line). This turns of all woe functions for that castle. 2. Optional: to remove the warp portal entrance, edit - \[\`npc/warps/guildcastles.txt\`\](https://github.com/HerculesWS/Hercules/blob/stable/npc/warps/guildcastles.txt) + [`npc/warps/guildcastles.txt`](https://github.com/HerculesWS/Hercules/blob/stable/npc/warps/guildcastles.txt) and comment-out the warps into the castles you are not using. ## Separate WoE Times in Separate Towns/Castles @@ -164,7 +168,7 @@ To get around this and "turn off" woe in certain castles, this is what you can d WoE is a server-wide setting, so it's either ON everywhere, or OFF everywhere. (you can't have it on in one castle only). To get around this, you need to code 3 separate events in the -\[\`npc/guild/agit_controller.txt\`\](https://github.com/HerculesWS/Hercules/blob/stable/npc/guild/agit_controller.txt) +[`npc/guild/agit_controller.txt`](https://github.com/HerculesWS/Hercules/blob/stable/npc/guild/agit_controller.txt) ### StartWOE1: