Trying to make some simple boots

I’m trying to make some iron boots that simply toggle on and off, as well as toggle a flag on and off. The purpose would be so when you touch certain npc’s with the boots on the npc will act accordingly and send you to an underwater level. I have some code here I’ve written and it sort of works, but for some reason it tends to turn the boots on over and over and over and sometimes turn them off. Just wondering if anybody knows why this works this way.

if (weaponfired) {
  if (this.inuse=0) {
    this.inuse=1;
    set ironboots;
    setplayerprop#c,Iron boots on;
  } else {
    this.inuse=0;
    unset ironboots;
    setplayerprop#c,Iron boots off;
  }
}

Try…

if(weaponfired){
  this.on = abs(this.on-1);
  if(this.on == 1){
    set ironboots;
    setplayerprop #c,Iron Boots On!;
  } else if(this.on==0){
    unset ironboots;
    setplayerprop #c,Iron Boots Off!;
  }
}

Seems to have more or less the same effect, I think it has something to do with a timer I have set… I’ll have to change the way the player receives the item. They do work with either script outside of the level that you get them in, it’s just an issue apparently in the one level.

if (weaponfired) {
  this.on = abs(this.on-1);
  if (this.on > 0) {
    set ironboots;
    setplayerprop #c,Iron Boots On!;
  } else {
    unset ironboots;
    setplayerprop #c,Iron Boots Off!;
  }
}

If I understand what you’re saying, try adding a check for them to receive the boots or use if (!hasweapon) in the code. It should stop problems with weapons messing up if you use them in the level you receive them in, although I don’t know what causes it.

Im suprised at both you guys. Kammesennin can be excused since his just learning. If I where doing this you only need one control variable… why you guys have 2 is anyones guess o_0

Im not tryin to be a troll here but just for the record you should revamp your code Kammesennin.

if (weaponfired) {
  if (!ironboots){
    set ironboots;
    setplayerprop #c,Iron Boots On!;
  } else {
    unset ironboots;
    setplayerprop #c,Iron Boots Off!;
  }
}

Anyhow… I hope you continue to pursue learning gs1 Kammesennin. Reborn would be alot funner if there were more people doing exactly what you are :slight_smile:

Also

This is because you had one temporary variable which would be reset when the player logs on and one permanent which is stored in the actual players account file. What I suggested will fix this issue then you can do such things with interacting with npcs by easily doing:

if(playertouchsme && ironboots)

Guess who doesn’t give three fucks?

That code is almost exactly what I had written at first except I don’t think I had an else statement in there. That was so simple, I knew it was something dumb I did lol. I went looking at code for Staff Boots and decided to use it and that’s what my first post up there actually was.

Thanks for the attempts Spooon, Kondie, and Alex, but I’m going to go with Trixcta’s code as it closest resembles my own original and by God it works in the original level as well!

And yes Trixcta I do plan to continue learning this. I’ve been working on a playerworld since about the time we met on Xialza (I think I told you about it then too, idk though) and I’m trying to get some people in my area to hop on Graal and start learning some things as well, but with the websites recent downtime it’s been a bit difficult.

I didn’t like using this.inuse anyway… never knew it was temporary but that’s very helpful to know so I don’t write other things all half-retarded like that again lol. Thanks a lot guys, seriously that made a huge difference in my playerworld, you don’t even know yet.

Please do this, the more people on graal, the funner the game is and who knows, with more people we might set off a chain reaction and attract even more attention if we get a player base, people will play if theres other people playing basically so try your hardest to do this! :slight_smile:

In before, “New Jersey Reborn”

Lol fear not! Though we are all from Jersey, we all fucking hate it so it won’t be nearly like that South Park episode.

Also Tricxta, I know and am working on it for that exact reason. I don’t expect greatness of anyone I’m getting into this, but I do expect to at least see some people playing on and off along with some new content being created slowly over time as they learn. I just hope they don’t come in, play a few days and disappear.