View Single Post
jjturbo9

JCF Member

Joined: Mar 2025

Posts: 6

jjturbo9 has disabled reputation

Mar 25, 2025, 06:06 AM
jjturbo9 is offline
Reply With Quote
Excuse me, initially I wrote this message to ask a question but I already found an answer while explaining the question in detail xD So there's no question here anymore except maybe what I asked at the end of this message, although it's not that important because the code works now.
.
I decided I want the door to open when Jazz stands close to the door, as if Jazz opened the door with the key. Instead of opening together with getting the key. So I have to add another piece of code. Somehow it worked already with what I made up, but only because I made it simpler because I don't know how to code 2 'if' functions.

I want the door to open when walking through text event 101 but only if you walked through text event 100 first. I wrote this:

Code:
 
//Sound effect for getting key
void onFunction100(jjPLAYER@ player) {
  if (!jjTriggers[21]) {
    jjTriggers[21] = true;
    jjSample(player.xPos, player.yPos, SOUND::MENUSOUNDS_TYPEENTER);
  }
}
//Door opening only if you have the key and go to door after
void onFunction101(jjPLAYER@ player) {
  if (jjTriggers[21]) {
    jjTriggers[24] = true;
  }
}
Anyways, I puzzled a bit with the code and testing the level and eventually I also made it work to have a sound effect that only triggers when the door opens. It's this:

Code:
//Sound effect for getting key
void onFunction100(jjPLAYER@ player) {
  if (!jjTriggers[21]) {
    jjTriggers[21] = true;
    jjSample(player.xPos, player.yPos, SOUND::MENUSOUNDS_TYPEENTER);
  }
}
//Door opening only if you have the key and go to the door after + sound
void onFunction101(jjPLAYER@ player) {
  if (!jjTriggers[24])
  if (jjTriggers[21]) {
    jjTriggers[24] = true;
    jjSample(player.xPos, player.yPos, SOUND::COMMON_MONITOR);
  }
}
I didn't know how to write 'and' so I just added two ifs xD But it works now so I'm not complaining.

Last edited by jjturbo9; Mar 25, 2025 at 06:56 AM.