Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Lazarus

#21
I had another look at the global script for the "int chartofollow" and i didn't find any other reference,
but what i did notice was that in the function there was "int charidtogo"

and i was wondering if placing this in the script header instead, as this was missing?


function GoToCharacterEx(int charidwhogoes, int charidtogo, int direction, int xoffset, int yoffset, int NPCfacesplayer, int blocking){
Ã,  //Goes to a character staying at the side defined by 'direction': 1 up, 2 right, 3 down, 4 left
Ã,  //and it stays at xoffset or yofsset from the character. NPCfacesplayer self-explained. ;)
Ã,  // blocking: 0=non-blocking; 1=blocking; 2=semi-blocking.
Ã,  // returns 1 if player arrived.
Ã,  int playerchar,charidx,charidy,playerx,playery;
Ã,  if (charidwhogoes!=GetPlayerCharacter() && blocking==2) blocking=0;//npcs cant perform semi-blocking actions
Ã,  playerchar=charidwhogoes;
Ã,  charidx=character[charidtogo].x;
Ã,  charidy=character[charidtogo].y;
Ã,  playerx=character[playerchar].x;
Ã,  playery=character[playerchar].y;
Ã,  Ã,  Ã,  int arrived = 1;
Ã,  Ã,  Ã,  if ((Offset (playerx, charidx) > xoffset) || (Offset (playery, charidy) > yoffset)){
Ã,  Ã,  Ã,  Ã,  if (direction==0){ // shortest way.
Ã,  Ã,  Ã,  Ã,  Ã,  if (Offset(charidx,playerx)>=Offset(charidy,playery)){ // left or right
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (playerx>=charidx) direction=2; //right
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else direction=4; //left
Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  else{
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (playery>=charidy) direction=3; //down
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else direction=1;
Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  // calculate target position
Ã,  Ã,  Ã,  Ã,  if (direction==1) charidy-=yoffset;
Ã,  Ã,  Ã,  Ã,  else if (direction==2) charidx+=xoffset;
Ã,  Ã,  Ã,  Ã,  else if (direction==3) charidy+=yoffset;
Ã,  Ã,  Ã,  Ã,  else if (direction==4) charidx-=xoffset;
Ã,  Ã,  Ã,  Ã,  // move character
Ã,  Ã,  Ã,  Ã,  if (blocking==0){
Ã,  Ã,  Ã,  Ã,  Ã,  MoveCharacter(playerchar,charidx,charidy);
Ã,  Ã,  Ã,  Ã,  Ã,  arrived = 0;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  else if (blocking==1){
Ã,  Ã,  Ã,  Ã,  Ã,  MoveCharacterBlocking(playerchar,charidx,charidy,0);
Ã,  Ã,  Ã,  Ã,  Ã,  arrived = 1;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  else if (blocking==2) arrived = MovePlayer(charidx,charidy);
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  if (arrived > 0){
Ã,  Ã,  Ã,  Ã,  // characters only face each other after the moving character arrived at the target point
Ã,  Ã,  Ã,  Ã,  if (NPCfacesplayer==1)Ã,  FaceCharacter(charidtogo, playerchar);
Ã,  Ã,  Ã,  Ã,  FaceCharacter(playerchar, charidtogo);
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  return arrived;
}


#22
Many many thanks the template works a treat. ;D

What i'd like to know is how "int chartofollow" works as there is no direct reference in the function?

Thanks again
#23
Hi i'm having problems with the Proskrito's MI2 templatev2.0c working with ags version 2.7, i've renamed the gui,objects and hotspots which is ok.

The problem i have is now with line 445:
Function declaration has wrong number of arguments to prototype.

"function GoToCharacterEx(int charidwhogoes, int charidtogo, int direction, int xoffset, int yoffset, int NPCfacesplayer, int blocking){"

following Gilbot V7000a advice i found in the script header it was referring to

46: import function GoToCharacterEx(int charid, int direction, int xoffset, int yoffset, int NPCfacesplayer, int blocking);
47: import function GoToCharacter(int charid, int direction, int NPCfacesplayer, int blocking);

Any help would be grateful
Thanks in advance

Ps My first post i placed in the wrong thread by mistake as i had both opened
SMF spam blocked by CleanTalk