Skip to content

Instantly share code, notes, and snippets.

let tokens = await Tagger.getByTag("light");
if (tokens.length === 0) return;
let sceneId = canvas.scene._id;
let duration = 2000;
let intervall = 1000;
let moveToken = async function (token) {
if (!token) return;
await token.update({
@diwako
diwako / initPlayerLocal.sqf
Last active January 29, 2023 22:53
Issue reproduction from ACE, APS, and basically any other mod and mission script.
private _action = "DefaultAction";
private _name = format ["ACE_Action_%1", _action];
private _actionsVar = player getVariable [_name, [-1, [-1, [], []], objNull]];
if (player != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
_actionsVar = [-1, [-1, [], []], objNull];
};
_actionsVar params ["_actionID", "_actionsArray"];
_actionsArray params ["_id", "_actionIDs", "_actions"];
@diwako
diwako / cyberpunk-red-core-does-it-hit-world-script.js
Last active February 25, 2023 20:03
Foundry VTT world script for the cyberpunk red core system to display if a ranged attack has hit or not
/*
==Info about this script==
This script will hook into chat messages and look up attack rolls for ranged attacks,
check the distance between attacker and defender token, check the DV of used weapon and
determine if the attack hits or not. The result is displayed in chat.
Make sure to TARGET the token you want to attack ;)
It also plays hit animations and miss animations depending on the roll
Item Piles support was added to disallow dropping or selling of upgraded items, as those
@diwako
diwako / init.sqf
Created January 11, 2021 13:07
ace medical rewrite, make epi do way more
["ace_medical_treatment_medicationLocal", {
params ["_unit", "", "_classname"];
if (_classname == "Epinephrine") then {
// this guy dead or bleeding
if (!alive _unit || {
(_unit getVariable ["ace_medical_woundBleeding", 0]) > 0
}) exitWith {};
private _heartRate = _unit getVariable ["ace_medical_heartRate", 80];
private _blood = _unit getVariable ["ace_medical_bloodVolume", 6.0];
// put this into your init.sqf like the filthy animal you are
["ace_medical_woundReceived", {
[{
params ["_unit", "_woundedHitPoint", "_receivedDamage", "", "_ammo"];
if (isPlayer _unit) exitWith {};
[_unit, _woundedHitPoint, _receivedDamage, _ammo call ace_medical_damage_fnc_getTypeOfDamage] call diw_medical_woundsHandlerAI;
},_this] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addEventHandler;
diw_medical_woundsHandlerAI = {
Hey these are outdated, my dude, chek them here instead
https://github.com/fparma/fparma-mods/blob/master/extra/cba_settings_userconfig/cba_settings.sqf
// find out which dlcs a player owns
private _noDLC = getDLCs 2;
private _ownsApex = !(395180 in _noDLC);
private _ownsMarksmen = !(332350 in _noDLC);
private _ownsLow = !(571710 in _noDLC);
private _ownsHeli = !(304380 in _noDLC);
private _ownsTanks = !(798390 in _noDLC);
private _ownsJets = !(601670 in _noDLC);
private _ownsTacOps = !(744950 in _noDLC);
private _ownsCarts = !(288520 in _noDLC);
@diwako
diwako / groupTracker.sqf
Created August 22, 2019 06:48
BFT group tracking
// GROUP MARKERS ALTERNATE /////////////////////////////////////////////////////////////////////////
/*
- Creates group markers following around the player groups. When clicked while map is open,
it will list current members of the group.
*/
// INIT ///////////////////////////////////////////////////////////////////////////////////////////
//GENERAL GROUP ICON SETTINGS
if !(hasInterface) exitWith {};
setGroupIconsVisible [true,false];
CUL_snowEmitter = objNull;
CUL_doSnow = {
private _unit = ACE_player;
if (alive _unit && {!([_unit] call ace_common_fnc_isInBuilding)}) then {
if (isNull CUL_snowEmitter) then {
CUL_snowEmitter = "#particlesource" createVehicleLocal getpos _unit;
CUL_snowEmitter setParticleParams [
["\A3\data_f\ParticleEffects\Universal\Universal",16,12,13,1],
"",
"Billboard",