Deciphering the Mathematics MA

A forum for discussing map making ideas and problems for the Myth series.
Post Reply
User avatar
Pyro
Bug Finder Extraordinaire
Posts: 4751
Joined: Sun Mar 21, 2004 2:14 pm
Location: Texas

Deciphering the Mathematics MA

Post by Pyro »

I have been looking over the Math MA trying to figure it out. Here is the list of Math parameters:
Left Integer
Left Action Identifier
Left Field Name
Right Integer
Right Action Identifier
Right Field Name
Negate Left Operand
Not Left Operand
Negate Right Operand
Not Right Operand
Add
Subtract
Multiply
Divide
Remainder
Less Than
Less Than or Equal
Greater Than
Greater Than or Equal
Equal
Not Equal
And
Or
Exclusive Or
Negate Output
Not Output
Destination Action Identifier
Destination Field Name

I understood the basic explaination Myrd gave on it.

destination = operation(left, right)

Where operation would be things like Add, Subtract, Multiply, Divide, etc. With some operators that can work with others.

Left Integer being the value on the left. Instead of that you can use Left Action Identifier and Left Field Name to link to the action that contains the value with the field name matching the param ID belonging to an integer parameter. For example Left Integer is an integer parameter and its field name is "lint".

The same thing for the right value where you use Right Integer, or use Right Action Identifier with Right Field Name.

The destination being where the output will be placed. For this you use the Destination Action Identifier to choose the action it will be placed with Destination Field Name to give it the parameter ID the output will use.

I made a short test script and I got it to work!

MATH. Math Quiz
Left Integer "10"
Right Integer "2"
Add
Destination Action Identifier "<<< Answer >>>"
Destination Field Name "lint"
Activates on Execution "Is the answer 12?"

MATH. Is the answer 12?
Left Action Identifier "<<< Answer >>>"
Left Field Name "lint"
Right Integer "12"
Equal
Activates on Success "Inject Math into a Warrior"
Activates on Failure "Inject Math into a Bowman"

Where <<< Answer >>> is an empty action. Inject Math into a Warrior and Inject Math into a Bowman are Unit Control actions. The first kills a warrior and the second kills a bowman. I ran the map and it killed a warrior. I then went and modfied it so the initial values of 10 and 2 were now 9 and 1, so they could not equal 12 when added by the first math action. I ran the map and a bowman was killed instead. Ta-da!

Originally, I was confused by some of the descriptions. For example the description for Equal is "1 if left and right values are equal, zero otherwise." I thought to myself, okay great this does math but how do I actually test what the value can be if it will only spit out more values. But it is in fact a flag which can be true or false. So for the parameters that say that or similar, they mean (1 = true/success) and (0 = false/failure).

However, they are also just 1 and 0 as values themselves. I editted the 2nd Math MA to have Activates on Execution pointing to a new Unit Control action containing just a dwarf for the subj. I had also added the Destination Action Identifier and Destination Field Name parameters to the 2nd Math action. I made them point to that same Unit Control action with the dwarf with the field name being "kill". That field name is for the Unit Control parameter Kill Monsters where a value of 0 is a soft death and 1 is for a hard death. I ran the script again and it killed a warrior and the dwarf was killed using the hard death.
User avatar
Pyro
Bug Finder Extraordinaire
Posts: 4751
Joined: Sun Mar 21, 2004 2:14 pm
Location: Texas

Re: Deciphering the Mathematics MA

Post by Pyro »

The Math action is very useful for altering values during the game. There are many integer parameters. A lot don't seem worth changing with a Math action. Some can be quite useful like parameters belonging to GEOM, TUNI, and CTRL for the most part. You might still be wondering which parameters exactly could a Math action alter. Here is a complete list of all integer parameters Myth currently has at its disposal.
Action Sniffing
Test Case
Time Between Errors
Delay Before Announcing Errors

Attack
Attack Team
Attack Unit Type

Assassin (for Mahir)
Fear Duration
Initial Delay

CD Audio
Play Track

Endgame Condition
Winning Team

Fade Screen
Fade Duration
Fade Starting Point
Fade Color

General Action
Command Type

Geometry Filter
Maximum Number of Items
Minimum Number of Items
Monsters From This Team Index
Tests for Monsters on a Given Team Index
Ammunition Greater Than
Ammunition Less Than
Combined Power Greater Than
Combined Power Less Than
Charges Greater Than
Charges Less Than
Experience Greater Than
Experience Less Than

Netgame Goal
Team Index

Group Split Up
Thresholds

Harass (for ghols)
Initial Delay
Reevaluation Delay
Projectile Radius

Leading
Target Type
Delay Before Yelling
Maximum Times to Yell
Delay Before Beckoning
Maximum Times to Beckon

Legion (defensive)
Group Formation Array
Group Position Depndency Array
Group Count

Mathematics
Left Integer
Right Integer

Meander Action (wander aimlessly)
Threat Scan Width

Melee (for Thrall, Myrmidons, etc.)
Formation

Mesh Cell Modifier
Terrain Cost

Model Animation
Frame Greater Than
Frame Less Than
Frame Equal To

Model Effect
New Permutation
Permutation
Material Index

Move Marker
Team Index

Movement
Formation Index

Netgame Type
Type
Winning Team Index
Winning Team Minimum Score
Minimum Patch Version

Observer Movement
Camera Mode
Angular Interpolant Separation

Netgame Time
Time Remaining Less Than

Player Count
Team Count Equal To
Team Count Less Than
Team Count Greater Than
Player Count Equal To
Player Count Less Than
Player Count Greater Than

Prohibited Netgame Teams
Game Type + Team Indexes

Squad
Formation

Suicide (for wights)
Fear Duration
Enemy Detonation Threshhold
Initial Delay

Surround
Units Lost Before Attacking
Time Before Attacking

Test Unit
Unit Count Greater Than
Unit Count Less Than
Unit Count Equal To
Difficulty Greater Than or Equal To
Difficulty Less Than or Equal To
Difficulty Equal To
Ammunition Greater Than
Experience Greater Than
Charges Greater Than
Height Greater Than
Standing on This Terrain Type

Unit Control
Kill Monsters
New Monster Name
Add Experience
Levels Survived
Set Monster Height
Incremental Monster Height
Add Charges
Ammunition
Add Ammunition
Detach Units to Player
Overhead Text Index
Overhead Text Color
Overhead Text Duration
Post Reply