Re: Fortnite Battle Royale KB/M (Script + Translator)
Posted: Mon May 14, 2018 6:20 pm
MAL8010 wrote:Nice work, I look forward to testing this when I'm back from holiday.
Currently it calculates the "shortest path" in the get_slots_to_change function (changing from wep slots 5 to 1 is 1 RB, 1 to 5 is 1 LB). Currently I've been working on the adding the pickaxe/trap slot to the weapon scroll mechanics, just need to further test it when I get home. I'll also check out your script! Maybe working together we could improve eachother's code.
- Code: Select all
int8 get_slots_to_change(int8 curr_slot, int8 to_slot, int8 slot_count) {
if(curr_slot == to_slot || to_slot > slot_count || slot_count == 1) return 0;
if(abs(to_slot - curr_slot) == (slot_count - 1)) return ((-2 * ((to_slot - curr_slot) > 0)) + 1);
if(slot_count == 5) {
if(abs(to_slot - curr_slot) == 3) return ((to_slot - curr_slot) / -3) * 2;
}
if(abs(to_slot - curr_slot) <= abs(curr_slot - to_slot))
return (to_slot - curr_slot);
return (curr_slot - to_slot);
}
Very ugly, and there may be a way to calculate it better. Just figured it worked for now, so it's fine