Fortnite Game

I need help with this. Please help!!

2 Likes

i can help but right now ima be too busy so i can help in some hours

2 Likes

I’d love to! What type of stuff is there going to be? (top-down? guns? heals/meds/shields?

2 Likes

ok thanks

1 Like
2 Likes

I am working on adding skins

1 Like

I need help with some on my code.

here it is:
it says there is a problem in this:

controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
game.splash(“Locker”)
let Locker: 1
})
forever(function() {

if (Locker == 1 ) {

}

})

1 Like

you cant move

1 Like

Lets go fortnite

1 Like

youre not supposed to move

1 Like

here’s the updated one:

1 Like

First, you should always put your code between backticks, like this:
```typescript
// My code here
```
Becomes:

// My code here

(The “typescript” after the backticks will make the code syntax highlight)

Next, you should always indent. I can’t tell if you are indenting because you didn’t put the code between backticks. So your code should look like this:

controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
    game.splash(“Locker”)
    let Locker: 1
})
forever(function() {
    if (Locker == 1 ) {
        
    }
})

There are two problems:

  1. The way to define variables is like: let <variable_name>: <variable_type> = <starting_value>. So it should be let Locker: number = 1.
  2. Since you defined Locker inside the controller.left.onEvent function there is a high chance of Locker not being defined in when it is referenced in the forever function. One way to solve this (albeit slightly frowned upon when you can avoid it but whatever) is to use global variables. So you have to move the definition out of the function and put it at the very beginning.

Try to figure it yourself! If you can’t figure it out, here is the solution:

let Locker: number = 1
controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
    game.splash(“Locker”)
})
forever(function() {
    if (Locker == 1 ) {
        
    }
})
2 Likes

i used the solution but now my new code isn’t working either, saying there is a expression expected:

let Locker: number = 1
controller.left.onEvent(ControllerButtonEvent.Pressed, function() {
game.splash(“Locker”)
})
forever(function() {
if (Locker == 1 ) {
if (controller.A.isPressed() ()

)
}})

1 Like

It’s because you didn’t close the if statement properly - it should be something like this:

if (statement) {
   // your code here
}

Solution:

forever(function() {
    if (Locker == 1) {
        if (controller.A.isPressed()) {
            
        }
    }
})

Maybe it would help to do it in blocks and switch to TypeScript to see how it actually works???

1 Like

Thanks!! Thanks to you, I think i finished my game!!

3 Likes

Wait what are we supposed to do?

1 Like

Press A to loot. when you press B, if the last thing you got was a weapon, you ambush/raid enemies with it.

1 Like

but if you keep spamming a you keep getting more and more hearts

1 Like

I’ts a chance thing. just see what you get!

1 Like

Yeah, my luck is absolutely bad (it’s literally 75-25 and I’m worried :worried:)

2 Likes