{ "name": "Roll Initiative", "type": "script", "scope": "global", "author": "KR32117fX0pxHkC5", "img": "icons/svg/dice-target.svg", "command": "let playerCombatants = [];\nlet combatants = game.combat.combatants\nfor (const combatant of combatants) {\n playerCombatants.push(combatant)\n}\n\nlet form = '
';\nfor (const combatant of playerCombatants) {\n form += ''\n form += '';\n}\nform += '
'\n\nasync function setInitiativesAndStartCombat(html) {\n\n for (const combatant of playerCombatants) {\n let initiative = html.find('input[name=\"' + combatant.id + '\"]')[0].value\n await game.combat.setInitiative(combatant.id, initiative).then(\n\n );\n }\n await game.combat.rollNPC();\n await game.combat.startCombat();\n}\n\n\nnew Dialog({\n title: 'Manual Initiative',\n content: form,\n buttons: {\n yes: {\n icon: \"\",\n label: \"Start Combat\",\n callback: (html) => setInitiativesAndStartCombat(html),\n }\n },\n default: 'yes'\n}).render(true);", "folder": null, "flags": { "exportSource": { "world": "the-well-wishers", "system": "dnd5e", "coreVersion": "11.315", "systemVersion": "3.1.1" } }, "_stats": { "systemId": "dnd5e", "systemVersion": "3.1.1", "coreVersion": "11.315", "createdTime": 1712067301107, "modifiedTime": 1712067772822, "lastModifiedBy": "KR32117fX0pxHkC5" } }