Sub tome: https://www.freeriderhd.com/u/thunderbear

FrHD Ultimate All-in-One Tools: FRHD Editor Scripts

Thursday, November 12, 1970

FRHD Editor Scripts

Script 1: FRHD Bike Hitbox Tracer
What is it: Helps you create a path in editor.
 
 
Create new script and put the blue script below:
(If extensions are blocked on your computer then open "inspect element" and there will be a "console" tab up there, paste the script in there.


If it says you must complete your track before publishing it, just export your track and then import it in a new tab after disabling the script.
 
// ==UserScript==
 
// @name         FRHD Bike Hitbox Tracer
 
// @version      0.1
 
// @description  Draws the bike's hitboxes at each tick in creator.
 
// @match        https://www.freeriderhd.com/**
 
// @grant        none
 
// ==/UserScript==
 
 
 
let lastHref;
 
let reloadInv = setInterval(() => {
 
    if (lastHref !== window.location.href && /^https?:\/\/(www\.)?freeriderhd\.com\/create/.test(window.location.href)) main();
 
    lastHref = window.location.href;
 
});
 
const main = i => i = setInterval(() => {
 
    if (!GameManager.game) return;
 
    clearInterval(i);
 
    let lastTicks = 0;
 
    createjs.Ticker.on('tick', () => {
 
        const { ticks, playerManager: { firstPlayer: { _baseVehicle, _baseVehicleType, _tempVehicle } } } = GameManager.game.currentScene;
 
        if (!_tempVehicle && (ticks > lastTicks || (!ticks && lastTicks))) {
 
            for (const hb of [_baseVehicle.head, _baseVehicle.frontWheel, _baseVehicle.rearWheel]) {
 
                const rad = Math.ceil(hb.radius / 2) + 1;
 
                let lastX = hb.pos.x - hb.radius / 2 + 4;
 
                let lastY = hb.pos.y - hb.radius / 2 - 4;
 
                for (let i = 0; i <= 360; i += 36) {
 
                    const x = lastX + rad * Math.cos(i * Math.PI / 180);
 
                    const y = lastY + rad * Math.sin(i * Math.PI / 180);
 
                    GameManager.game.currentScene.track.addSceneryLine(lastX, lastY, x, y);
 
                    lastX = x;
 
                    lastY = y;
 
                }
 
            }
 
        }
 
        lastTicks = ticks;
 
    });
 
});

 
//Done, copy till the line above!










Script 2 Below...















Script 2: Animator:
 
What is it: 
 
Create animations easily in editor mode. Upon installing the script you will see an "Add Frame" button in the area where it says "Publish" and such.


 
// ==UserScript==
 
// @name         FRHD Animator
 
// @namespace    http://tampermonkey.net/
 
// @version      0.1
 
// @description  Make FRHD animations easily
 
// @include      /^https?://(www.)?freeriderhd.com/create/
 
// @grant        none
 
// ==/UserScript==
 
 
 
(function main() {
 
   const lastHref = window.location.href;
 
   const reloadInv = setInterval(() => {
 
       if (lastHref !== window.location.href) {
 
           clearInterval(reloadInv);
 
           main();
 
       }
 
   }, 1000);
 
   if (!/^https?:\/\/(www\.)?freeriderhd\.com\/create/.test(window.location.href)) return;
 
 
 
   const topInv = setInterval(() => {
 
       const top = document.querySelector('.topMenu');
 
       if (!top) return;
 
       clearInterval(topInv);
 
       setInterval(() => {
 
           if (top.querySelector('#animate')) return;
 
           top.innerHTML += '<div class="topMenu-button topMenu-button_offline" title="New Frame" id="animate"><span class="editorgui_icons editorgui_icons-icon_offline_editor"></span><span class="text">Add Frame</span></div>';
 
           let x = 0;
 
           top.querySelector('#animate').onclick = () => {
 
               GameManager.game.currentScene.track.addPowerups([['W', ...[x, 30, x += 1000, 30].map(x => x.toString(32))].join(' ')]);
 
               for (const line of [...GameManager.game.currentScene.track.physicsLines]) {
 
                   if (!line.remove && line.p1.x < x && line.p1.x > (x - 1500)) GameManager.game.currentScene.track.addPhysicsLine(line.p1.x + 1000, line.p1.y, line.p2.x + 1000, line.p2.y);
 
               }
 
           };
 
       });
 
   });
 
})();
 
 
//Done, copy till the line above!