-
Notifications
You must be signed in to change notification settings - Fork 0
3. Getting Started: Custom Spells & Spell Trees
Make sure you read the introduction to spells first.
Delayed spells can be attached to entities. They run the spell on a custom event for an entity after a customizable amount of time. This can be used in a lot of ways that will be explained here.
To infinitely repeat something you just attach the delayed spell to an entity and have it attach itself again when it fires.
Lets say the activation refire attaches a delayed spell that also fires the refire event when the delay has run out. If refire has been activated once then the delayed spell will be attached, run out and execute, attached again, run out and execute again, etc. infinitely. Add some effect triggered by the same activation and now this effect will be infinitely repeated.
So to start this infinite repetition, simply activate refire whenever the desired event is fired. To remove this infinitely repeating spell you have to give the delayed spell a UUID by which you can remove it without firing its activation.
Activate something once, requiring mana cost and an item cost (customizable amount). This spell adheres to the configuration file; players disabling item costs in there affects this spell.
{
"s1/title": ...,
"s2/icon": ...,
"s3/mana_cost": ...,
"s4/tooltip": ...,
"s5/spell_events": [
"active"
],
"s6/spell_parameters": [
{
"type": "spells_and_shields:string",
"value": ..., // <--- your item ID here, eg. '"minecraft:glowstone_dust"'
"var/name": "item"
},
{
"type": "spells_and_shields:string",
"value": ..., // <--- the amount of items required, eg. '1'
"var/name": "item_amount"
}
],
"s7/spell_actions": [
{
"type": "spells_and_shields:has_mana",
"activation": "active",
"amount": "<<mana_cost>>",
"t/target": "owner"
},
{
"type": "spells_and_shields:boolean_activation",
"a/to_activate": "consume",
"activation": "active",
"d/boolean/activate_if_true": true,
"d/boolean/deactivate_if_false": false,
"d/boolean/input": "<< !item_costs() >>"
},
{
"type": "spells_and_shields:player_has_items",
"activation": "active",
"d/boolean/creative_bypass": true,
"d/boolean/must_be_in_hand": true,
"d/int/amount": "<<item_amount>>",
"d/string/item": "<<item>>",
"t/source": "owner"
},
{
"type": "spells_and_shields:activate",
"a/to_activate": "consume",
"activation": "active"
},
{
"type": "spells_and_shields:activate",
"a/to_activate": "shoot",
"activation": "consume"
},
{
"type": "spells_and_shields:burn_mana",
"activation": "consume",
"d/double/mana_amount": "<<mana_cost>>",
"ts/targets": "owner"
},
{
"type": "spells_and_shields:boolean_activation",
"a/to_activate": "consume",
"activation": "consume",
"d/boolean/activate_if_true": false,
"d/boolean/deactivate_if_false": true,
"d/boolean/input": "<< item_costs() >>"
},
{
"type": "spells_and_shields:consume_player_items",
"activation": "consume",
"d/boolean/must_be_in_hand": true,
"d/int/amount": "<<item_amount>>",
"d/string/item": "<<item>>",
"t/source": "owner"
},
... // <--- your actions here, the activation if the checks were successfull is "shoot"
]
}