Custom Combat Script: Difference between revisions
imported>StDoodle mNo edit summary |
imported>Bale |
||
Line 67: | Line 67: | ||
All possible actions you can take in a round of combat are listed under [[In-combat_Consulting]] | All possible actions you can take in a round of combat are listed under [[In-combat_Consulting]] | ||
== Resolution of a Combat Consultation Script == | |||
The consult script can automate as many, or as few rounds of combat as desired to achieve its goal. | |||
It is preferable that the script be able to recognize when a monster is dead in case the combat ends before achieving that goal. For instance, when executing a Rave Combo, the damage may kill the monster before the combo is complete. The script should recognize the monsters death by the text "You win the fight" and immediately end. | |||
If a consult script does not wish to finish killing a monster, then it may end at any time. If it does this, then the CCS will continue combat from the current round. Note that the current round is not always the next line in a script. For instance, if the consult script is called at round 1 and executes three actions, then it will return to the CCS at round 4. This is why most CCSs containing consult script prefer to have only a line after the consult script, usually a simple method of killing a monster. |
Revision as of 00:10, 5 March 2010
Basic CCS
A Custom Combat Script (CCS) is a way of instructing mafia how to handle combat, round by round. For example, a simple CCS would be to tell mafia to pickpocket on round 1, then cast entangling noodles on round 2 and finally on rounds 3+ to use shieldbutt. If it is unable to carry out one of those steps, then that step will be skipped. For instance, if the character failed to get initiative, then pickpocket will be skipped and the character will go straight to entangling noodles. That CCS would look like this:
[ default ]
1: try to steal an item
2: skill entangling noodles
3: skill shieldbutt
If you wanted to treat different monsters differently, that can be accomodated also. For instance, the following CCS will attempt to cast Transcendent Olfaction upon Black Knights while treating all other monsters differently. If the character currently has "On the Trail" then that line will be skipped.
[ default ]
1: try to steal an item
2: skill entangling noodles
3: skill shieldbutt
[ Black Knight ]
1: try to steal an item
2: skill transcendent olfaction
3: skill entangling noodles
4: skill shieldbutt
Consult Scripts
While this may seem reasonably flexible, sometimes you will want to do something too complicated to express in this format. For instance if you want your character to cast a Rave Combo if the character is a Disco Bandit, you'd have to change your CCS every ascension, but a consult script can automatically figure it out.
Example of a Consult Script
This example will attempt to pickpocket if possible. If not successful, then if the character is a Disco Bandit and he has learned the relevant Rave Combo, he will attempt to steal an item with the correct Rave combo.
// Save this as RaveSteal.ash
void main(int initround, monster foe, string url) {
boolean stolen = false;
while(contains_text(url, "form name=steal")) {
url = steal();
if((contains_text(url, "grab something") || contains_text(url, "You manage to wrest")))
return; // Something has been stolen. Job done!
}
if(my_class() != $class[Disco Bandit]) return;
matcher combo = create_matcher("(.+),(.+),(.+)", get_property("raveCombo5"));
if(combo.find())
for i from 1 to 3 {
if(contains_text(url, "You win the fight")) return;
url = use_skill(combo.group(i).to_skill());
}
}
This consult script can then be integrated into a CCS like this:
[ default ]
1: consult RaveSteal.ash
2: attack
Parts of a Combat Consultation Script
As you can see in the above example, a consultation script is called with three parameters.
- The first parameter is the round of combat that the script is called. Sometimes it is important to keep track of the round. This is particularly important to keep from losing the fight by going over 30 rounds.
- The second parameter is the monster that you are fighting. This is important because it enables you to take different actions for different monsters.
- The third parameter is the text of the page. This is important because it enables you to examine every detail of the fight as it is taking place. It can be analyzed for potential actions, damage that you deal to a monster and all other events.
All possible actions you can take in a round of combat are listed under In-combat_Consulting
Resolution of a Combat Consultation Script
The consult script can automate as many, or as few rounds of combat as desired to achieve its goal.
It is preferable that the script be able to recognize when a monster is dead in case the combat ends before achieving that goal. For instance, when executing a Rave Combo, the damage may kill the monster before the combo is complete. The script should recognize the monsters death by the text "You win the fight" and immediately end.
If a consult script does not wish to finish killing a monster, then it may end at any time. If it does this, then the CCS will continue combat from the current round. Note that the current round is not always the next line in a script. For instance, if the consult script is called at round 1 and executes three actions, then it will return to the CCS at round 4. This is why most CCSs containing consult script prefer to have only a line after the consult script, usually a simple method of killing a monster.