Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicMobs MythicMobs
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 143
    • Issues 143
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicMobsMythicMobs
  • Wiki
    • Skills
    • Mechanics
  • setvariable

setvariable · Changes

Page history
updated layout and informations authored Oct 23, 2023 by Lxlp's avatar Lxlp
Hide whitespace changes
Inline Side-by-side
Showing with 58 additions and 51 deletions
+58 -51
  • skills/mechanics/setvariable.md skills/mechanics/setvariable.md +58 -51
  • No files found.
skills/mechanics/setvariable.md
View page @ d28d5082
Mechanic: SetVariable ## Description
=====================
Sets a [variable](/skills/variables). Variables can be permanent or Sets a [variable](/skills/variables). Variables can be permanent or
temporary, and can be used in conjunction with conditions or temporary, and can be used in conjunction with conditions or
placeholders to store data. placeholders to store data.
Attributes
----------
| Attribute | Aliases | Description | Default Value | ## Attributes
|-----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------| | Attribute | Aliases | Description | Default |
| variable | name, n, var, key, k | The name of the variable. Can optionally be prefixed with **scope.** | | |-----------|-----------|----------------------------------------------------------------------|---------|
| value | val | The value to set the variable to. Must be applicable for **type** or the mechanic will fail. Should be surrounded in double-quotes if using spaces. Value can also include placeholders, even from PlaceholderAPI. | | | variable | name, n, var, key, k | The name of the variable. Can optionally be prefixed with `scope` | |
| scope | s | The [scope](/skills/variables#variable_scopes) of the variable, e.g. where the variable will be located. | SKILL | | value | val | The value to set the variable to. Must be applicable for `type` or the mechanic will fail. Should be surrounded in double-quotes if using spaces. Value can also include placeholders, even from PlaceholderAPI | |
| type | t | The [type](/skills/variables#variable_types) of the variable. Set to STRING if you are using text instead of numbers. | INTEGER | | scope | s | The [scope](/skills/variables#variable_scopes) of the variable, e.g. where the variable will be located | SKILL |
| save | | Whether the variable should save between reloads, reboots and disconnects. Does not apply to SKILL-scoped variables. | false | | type | t | The [type](/skills/variables#variable_types) of the variable. Set to STRING if you are using text instead of numbers | INTEGER |
| duration | d | How long (in ticks) the variable should last. Does not apply to SKILL-scoped variables. | Infinite | | save | | Whether the variable should save between reloads, reboots and disconnects. Does not apply to SKILL-scoped variables | false |
| duration | d | How long (in ticks) the variable should last. Does not apply to SKILL-scoped variables | Infinite|
Examples
----
## Examples
In this example, the target players would only hear growling from any In this example, the target players would only hear growling from any
number of nearby bears once every 10 minutes. number of nearby bears once every 10 minutes.
```yaml
# Mob File
BearMob:
Skills:
- skill{s=BearGrowl} @PlayersInRadius{r=40} ~onTimer:60
```
```yaml
# Skill File
BearGrowl:
TargetConditions:
- variableEquals{var=target.heardbear;value="yes"} cancel
Skills:
- message{m="&7You hear a growling noise..."}
- setvariable{var=target.heardbear;value="yes";type=STRING;duration=6000}
```
BearMob: ##
Skills:
- skill{s=BearGrowl} @PlayersInRadius{r=40} ~onTimer:60
BearGrowl:
TargetConditions:
- variableEquals{var=target.heardbear;value="yes"} cancel
Skills:
- message{m="&7You hear a growling noise..."}
- setvariable{var=target.heardbear;value="yes";type=STRING;duration=6000}
In this example, the extra "IgnitionDamage" skill would only fire if the In this example, the extra "IgnitionDamage" skill would only fire if the
"do_ignite" variable were set on the skill tree. "do_ignite" variable were set on the skill tree.
```yaml
Strike:
Skills:
- setvariable{var=skill.do_ignite;type=STRING;value="yes"} 0.5
- damage{amount=20}
- skill{s=IgnitionDamage}
Strike: IgnitionDamage:
Skills: Conditions:
- setvariable{var=skill.do_ignite;type=STRING;value="yes"} 0.5 - varEquals{var=skill.do_ignite;value="yes"}
- damage{amount=20} Skills:
- skill{s=IgnitionDamage} - ignite{ticks=20}
- effects:particles{}
```
IgnitionDamage: ##
Conditions:
- varEquals{var=skill.do_ignite;value="yes"}
Skills:
- ignite{ticks=20}
- effects:particles{}
In this example is a placeholder from MMOItems being stored inside a int/float variable. In this example is a placeholder from MMOItems being stored inside a int/float variable.
```yaml
PlaceholderDamage:
Skills:
- setvariable{var=caster.new_skill_damage;value="%mmoitems_stat_skill_damage%";type=INTEGER} @self
- damage{a="100 * <caster.var.new_skill_damage>"} @PIR{r=5}
```
PlaceholderDamage: ##
Skills:
- setvariable{var=caster.new_skill_damage;value="%mmoitems_stat_skill_damage%";type=INTEGER} @self
- damage{a="100 * <caster.var.new_skill_damage>"} @PIR{r=5}
Also,other variables can be stored inside a int/float variable. Other variables can be stored inside a int/float variables.
```yaml
VariableSend: VariableSend:
Skills: Skills:
- setvariable{var=caster.VariableA;value="%mmoitems_stat_skill_damage%";type=INTEGER} @self - setvariable{var=caster.VariableA;value="%mmoitems_stat_skill_damage%";type=INTEGER} @self
- setvariable{var=caster.VariableB;value="<caster.var.VariableA> * 2";type=INTEGER} @self - setvariable{var=caster.VariableB;value="<caster.var.VariableA> * 2";type=INTEGER} @self
- setvariable{var=caster.VariableC;value="<caster.var.VariableA> + <caster.var.VariableB>";type=INTEGER} @self - setvariable{var=caster.VariableC;value="<caster.var.VariableA> + <caster.var.VariableB>";type=INTEGER} @self
```
Extra Information
----------------
- [x] Alias: setvar ## Aliases
\ No newline at end of file - [x] setvar
\ No newline at end of file
Clone repository
Home
Changelogs
Premium Features
Commands and Permissions
FAQ / Common Issues
Mythic Add-ons
Compatible Plugins
API Information
Packs
Mobs
  • Mob Options
    • Display Options
  • Mob Levels
  • Mob Factions
  • Power Scaling
  • Damage Modifiers
  • Equipment
  • BossBar
  • Custom AI
  • Custom Kill Messages
  • Threat Tables
  • Immunity Tables
  • Templates
  • Vanilla Overrides
  • Extra: Disguises
  • Extra: ModelEngine
Skills
  • Mechanics
  • Effects
  • Targeters
    • Filters
  • Triggers
  • Conditions
    • In-line conditions
  • Metaskills
  • Placeholders
  • Variables
  • Math
Items
  • Options
  • Attributes
  • Enchantments
  • Potions
  • Banner Layers
  • Firework
Drops & DropTables
  • Drop Types
Spawning
  • Spawners
  • Random Spawns
Stats
  • Custom Stat Options
  • Modifiers
  • Built in Stats
Examples
Useful Tips