Jump to content

Photo

Party members script


  • Please log in to reply
40 replies to this topic

#1 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 29 November 2012 - 04:18 PM

I was wondering if it's possible to make a script for party members. This script needs to be able to do these things:

-Be able to have at least 3 party members + head party member

-Have all party members use different sprite tiles.

-Only head party member uses action sprite tiles when the player uses an item

-Party members follow the head party member

-Item adds party member

- Party members use BS animation

-All party members use this sprite format:

IPB Image

That's it. Thanks! Bye! icon_biggrin.gif ~c00ln3rd icon_freak.gif

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 29 November 2012 - 04:58 PM

If you just want the party members to follow you around, you could try using the NPC follower script.

#3 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 29 November 2012 - 06:08 PM

Umm, I googled it, but can the NPC followers have swimming combos? Can there be 3 followers following link at a time? How do I add an NC follower to link? I am confused...

Edited by c00ln3rd, 29 November 2012 - 06:28 PM.


#4 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 29 November 2012 - 06:33 PM

Also, my exact needs are

-Party members follow link through water and on land

-Party members do EXACTLY the same thing as link except when he uses the "action tiles" (Shown above) or uses an item. An exception to that would be the party members jump with link.

-There can be 3 party members at a time, plus Link.

-Use BS animation

-Have to be obtainable through item.

-Party members use different tiles that are in the same format as link

EXTRAS: If it isn't to much of a hassle, maybe there could be a way to make it so you need a certain amount of party members to trigger a secret?

Edited by c00ln3rd, 29 November 2012 - 06:38 PM.


#5 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 29 November 2012 - 07:04 PM

I think I *might* be able to expand said follower script into a party member script, assuming that they still don't do anything other than follow Link.

The party members -> secret script would actually be easier (as in, fewer than 15 lines of code) than the party member script itself, so that won't be a problem.

EDIT: Third draft, compiles but still does not support jumping. Give it a try.
SCRIPTS


#6 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 29 November 2012 - 08:50 PM

The function "iswater" is undeclared. lul.

Edited by c00ln3rd, 30 November 2012 - 05:08 PM.


#7 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 30 November 2012 - 04:55 PM

the original npc follower script is here but it only has one party member.

NPC FOLLOWER SCRIPT

CODE
import "std.zh"

const int M_NORMAL    = 0;
const int M_MOVINGTOPOS    = 1;
const int M_SOLIDATPOS    = 2;

ffc script FollowLink{
  void run(){
    int orig = this->Data;
    int lastDir;
    int MovementState;
    int CurrentScreen;
    int idle;
    while(true){
      int x = Link->X; int y = Link->Y;
      if(Link->Dir == DIR_UP||Link->Dir == DIR_DOWN) y -= Link->Dir*32-16;
      else x -= (Link->Dir-2)*32-16;

      if(CurrentScreen != Game->GetCurScreen()) MovementState = NormalPlacement(this,x,y);
      if(MovementState == M_NORMAL){
        if(lastDir != Link->Dir) MovementState = MoveToPosition(this,x,y);
        else MovementState = NormalPlacement(this,x,y);
      }else if(MovementState == M_MOVINGTOPOS) MovementState = WhileMoving(this,x,y,idle);
      else if(MovementState == M_SOLIDATPOS) MovementState = CheckPos(this,x,y);

      SetGraphics(this,orig);
      CurrentScreen = Game->GetCurScreen();
      idle = (idle+1)%6;
      lastDir = Link->Dir;
    Waitframe();
    }
  }
  int NormalPlacement(ffc this,int x,int y){
    if(Solid(this,x,y)) return M_SOLIDATPOS;
    this->X = x; this->Y = y;
    return M_NORMAL;
  }
  int MoveToPosition(ffc this,int x,int y){
    if(Solid(this,x,y)) return M_SOLIDATPOS;
    int speed = Distance(x,y,this->X,this->Y)/8;
    if(speed < 0.5) return M_NORMAL;
    else if(speed < 1.2) speed *= 2;
    FFCToPoint(this,x,y,speed);
    return M_MOVINGTOPOS;
  }
  int WhileMoving(ffc this,int x,int y,int idle){    
    if(Abs(this->X-x) < 3 && Abs(this->Y-y) < 3){
      this->Vx = 0; this->Vy = 0;
      return M_NORMAL;
    }

    if(idle == 0) return MoveToPosition(this,x,y);
    return M_MOVINGTOPOS;
  }
  int CheckPos(ffc this,int x,int y){
    if(Solid(this,x,y)) return M_SOLIDATPOS;
    return MoveToPosition(this,x,y);
  }
  bool Solid(ffc this,int x,int y){
    if(Screen->isSolid(x+8,y+8)){
      this->Vx = 0; this->Vy = 0;
      return true;
    }
  }
  void SetGraphics(ffc this,int orig){
    int moving;
    if(Link->InputUp || Link->InputDown || Link->InputLeft || Link->InputRight
      || this->Vx != 0 || this->Vy != 0) moving = 4;
    this->Data = orig+moving+Link->Dir;
  }
  int FFCToPoint(ffc f,int x,int y,int speed){
    if(speed == 0) return -1;
    int dx = x-f->X; int dy = y-f->Y;
    int dis = Abs(dx) + Abs(dy);
    int d = dis/speed;
    f->Vx = dx/d; f->Vy = dy/d;
    return d;
  }
}


#8 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 30 November 2012 - 05:09 PM

Ok. I alreaady said that I need a modified version, which MM is making. But thanks! icon_biggrin.gif

#9 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 30 November 2012 - 06:29 PM

Capitalized IsWater() wrong. Fixed above^^

#10 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 30 November 2012 - 08:42 PM

Also, is this a global script? If it is, I need to google a tutorial on combining golbal scripts... Also, there's a metric ton of syntax errors, and it takes me a while to fix all of them. icon_wacky.gif They're on lines 118, 119, and 151. Also, when I fix those then try to compile, I get to pass 4, type-checking/completing function symbol tables/ constant folding, then it says "TMP, line 37: T29: That pointer type does not have a variable LoadFCC[]." Ohai Russ, Jamian, and Strike.

Edited by c00ln3rd, 30 November 2012 - 08:59 PM.


#11 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 30 November 2012 - 09:16 PM

Errors fixed; compiles.

The global script part is very simple - copy/paste the part inside the void run() part into the part of your global script between void run() and while(true). The global script will automatically call the FFC scripts for you.

#12 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 30 November 2012 - 09:30 PM

I found Joe123's global script combining topic, but It confuses me... icon_wacky.gif

Edited by c00ln3rd, 30 November 2012 - 10:27 PM.


#13 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 01 December 2012 - 01:39 AM

Put this part below your void run() line and above your while(true) line in the global script:
CODE
//Initialize party members
        if ( Link->Item[I_MEMBER1] ){
            ffc member = Screen->LoadFFC(FFC_MEMBER1);
            member->X = Link->X;
            member->Y = Link->Y;
            member->Data = CMB_MEMBER1;
            member->Script = FFCS_PARTYMEMBER;
            member->Flags[FFCF_CARRYOVER] = true;
            member->InitD[0] = 1;
        }
        if ( Link->Item[I_MEMBER2] ){
            ffc member = Screen->LoadFFC(FFC_MEMBER2);
            member->X = Link->X;
            member->Y = Link->Y;
            member->Data = CMB_MEMBER2;
            member->Script = FFCS_PARTYMEMBER;
            member->Flags[FFCF_CARRYOVER] = true;
            member->InitD[0] = 2;
        }
        if ( Link->Item[I_MEMBER3] ){
            ffc member = Screen->LoadFFC(FFC_MEMBER3);
            member->X = Link->X;
            member->Y = Link->Y;
            member->Data = CMB_MEMBER3;
            member->Script = FFCS_PARTYMEMBER;
            member->Flags[FFCF_CARRYOVER] = true;
            member->InitD[0] = 3;
        }


But first grab my latest update above to allow each party member to be a different distance behind Link.

#14 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 01 December 2012 - 07:20 AM

Thanks! In my quest I have the b9mchu script, and it uses BOTH globa lslots... xD


#15 Frocks7Snee

Frocks7Snee

    Illustrious

  • Members

Posted 01 December 2012 - 09:06 AM

TMP, line 75: error S26: pointer types (FFC, ETC.) cannot be declared as global variables.

Line 78: syntax error, unexpected rbrace, expecting $end, on token }

Tehluls xD


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users