Script help

The Script if you swim slower in a waterfall:

if (playerswimming) {
playery = playery+0.1;
}
timeout = 0.05;

What is the script, on if you walk slower on stairs/normal tiles?

As far as I’m aware no event is triggered when and if the player starts swimming although with custom movement, such a thing would be easily implemented.
But because you’re using the default movement you’ll need to loop around in your script and check if the player is the confines of the waterfall and act on it.
So you’ll want something like this(I’m giving you pseudo-code so you still get to think and learn)

BEGIN
IF playerenters OR loop
  IF player in waterfall bounds AND playerswimming
    move player down
  ENDIF

  loop
END

Or check the sprite or gani to see if you’re swimming. Also I think there is a flag for it like he uses in his script.
The method tric explained will will work well for stairs.

[QUOTE=hosler;102920]Or check the sprite or gani to see if you’re swimming.[/QUOTE]
That’s just silly, best to keep things simple if you can.

Or just use onwater. :confused:

[QUOTE=Spooon;102944]Or just use onwater. :/[/QUOTE]

Because checking if one tile is on water is adequate even though the player covers 4?

Are you for fucking real? The player only needs one water tile to swim.

if (created) {
  dontblock;
  setshape 1,64,16;
  this.waterfall = 10;
}
if (playertouchsme && onwater(playerx+1,playery+1.5) && playerdir == 2) {
  freezeplayer this.waterfall/10;
  this.fall = this.waterfall*2;
  timeout = 0.05;
}
if (timeout) {
  if (this.fall > 0) {
    this.fall--;
    playery += 0.5;
  }
  timeout = 0.05;
}

He’s the code, whatever your name is. tricxta is a retard and can’t even Graal.

Guys. I know the script for the waterfall but i need one for stairs. Like this one from Bomber Arena

Ask spoon for a script, he doesn’t care if you learn or not.

Please don’t make a argument because of this post. I need your both helps. :confused:

Would you just like the code and you can learn from it through inspection?

[QUOTE=tricxta;102974]Would you just like the code and you can learn from it through inspection?[/QUOTE]
We all know that doesn’t happen too often.

It’s hard to learn a language without working examples. I wouldn’t buy a c++ book full of only pseudo code.

[QUOTE=hosler;102980]It’s hard to learn a language without working examples.[/QUOTE]
No it’s not. You MAKE working examples.

I made the npc and described pretty much every line so this is a tutorial of sorts. If I see you’re asking a similar problem which can be related to this
I’ll point you here @OP
As a challenge, try understand the logic behind this and make stairs slow the player even more.

// NPC made by tricxta
if (playerenters){
  //we use this so our timeout can work on all clients in the level!
  //without this, only the leader would be able to run the timer
  timereverywhere;

  //intialise our first array in case the player logs in holding up whilst on the stairs
  this.playerC1 = {playerx,playery};

  timeout = 0.05;
}

if (timeout){//come to here once our timer has finished(timed out)
  if (playerx + 1.5 in |x,x+2| && playery + 2 in |y,y+4|){
    this.inBounds = true;
  }
  else {
    this.inBounds = false;
  }

  //if we can see the up key is being held we'll do something about it
  if (keydown(0) && this.inBounds == true){
    this.playerC2 = this.playerC1;//copy the player coordinates from the last frame
    this.playerC1 = {playerx,playery};//update our position

    //take the average of the two player co-ordinates
    playerx = (this.playerC1[0] + this.playerC2[0])/2;
    playery = (this.playerC1[1] + this.playerC2[1])/2;
  }
  else {
    //for logic reasons this must always be kept up to date no matter what
    this.playerC1 = {playerx,playery};
  }

  timeout = 0.05;
}

Oh man ! This is really weird for me. I only know the basics, but this is too difficult for me. I don’t want take scripts from other players i just want to know how to do it. But thanks anyways

Tricxta’s code records the players coords every frame, gets the midpoint of consecutive coords, and places the player at the midpoint. It just makes it look like that player is walking slowly.

I have difficulty myself in following some of Tricxta’s examples. Not that they are bad, because they aren’t… they just aren’t (for lack of a better term) dumbed down enough for users without scripting knowledge. And there are a lot of things that just simply don’t even have a spec of light shined on them in the commands.rtf. Correct me if I’m wrong but “this.” isn’t in there anywhere. And the information on arrays is very limited. They only have a few words after each command, which more often than not is more than sufficient. Sometimes however, it just doesn’t say anything about the command or function etc… at all.

I hope this isn’t taken as flaming or hostility of any sort, as it is truly not intended to be. I really appreciate all the help I’ve received from Tricxta, especially a very relevant script that I was able to use to push players downstream in my curvy ass river. It was handed to me in a similar fashion to this one, and I eventually caught on to it and learned how to apply it to what I want to build. What I am saying is that the tools built-in to Graal just aren’t enough to teach new players how to make anything complex without prior scripting knowledge of some sort. Just a suggestion, but maybe a few tutorials could be included in the next client release?

Sorry if I went too far off topic.

Nah, it’s because tricxta’s codes are overly complicated. There are easier ways to do it, but he ignores them for whatever reason.

Well sorry, I’ll just watch other people try help next time. :munch: