|
ekhart |
Posted: Fri Sep 24, 2010 1:35 pm
Trigger to create Triggers? |
|
ekhart Novice
Joined: 28 Aug 2008 Posts: 31
|
Posted: Fri Sep 24, 2010 9:53 pm |
aha that worked, not sure why it wouldnt work the other way lol... Thanks! Now to test it
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 24, 2010 10:01 pm |
Zugg wrote: |
You don't even need to use an external XML file...this is *really* easy:
1) Copy the stuff in the white code box above into the clipboard. That is: select everything in the white area starting with <class... and ending in </class> Select it in your web browser, then right-click and select Copy
2) Run CMUD and select your session icon and click the "Open Offline" action to open your session.
3) Click the "Settings" button in the main toolbar to open the settings editor.
4) Right-click in the tree view area on the left side of the screen. Select the Paste option in the menu.
This is the standard way to copy XML settings from the forum into your copy of CMUD. No need to save or anything like that. This will create a class folder called "Party Attack" with two triggers and a variable within it. |
Yup, this is how I'd recommend too, but, I figured I'd suggest the alternative if it wasn't working for him. Thanks, Zugg. |
|
|
|
ekhart Novice
Joined: 28 Aug 2008 Posts: 31
|
Posted: Fri Sep 24, 2010 10:02 pm |
So when fighting rooms of 2, it is only setting the variable to 1.
Exact copy -
You lead your party into battle against an Umbris Shadow and a Bones. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 24, 2010 10:04 pm |
Ah, that's because it's looking for a comma. Hmm, let me adjust it.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 24, 2010 10:06 pm |
Just add:
Code: |
$npc_list=%replace( $npc_list, "and ", "|")
|
Right below:
Code: |
$npc_list=%replace( $npc_list, ", and ", "|")
|
Placement of the line is important here. Or just take this XML:
Code: |
<class name="Party Attack" id="49">
<trigger priority="500" id="50">
<pattern>You lead your party into combat against (*)</pattern>
<value>$npc_list=%replace( %1, ". ", "")
$npc_list=%replace( $npc_list, ".", "")
$npc_list=%replace( $npc_list, ", and ", "|")
$npc_list=%replace( $npc_list, "and ", "|")
$npc_list=%replace( $npc_list, ", ", "|")
#FORALL $npc_list {
#SWITCH (%word( %i, 1)="a" || %word( %i, 1)="an") {#ADD curr_mobs 1}
(%word( %i, 1)="two") {#ADD curr_mobs 2}
(%word( %i, 1)="three") {#ADD curr_mobs 3}
(%word( %i, 1)="four") {#ADD curr_mobs 4}
(%word( %i, 1)="five") {#ADD curr_mobs 5}
(%word( %i, 1)="six") {#ADD curr_mobs 6}
}</value>
</trigger>
<var name="curr_mobs" id="51">0</var>
<trigger priority="520" id="52">
<pattern>dealt the death blow</pattern>
<value>#IF (@curr_mobs) {curr_mobs=(@curr_mobs - 1)}</value>
</trigger>
</class>
|
|
|
|
|
ekhart Novice
Joined: 28 Aug 2008 Posts: 31
|
Posted: Fri Sep 24, 2010 10:09 pm |
Working, awesome... so how many different types of npcs will this work with in a single room? like if there are say... 6 different types of npcs?
Seems to subtract 2 from the variable every time something dies... looking into it hehe |
|
|
|
ekhart Novice
Joined: 28 Aug 2008 Posts: 31
|
Posted: Fri Sep 24, 2010 10:21 pm |
OK fix'd the -2 problem... had the trig in there twice for some reason.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 24, 2010 10:33 pm |
If there's 6 different types it should still count them all. What this script does it takes everything following the initial phrase and consolidates it into a local stringlist. It then goes through the stringlist and looks for the first word in each, since that word seems to always be a number word. From there it adds each number to the total until it's run through all of them and begins to subtract as mobs die. You can use the #say or #show command to test various instances even if you can't get them to happen to you in the mud for whatever reason.
For instance, the following which I just made up:
You lead your party into combat against a baker, three goblin ninjas, four eskimos, a wild bear, two wild wolves, a zebra, an octopus, six bugbears, two jackals.
Will properly count 21 mobs.
If any mob names have an "and" or commas in them though it will get confused. |
|
|
|
ekhart Novice
Joined: 28 Aug 2008 Posts: 31
|
Posted: Fri Sep 24, 2010 10:36 pm |
Aaaa well I dont think that'll be a problem. Thank you so much for the help with this!
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Sep 24, 2010 10:45 pm |
No problem, hopefully it's doing everything you need it to do
|
|
|
|
|
|