Fortnite Script Help!! [XB1]

GPC1 script programming for Titan One. Code examples, questions, requests.

Fortnite Script Help!! [XB1]

Postby DeathFear » Thu Jan 25, 2018 5:35 pm

I'm trying to make a script that will track when I'm in build mode or combat mode as well as which slot I'm currently using so no matter where I'm at in the "menu" it will recognize what it takes to get to a certain slot so when I hit 1 for example it will bring me back to combat mode slot 1 even if I was in build mode. All I can think of is a crazy amount of if statements but that seems highly inefficient I'm fairly new to coding so if anyone has any ideas they would be highly appreciated :joia:
User avatar
DeathFear
Sergeant
Sergeant
 
Posts: 8
Joined: Thu Jan 25, 2018 5:22 pm

Re: Fortnite Script Help!! [XB1]

Postby DeathFear » Thu Jan 25, 2018 11:33 pm

I started the script (my first one ever) and I'm having troubles with getting the value of the shortest distance between the current selected slot (wepslottrack/bldslottrack) and the requested slot, so lets say I'm on slot 4 and I want to go to slot 1 the most efficient path is hitting RB twice so I circle around back to 1 but how would I go about getting that value in code. I could code a bunch of if statements for every situation but that would be a lot of unnecessary code.
Any feedback is appreciated!!

Code: Select all
 
//mode and tracker
define buildmode = 1;
define combatmode = 0;
int mode = combatmode;
 
//weapon hotkeys and tracker
int wslot1 = 1;
int wslot2 = 2;
int wslot3 = 3;
int wslot4 = 4;
int wslot5 = 5;
int wepslottrack=1;
 
//building hotkeys and tracker
int bslot1;
int bslot2;
int bslot3;
int bslot4;
int bldslottrack=1;
 
 
 
main {
    //keeps track of which mode
    if ((event_press(XB1_B)) && (mode == combatmode)) {
            mode = buildmode
            }
    else if ((event_press(XB1_B)) && (mode == buildmode)) {
            mode = combatmode;
            }
 
    //keeps track of weapon slot
    if ((event_press(XB1_RB)) && (mode == combatmode)) {
        wepslottrack = wepslottrack + 1
            if (wepslottrack > 5) {
                wepslottrack = 1
                }}
    if ((event_press(XB1_LB)) && (mode == combatmode)) {
        wepslottrack = wepslottrack - 1
        if (wepslottrack < 1) {
            wepslottrack = 5
            }}
    //keeps track of build slot
    if ((event_press(XB1_RB)) && (mode == buildmode)) {
        bldslottrack = bldslottrack + 1
            if (bldslottrack > 4) {
                bldslottrack = 1
                }}
    if ((event_press(XB1_LB)) && (mode == buildmode)) {
        bldslottrack = bldslottrack - 1
            if (bldslottrack < 1) {
            bldslottrack = 4
            }}
    //switches to requested slot
    if (event_press(CEMU_EXTRA1)) {
        combo_run(weapon1)
        }
    if (event_press(CEMU_EXTRA2)) {
        combo_run(weapon2)
        }
    if (event_press(CEMU_EXTRA3)) {
        combo_run(weapon3)
        }
    if (event_press(CEMU_EXTRA4)) {
        combo_run(weapon4)
        }
    if (event_press(CEMU_EXTRA5)) {
        combo_run(weapon5)
        }
    if (event_press(CEMU_EXTRA6)) {
        combo_run(buildwall)
        }
    if (event_press(CEMU_EXTRA7)) {
        combo_run(buildstair)
        }
    //manual tracker reset to weapon mode slot1
    if (event_press(XB1_RIGHT)) {
        mode = 0
        wepslottrack = 1
        bldslottrack = 1
        }
}
 
combo weapon1 {
 
}
 
 
combo weapon2 {
}
 
 
combo weapon3 {
}
 
 
combo weapon4 {
}
 
 
combo weapon5 {
}
 
 
combo buildwall {
}
 
 
combo buildstair {
}
 
 
 
 
 
 
 
 
 
 
User avatar
DeathFear
Sergeant
Sergeant
 
Posts: 8
Joined: Thu Jan 25, 2018 5:22 pm

Re: Fortnite Script Help!! [XB1]

Postby J2Kbr » Fri Jan 26, 2018 11:43 am

As for your first script you did very well. :joia: :joia: There is one or two possible optimizations, but in general it is very well structured.

Related with Fortnite, I can't really be of much help, have not played this game yet.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Fortnite Script Help!! [XB1]

Postby Abaybay » Sun Jan 28, 2018 3:06 pm

I tried to create a script like that aswell. Maybe we can work together. In the script you posted, at the beginning you defined build mode as 1,i guess because you start without a weapon, but when you defined it as 1 and later the code says : if buildmode is 1 and press b, weapon mode is 1, so you are always in weapon mode. Also you say mode=weapon mode at the beginning. So Mode will always be weapon mode. Sorry im writing from phone now I'll post my try for this script later.
User avatar
Abaybay
Corporal
Corporal
 
Posts: 5
Joined: Sun Jan 28, 2018 3:02 pm

Re: Fortnite Script Help!! [XB1]

Postby MAL8010 » Fri Feb 02, 2018 10:28 am

Also, how are you going to keep track of how many weapon slots are actually filled?

with building it's easy as there are always 4 slots always available to use, but with weapons, 2 slots could be filled or 4, how are you going to determine this?
User avatar
MAL8010
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 263
Joined: Sun Feb 05, 2017 3:12 pm

Re: Fortnite Script Help!! [XB1]

Postby DeathFear » Sun Feb 04, 2018 7:46 pm

Abaybay wrote:I tried to create a script like that aswell. Maybe we can work together. In the script you posted, at the beginning you defined build mode as 1,i guess because you start without a weapon, but when you defined it as 1 and later the code says : if buildmode is 1 and press b, weapon mode is 1, so you are always in weapon mode. Also you say mode=weapon mode at the beginning. So Mode will always be weapon mode. Sorry im writing from phone now I'll post my try for this script later.


This is my first script ever so im not entirely sure how placement affects the outcome of the code, but i had the tracker working (i checked it by getting the value of bldslottrack and wepslottrack and set them to the paddle buttons on the xbox so i could see what the values were) the problem was when the code input a button,lets say the code hit RB, the tracker wouldnt recognize that RB was hit so the tracker wouldnt be in the correct spot anymore and im not sure how to fix that. any ideas?
User avatar
DeathFear
Sergeant
Sergeant
 
Posts: 8
Joined: Thu Jan 25, 2018 5:22 pm

Re: Fortnite Script Help!! [XB1]

Postby DeathFear » Sun Feb 04, 2018 7:52 pm

MAL8010 wrote:Also, how are you going to keep track of how many weapon slots are actually filled?

with building it's easy as there are always 4 slots always available to use, but with weapons, 2 slots could be filled or 4, how are you going to determine this?


i didnt think of this problem actually but i put in a manual tracker reset so if anything went wrong with the tracker and it thought you were in a different spot in your modes than you actually were you could put your character back to holding the first weapon and hit the reset so the tracker would be in sync again. i dont have a better solution than that because theres no way the code could "know" how many weapons you have. well... if you put in a system to track how many weapons youve picked up and which slots youve moved them to then its possible but for that you would need a crazy amount of if statements and separate keybindings for opening doors and picking up weapons its just not worth the trouble haha
User avatar
DeathFear
Sergeant
Sergeant
 
Posts: 8
Joined: Thu Jan 25, 2018 5:22 pm

Re: Fortnite Script Help!! [XB1]

Postby xLuckyX94 » Sun Feb 11, 2018 10:10 am

your script are working?
User avatar
xLuckyX94
Sergeant First Class
Sergeant First Class
 
Posts: 22
Joined: Fri Dec 22, 2017 11:18 am

Re: Fortnite Script Help!! [XB1]

Postby derekdorks » Sun Feb 25, 2018 2:56 am

i Tried using this script i keep getting a error "define"
sorry im a nood :roll:
User avatar
derekdorks
Private
Private
 
Posts: 1
Joined: Sun Feb 25, 2018 2:52 am

Re: Fortnite Script Help!! [XB1]

Postby J2Kbr » Mon Feb 26, 2018 11:56 am

derekdorks wrote:i Tried using this script i keep getting a error "define"
sorry im a nood :roll:

if you are trying to use this code with the Titan Two, include the following line at the very beginning of the script:
Code: Select all
#include <titanone.gph>
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Next

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 81 guests