More flags?

  • 14 Replies
  • 4732 Views
*

Offline Raicuparta

  • 519
  • 41
  • Rai
    • View Profile
More flags?
« on: July 22, 2011, 01:12:03 »
Used up all my flags with just a few tiny quests and buttons. I could just find a smart way to recycle them so I can use them later, but I already know that this is going to be a headache, so I'm going to ask here (after searching for quite a while) if there is a way to have more than 9 flags + powerups and keys.

I tried doing it manually in the ini, and that didn't work, but maybe there's a smart workaround for this, besides finding a good way to turn them off.

Also, something I noticed: if I have a flag warp set to flag 11, the warp will always happen, as if flag 11 was always on. Is that supposed to be like that?

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: More flags?
« Reply #1 on: July 22, 2011, 08:06:58 »
No. Not additional flags. You can indeed recycle the flags by setting them to the other state and do a check on that in your next warp.

I don't know the answer to your question about flag 11. Sounds like a bug or perhaps flag 11 is assigned to a powerup.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline Raicuparta

  • 519
  • 41
  • Rai
    • View Profile
Re: More flags?
« Reply #2 on: July 22, 2011, 15:32:13 »
OK, thanks for the answer. Besides making it much easier, if I could have more flags, I could have a much less linear level. This way, some of the quests will have to be done in a certain order. But I guess I'll find my way.

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: More flags?
« Reply #3 on: July 22, 2011, 15:40:54 »
You can make chapters. Per chapter you have certain quests to complete. Either you need all or a few to complete the chapter before going to the next.

And you can make your level such that you can't reach the previous chapter.

Edit: fixed typo
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline GrayFace

  • 805
  • 61
    • View Profile
    • my site
Re: More flags?
« Reply #4 on: August 29, 2011, 19:08:26 »
You can also use KS Ex. There you can have any number of variables, but you'll work with them differently.

*

Offline Raicuparta

  • 519
  • 41
  • Rai
    • View Profile
Re: More flags?
« Reply #5 on: August 30, 2011, 01:32:01 »
You can also use KS Ex. There you can have any number of variables, but you'll work with them differently.
You mean with Lua, right?

*

Offline egomassive

  • 1850
  • 250
    • View Profile
    • egomassive games
Re: More flags?
« Reply #6 on: August 30, 2011, 11:26:04 »
Also, something I noticed: if I have a flag warp set to flag 11, the warp will always happen, as if flag 11 was always on. Is that supposed to be like that?

I looked into this. In MMF2 an object can have up to 26 variables and 10 strings. They all have default names and null values by default. You can give them your own names and starting values when making an MMF2 program, but you can still use the default names. The flag checking function in Knytt Stories uses the default names of the flag value storage object. The 10 flags occupy slots 0 though 9 which match their given names. If you check a flag higher than 9 then you access other stored values. In the case of "Flag 11" you are actually checking the variable for FlagWarpY(A). So if you declare FlagWarpY(A)=1 and Flag(A)=11, then you will flag warp.

*

Offline GrayFace

  • 805
  • 61
    • View Profile
    • my site
Re: More flags?
« Reply #7 on: August 30, 2011, 23:21:39 »
You mean with Lua, right?
Yes.
Here's an example of setting a flag (in screen x1000y1000 when Shift A is triggered):
Code: [Select]
function x1000y1000()
  function events.ShiftA()
    vars.SomeFlag = true
    -- replace 'true' with 'false' or 'nil' to reset the flag
  end
end
Here's an example of flag warp (from x1001y1000 to x1002y1000):
Code: [Select]
function events.global.Warp()
  if Game.MapX == 1001 and Game.MapY == 1000 and vars.SomeFlag then
    Game.MapX = 1002
  end
end

P.S. now working on the new version of KS Ex. One very good thing is that I had problems changing sprites frames due to my own bug. Now all standard sprites would be replaceable in the most natural way.
« Last Edit: August 30, 2011, 23:35:54 by GrayFace »

*

Offline egomassive

  • 1850
  • 250
    • View Profile
    • egomassive games
Re: More flags?
« Reply #8 on: August 31, 2011, 08:33:10 »
I noticed you, GrayFace, used a screen dependent function in the first example and a global function in the second example. Why can't the Warp() be a screen dependent function? What I'm thinking:
Code: [Select]
function x1001y1000()
  if vars.SomeFlag then
    Game.MapX = 1002
  end
end

*

Offline GrayFace

  • 805
  • 61
    • View Profile
    • my site
Re: More flags?
« Reply #9 on: August 31, 2011, 12:43:57 »
x1001y1000 is called after the screen is fully loaded, including all objects.

*

Offline egomassive

  • 1850
  • 250
    • View Profile
    • egomassive games
Re: More flags?
« Reply #10 on: September 01, 2011, 08:09:41 »
^: That makes sense.

*

Offline Pumpkinbot

  • 1134
  • 20
  • No terrain is too hard. Not even dragons.
    • View Profile
    • My DeviantART page
Re: More flags?
« Reply #11 on: September 21, 2011, 15:55:02 »
Or you could use a "binary" method with multiple shifts and whatnot, like only 0 is on, then 0 is off, but 1 is on, then 2, etc, until you reach the last shift, then use 0 and 1, then 0 and 2, then 0 and 3, etc...
A God, a Messiah, an Angel, a King, a Prince, and an All Terrain Vehicle.

*

Offline GrayFace

  • 805
  • 61
    • View Profile
    • my site
Re: More flags?
« Reply #12 on: September 22, 2011, 05:52:10 »
That would be tricky because you can only check for flags being on and only use or boolean operation. To make an and you'll have to do warps amoung several screens, one flag check per screen (because when a flag warp is triggered the destination screen isn't tested for flag warps).

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: More flags?
« Reply #13 on: September 22, 2011, 12:51:07 »
Also, with a binary flag, you have basically one active flag that has many different states. You combine all to get one number, and based on that number you can make checks. It will probably only useful to keep a score of some sort, like progress. I doubt a binary flagsystem is that useful.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline Pumpkinbot

  • 1134
  • 20
  • No terrain is too hard. Not even dragons.
    • View Profile
    • My DeviantART page
Re: More flags?
« Reply #14 on: September 22, 2011, 15:48:18 »
Meh, true, didn't think about that. x) As you can tell, I don't use flags often. =D
A God, a Messiah, an Angel, a King, a Prince, and an All Terrain Vehicle.