STAR TREK 2d20
  1. #1

    changing map scale to generic units

    i searched all the threads with as many variations of this theme i could think of, but all i found was a similar question no one answered. i hope that doesn't mean this is impossible.

    basically, i just want the map to read in generic units when i lock tokens and a player drags out his movement way points. instead of reading 10', i would like for it to say 2. so one unit is equal to 5'. i'd rather not have players calculating the units in their heads because in the game system i use one unit is not equal to 5' and i create the maps accordingly.

    thanks for any help on this.

    ~fry

  2. #2
    Well if you are comfortable with creating a quick custom ruleset this change is really easy to put in. If so, I will let you know which file you need to modify.

  3. #3
    Quote Originally Posted by joshuha
    Well if you are comfortable with creating a quick custom ruleset this change is really easy to put in. If so, I will let you know which file you need to modify.
    I would find that information very helpful if you don't mind sharing.

  4. #4
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,621
    Got to admitt that so would I.
    Ranges and the like in Metric would be very very nice.

    - Obe
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  5. #5
    joshuha,

    like the rest of these guys, i'd be incredibly grateful to receive some of your top notch coding help.

    i'm already running the custom ruleset "that cannot be named". so i can probably just tweak that one.

    thanks,
    ~fry

  6. #6
    Ok the file we care about is scripts\imagewindow_image.lua.

    In there are 2 function that are used to measure the vectors and the pointers.

    Code:
    function onMeasureVector(token, vector)
    	if hasGrid() then
    		local diagonals = 0;
    		local straights = 0;
    	8	local gridsize = getGridSize();
    	
    		for i = 1, #vector do
    			local gx = math.abs(math.floor(vector[i].x / gridsize));
    			local gy = math.abs(math.floor(vector[i].y / gridsize));
    			
    			if gx > gy then
    				diagonals = diagonals + gy;
    				straights = straights + gx - gy;
    			else
    				diagonals = diagonals + gx;
    				straights = straights + gy - gx;
    			end
    		end
    		
    		local squares = math.floor(diagonals * 1.5) + straights;
    		local feet = squares * 5;
    		
    		return feet .. "\'";
    	else
    		return "";
    	end
    end
    
    function onMeasurePointer(length)
    	if hasGrid() then
    		return math.floor(length / getGridSize() * 5) .. "\'";
    	else
    		return "";
    	end
    end
    To turn it into base units of 1 just remove the *5 instances you see above. Note that when it reports things in feet using the ' symbol it preceeds it with a backslash since its a special character. But you could easily replace the concatenation with .. "m" or what not.

    Now besides this you will obviously have to adjust your combat tracker reach/base size to reflect the base size for one square that you have.

    Also in the combattracker_token.lua in the updateUnderlay function it has to do the reverse to get the amount of squarew to highlight so it divides by 5. So again you will need to change that number to whatever your base unit size is.

    Code:
    function updateUnderlay()
    	if ref then
    		ref.removeAllUnderlays();
    		
    		local space = math.ceil(window.space.getValue() ) / 2;
    		local reach = math.ceil(window.reach.getValue() ) + space;
    		
    		if window.getType() == "pc" then
    			ref.addUnderlay(reach, "4f000000", "hover");
    		else
    			ref.addUnderlay(reach, "4f000000", "hover,gmonly");
    		end
    		
    		if window.getFoF() == "friend" then
    			ref.addUnderlay(space, "2f00ff00");
    		elseif window.getFoF() == "foe" then
    			ref.addUnderlay(space, "2fff0000");
    		elseif window.getFoF() == "neutral" then
    			ref.addUnderlay(space, "2fffff00");
    		end
    	end
    end
    So note here is you also didnt care about the reach overlay you could remove it off the combat tracker (although this involves modifying the LUA files that set the defaults too) as well as from the function above.


    If any of that isn't clear let me know.
    Last edited by joshuha; September 21st, 2007 at 20:36.

  7. #7
    I think it may be in the script file imagewindow_image.lua

    Code:
    function onMeasureVector(token, vector)
    	* cut unnecessary code *
    		local squares = math.floor(diagonals * 1.5) + straights;
    		local feet = squares * 5;
    
    function onMeasurePointer(length)
    		return math.floor(length / getGridSize() * 5) .. "\'";
    I'll wager if you changed the number 5 to whatever unit you want your squares to represent, it will produce the desired effect. Haven't had a chance to test it out yet, but will soon. (The new Star Wars rules list ranges in squares rather than foot measurements, so I'll need to do this updating).

    Edit: Beat to the punch by Joshua!

  8. #8

    of course it works

    joshua comes through again. can i nominate you for most valuable community member?



    thanks again!

    ~fry

    also, thanks for the input as well, GoOrange.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in