Jump to content

Photo

Shop


  • Please log in to reply
36 replies to this topic

#16 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 01:18 PM

QUOTE(Plissken @ Jan 31 2010, 12:17 PM)  

Can you now post your entire .z file here?


CODE
import "std.zh"

const int CMB_BLANK        = 0; //Set this to the ID of a transparent combo
const int CMB_NULL        = 0; //Leave this as 0!
ffc script ShopSingleSaleItem{
    void run(int itm, int price, int perm, int input){
        while(Screen->D[perm] == 0){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[CR_RUPEES] >= price){
                    ShopItemThanks(itm);
                    this->Data = CMB_BLANK;
                    DeductRupees(price);
                    Screen->D[perm]++;
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
        this->Data = CMB_NULL;
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

//Only include these two functions once in your script file
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}

const int WSP_FALLING        = 100; //Weapon/Misc. sprite for Link falling down a hole
const int WSP_LAVA            = 101; //Weapon/Misc. sprite for Link drowning in lava
const int SFX_FALLING        = 38; //SFX for falling down a hole
const int SFX_LAVA            = 55; //SFX for drowning in lava
const int CMB_AUTOWARP        = 7; //Combo ID of a transparent AutoWarp A combotype

const int CT_HOLELAVA        = 11; //Combotype to give hole functionality to (default is Left Statue)

ffc script HoleLava{
    void run(int lava, int warpto, int damage){

    this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
    if(lava){
        this->Misc[0] = WSP_LAVA;
        this->Misc[1] = SFX_LAVA;
    }
    //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
    if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
        Waitframes(5);
        this->X = Link->X; this->Y = Link->Y;
    }
    this->Misc[2] = warpto;
    if(damage) this->Misc[3] = damage;
    else this->Misc[3] = 8;
    
        while(true){
            while(!OnPitCombo()) Waitframe(); //Idle while not on pit
            int pitclk = 0;
            while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
            if(pitclk >= 5) Fall(this); //Fall
        }
    }
    void Fall(ffc Info){
        Screen->ClearSprites(SL_LWPNS);
        Game->PlaySound(Info->Misc[1]);
        int wait = CreateGraphic(Info->Misc[0]);

        Link->Invisible = true; Link->CollDetection = true;
        for(int i=0;i<wait+30;i++) WaitNoAction();
        Link->Invisible = false; Link->CollDetection = false;

        if(Info->Misc[2]) Warp(Info);

        Link->X = Info->X; Link->Y = Info->Y;
        Link->HP -= Info->Misc[3];
        Game->PlaySound(SFX_OUCH);
    }
    void Warp(ffc Warp){
        int orig = Warp->Data;
        Warp->Data = CMB_AUTOWARP;
        Warp->Flags[FFCF_CARRYOVER] = true;
        Waitframe();
        Warp->Data = orig;
        Warp->Flags[FFCF_CARRYOVER] = false;
        Link->Z = Link->Y;
        Quit();
    }
    bool OnPitCombo(){
        return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
    }
    int CreateGraphic(int sprite){
        lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
        l->HitXOffset = 500;
        l->UseSprite(sprite);
        l->DeadState = l->NumFrames*l->ASpeed;
        l->X = Link->X; l->Y = Link->Y;
        return l->DeadState;
    }
    void WaitNoAction(){
        Link->InputUp = false; Link->InputDown = false;
        Link->InputLeft = false; Link->InputRight = false;
        Link->InputR = false; Link->InputMap = false;
        Link->InputA = false; Link->InputB = false;
        Waitframe();
    }
}

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }


        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0){
                    Game->PlaySound(SFX_JUMP);
                    Link->Action=LA_HOPPING;
                }
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}


ffc script OrbReact
{
    void run(int a,int b,int c, int m)
    {
        if(Link->Item[a] && Link->Item[b] && Link->Item[c])
        {
            Screen->TriggerSecrets();
        }
        else
        {
            Screen->Message(m);
        }
    }
}

item script Give
{
    void run(int i)
    {
        Link->Item[i] = true;
    }
}

item script Message{
  void run(int m){
    Screen->Message(m);
  }
}


#17 Plissken

Plissken

    What's with these homies dissing our girls?

  • Members

Posted 31 January 2010 - 01:26 PM

CODE
import "std.zh"

const int CMB_BLANK        = 0; //Set this to the ID of a transparent combo
const int CMB_NULL        = 0; //Leave this as 0!

const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

bool CanBuy(ffc buy,int input){
    return (Abs(Link->X-buy->X) < 8 && Abs(Link->Y-(buy->Y+8)) < 8 && SelectPressInput(input) && Link->Dir == DIR_UP);
}
void ShopItemThanks(int itm){
    Screen->Message(S_THANKS);
    Game->PlaySound(SFX_SCALE);
    WaitNoAction();
    CreatePickupItem(Link->X,Link->Y,itm);
    Game->PlaySound(SFX_PICKUP);
    WaitNoAction();
}
void CreatePickupItem(int x, int y, int itm){
    item Spawn = Screen->CreateItem(itm);
    Spawn->Pickup |= IP_TIMEOUT;
    Spawn->HitWidth = 16; Spawn->HitHeight = 16;
    Spawn->X = x; Spawn->Y = y;
}

void DeductRupees(int amount){
    FreezeScreen();
    for(int i=0;i<amount;i++){
        Game->PlaySound(SFX_MSG);
        Game->Counter[CR_RUPEES]--;
    Waitframe();
    }
    UnFreeze();
}

int FreezeID;
void FreezeScreen(){
    FreezeID = Screen->ComboT[0];
    Screen->ComboT[0] = CT_SCREENFREEZE;
}
void UnFreeze(){
    Screen->ComboT[0] = FreezeID;
}

//These functions should only be included in your script file once
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}

void NoAction(){
    Link->InputUp = false; Link->InputDown = false;
    Link->InputLeft = false; Link->InputRight = false;
    Link->InputA = false; Link->InputB = false;
    Link->InputL = false; Link->InputR = false;
}
void WaitNoAction(){
    NoAction();
    Waitframe();
}

ffc script ShopSingleSaleItem{
    void run(int itm, int price, int perm, int input){
        while(Screen->D[perm] == 0){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[CR_RUPEES] >= price){
                    ShopItemThanks(itm);
                    this->Data = CMB_BLANK;
                    DeductRupees(price);
                    Screen->D[perm]++;
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
        this->Data = CMB_NULL;
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

const int WSP_FALLING        = 100; //Weapon/Misc. sprite for Link falling down a hole
const int WSP_LAVA            = 101; //Weapon/Misc. sprite for Link drowning in lava
const int SFX_FALLING        = 38; //SFX for falling down a hole
const int SFX_LAVA            = 55; //SFX for drowning in lava
const int CMB_AUTOWARP        = 7; //Combo ID of a transparent AutoWarp A combotype

const int CT_HOLELAVA        = 11; //Combotype to give hole functionality to (default is Left Statue)

ffc script HoleLava{
    void run(int lava, int warpto, int damage){

    this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
    if(lava){
        this->Misc[0] = WSP_LAVA;
        this->Misc[1] = SFX_LAVA;
    }
    //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
    if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
        Waitframes(5);
        this->X = Link->X; this->Y = Link->Y;
    }
    this->Misc[2] = warpto;
    if(damage) this->Misc[3] = damage;
    else this->Misc[3] = 8;
    
        while(true){
            while(!OnPitCombo()) Waitframe(); //Idle while not on pit
            int pitclk = 0;
            while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
            if(pitclk >= 5) Fall(this); //Fall
        }
    }
    void Fall(ffc Info){
        Screen->ClearSprites(SL_LWPNS);
        Game->PlaySound(Info->Misc[1]);
        int wait = CreateGraphic(Info->Misc[0]);

        Link->Invisible = true; Link->CollDetection = true;
        for(int i=0;i<wait+30;i++) WaitNoAction();
        Link->Invisible = false; Link->CollDetection = false;

        if(Info->Misc[2]) Warp(Info);

        Link->X = Info->X; Link->Y = Info->Y;
        Link->HP -= Info->Misc[3];
        Game->PlaySound(SFX_OUCH);
    }
    void Warp(ffc Warp){
        int orig = Warp->Data;
        Warp->Data = CMB_AUTOWARP;
        Warp->Flags[FFCF_CARRYOVER] = true;
        Waitframe();
        Warp->Data = orig;
        Warp->Flags[FFCF_CARRYOVER] = false;
        Link->Z = Link->Y;
        Quit();
    }
    bool OnPitCombo(){
        return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
    }
    int CreateGraphic(int sprite){
        lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
        l->HitXOffset = 500;
        l->UseSprite(sprite);
        l->DeadState = l->NumFrames*l->ASpeed;
        l->X = Link->X; l->Y = Link->Y;
        return l->DeadState;
    }
}

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0){
                    Game->PlaySound(SFX_JUMP);
                    Link->Action=LA_HOPPING;
                }
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}
ffc script OrbReact
{
    void run(int a,int b,int c, int m)
    {
        if(Link->Item[a] && Link->Item[b] && Link->Item[c])
        {
            Screen->TriggerSecrets();
        }
        else
        {
            Screen->Message(m);
        }
    }
}

item script Give
{
    void run(int i)
    {
        Link->Item[i] = true;
    }
}

item script Message{
  void run(int m){
    Screen->Message(m);
  }
}


You need to change the values of these two variables yourself in the file though.
CODE
const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

They need to be the correct String Message ID numbers for each message.

Your problem was that you didn't put the functions for that script in. They were in a separate block of code on that topic blaman originally sent you to.

Edited by Plissken, 31 January 2010 - 01:27 PM.


#18 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 01:58 PM

hey thanks i am still a beginner when it comes to scripts i will message you if there is is something wrong.


QUOTE(Plissken @ Jan 31 2010, 12:26 PM)  

CODE
import "std.zh"

const int CMB_BLANK        = 0; //Set this to the ID of a transparent combo
const int CMB_NULL        = 0; //Leave this as 0!

const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

bool CanBuy(ffc buy,int input){
    return (Abs(Link->X-buy->X) < 8 && Abs(Link->Y-(buy->Y+8)) < 8 && SelectPressInput(input) && Link->Dir == DIR_UP);
}
void ShopItemThanks(int itm){
    Screen->Message(S_THANKS);
    Game->PlaySound(SFX_SCALE);
    WaitNoAction();
    CreatePickupItem(Link->X,Link->Y,itm);
    Game->PlaySound(SFX_PICKUP);
    WaitNoAction();
}
void CreatePickupItem(int x, int y, int itm){
    item Spawn = Screen->CreateItem(itm);
    Spawn->Pickup |= IP_TIMEOUT;
    Spawn->HitWidth = 16; Spawn->HitHeight = 16;
    Spawn->X = x; Spawn->Y = y;
}

void DeductRupees(int amount){
    FreezeScreen();
    for(int i=0;i<amount;i++){
        Game->PlaySound(SFX_MSG);
        Game->Counter[CR_RUPEES]--;
    Waitframe();
    }
    UnFreeze();
}

int FreezeID;
void FreezeScreen(){
    FreezeID = Screen->ComboT[0];
    Screen->ComboT[0] = CT_SCREENFREEZE;
}
void UnFreeze(){
    Screen->ComboT[0] = FreezeID;
}

//These functions should only be included in your script file once
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}

void NoAction(){
    Link->InputUp = false; Link->InputDown = false;
    Link->InputLeft = false; Link->InputRight = false;
    Link->InputA = false; Link->InputB = false;
    Link->InputL = false; Link->InputR = false;
}
void WaitNoAction(){
    NoAction();
    Waitframe();
}

ffc script ShopSingleSaleItem{
    void run(int itm, int price, int perm, int input){
        while(Screen->D[perm] == 0){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[CR_RUPEES] >= price){
                    ShopItemThanks(itm);
                    this->Data = CMB_BLANK;
                    DeductRupees(price);
                    Screen->D[perm]++;
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
        this->Data = CMB_NULL;
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

const int WSP_FALLING        = 100; //Weapon/Misc. sprite for Link falling down a hole
const int WSP_LAVA            = 101; //Weapon/Misc. sprite for Link drowning in lava
const int SFX_FALLING        = 38; //SFX for falling down a hole
const int SFX_LAVA            = 55; //SFX for drowning in lava
const int CMB_AUTOWARP        = 7; //Combo ID of a transparent AutoWarp A combotype

const int CT_HOLELAVA        = 11; //Combotype to give hole functionality to (default is Left Statue)

ffc script HoleLava{
    void run(int lava, int warpto, int damage){

    this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
    if(lava){
        this->Misc[0] = WSP_LAVA;
        this->Misc[1] = SFX_LAVA;
    }
    //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
    if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
        Waitframes(5);
        this->X = Link->X; this->Y = Link->Y;
    }
    this->Misc[2] = warpto;
    if(damage) this->Misc[3] = damage;
    else this->Misc[3] = 8;
    
        while(true){
            while(!OnPitCombo()) Waitframe(); //Idle while not on pit
            int pitclk = 0;
            while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
            if(pitclk >= 5) Fall(this); //Fall
        }
    }
    void Fall(ffc Info){
        Screen->ClearSprites(SL_LWPNS);
        Game->PlaySound(Info->Misc[1]);
        int wait = CreateGraphic(Info->Misc[0]);

        Link->Invisible = true; Link->CollDetection = true;
        for(int i=0;i<wait+30;i++) WaitNoAction();
        Link->Invisible = false; Link->CollDetection = false;

        if(Info->Misc[2]) Warp(Info);

        Link->X = Info->X; Link->Y = Info->Y;
        Link->HP -= Info->Misc[3];
        Game->PlaySound(SFX_OUCH);
    }
    void Warp(ffc Warp){
        int orig = Warp->Data;
        Warp->Data = CMB_AUTOWARP;
        Warp->Flags[FFCF_CARRYOVER] = true;
        Waitframe();
        Warp->Data = orig;
        Warp->Flags[FFCF_CARRYOVER] = false;
        Link->Z = Link->Y;
        Quit();
    }
    bool OnPitCombo(){
        return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
    }
    int CreateGraphic(int sprite){
        lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
        l->HitXOffset = 500;
        l->UseSprite(sprite);
        l->DeadState = l->NumFrames*l->ASpeed;
        l->X = Link->X; l->Y = Link->Y;
        return l->DeadState;
    }
}

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0){
                    Game->PlaySound(SFX_JUMP);
                    Link->Action=LA_HOPPING;
                }
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}
ffc script OrbReact
{
    void run(int a,int b,int c, int m)
    {
        if(Link->Item[a] && Link->Item[b] && Link->Item[c])
        {
            Screen->TriggerSecrets();
        }
        else
        {
            Screen->Message(m);
        }
    }
}

item script Give
{
    void run(int i)
    {
        Link->Item[i] = true;
    }
}

item script Message{
  void run(int m){
    Screen->Message(m);
  }
}


You need to change the values of these two variables yourself in the file though.
CODE
const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

They need to be the correct String Message ID numbers for each message.

Your problem was that you didn't put the functions for that script in. They were in a separate block of code on that topic blaman originally sent you to.
ok when i bought something link did not hold up an item is it supposed to do that?


#19 Plissken

Plissken

    What's with these homies dissing our girls?

  • Members

Posted 31 January 2010 - 02:06 PM

That'd be a question for the script author, Joe123.

#20 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 02:14 PM

QUOTE(Plissken @ Jan 31 2010, 01:06 PM)  

That'd be a question for the script author, Joe123.
he wont talk to me for some reason or he is gone somewhere or something


#21 Plissken

Plissken

    What's with these homies dissing our girls?

  • Members

Posted 31 January 2010 - 02:30 PM

What, did you PM him? Give it a bit of time, he's probably not online. He'll get back to you eventually.

#22 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 03:05 PM

QUOTE(Plissken @ Jan 31 2010, 01:30 PM)  

What, did you PM him? Give it a bit of time, he's probably not online. He'll get back to you eventually.
yeah i guess its just he has bin helping me allot i thought he got annoyed


#23 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 31 January 2010 - 03:43 PM

By reading the script more, link should hold up the item once he buys it. Did you set it up right?

#24 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 06:47 PM

QUOTE(Plissken @ Jan 31 2010, 12:26 PM)  

CODE
import "std.zh"

const int CMB_BLANK        = 0; //Set this to the ID of a transparent combo
const int CMB_NULL        = 0; //Leave this as 0!

const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

bool CanBuy(ffc buy,int input){
    return (Abs(Link->X-buy->X) < 8 && Abs(Link->Y-(buy->Y+8)) < 8 && SelectPressInput(input) && Link->Dir == DIR_UP);
}
void ShopItemThanks(int itm){
    Screen->Message(S_THANKS);
    Game->PlaySound(SFX_SCALE);
    WaitNoAction();
    CreatePickupItem(Link->X,Link->Y,itm);
    Game->PlaySound(SFX_PICKUP);
    WaitNoAction();
}
void CreatePickupItem(int x, int y, int itm){
    item Spawn = Screen->CreateItem(itm);
    Spawn->Pickup |= IP_TIMEOUT;
    Spawn->HitWidth = 16; Spawn->HitHeight = 16;
    Spawn->X = x; Spawn->Y = y;
}

void DeductRupees(int amount){
    FreezeScreen();
    for(int i=0;i<amount;i++){
        Game->PlaySound(SFX_MSG);
        Game->Counter[CR_RUPEES]--;
    Waitframe();
    }
    UnFreeze();
}

int FreezeID;
void FreezeScreen(){
    FreezeID = Screen->ComboT[0];
    Screen->ComboT[0] = CT_SCREENFREEZE;
}
void UnFreeze(){
    Screen->ComboT[0] = FreezeID;
}

//These functions should only be included in your script file once
bool SelectPressInput(int input){
    if(input == 0) return Link->PressA;
    else if(input == 1) return Link->PressB;
    else if(input == 2) return Link->PressL;
    else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
    if(input == 0) Link->InputA = state;
    else if(input == 1) Link->InputB = state;
    else if(input == 2) Link->InputL = state;
    else if(input == 3) Link->InputR = state;
}

void NoAction(){
    Link->InputUp = false; Link->InputDown = false;
    Link->InputLeft = false; Link->InputRight = false;
    Link->InputA = false; Link->InputB = false;
    Link->InputL = false; Link->InputR = false;
}
void WaitNoAction(){
    NoAction();
    Waitframe();
}

ffc script ShopSingleSaleItem{
    void run(int itm, int price, int perm, int input){
        while(Screen->D[perm] == 0){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[CR_RUPEES] >= price){
                    ShopItemThanks(itm);
                    this->Data = CMB_BLANK;
                    DeductRupees(price);
                    Screen->D[perm]++;
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
        this->Data = CMB_NULL;
    }
}

ffc script RealNPC{
    void run(int m, int sfx, int defdir, int d, int ffcnumber, int input){
        ffc NPC = this;
        if(ffcnumber != 0) Screen->LoadFFC(ffcnumber);
        NPC->Misc[0] = NPC->Data;
        if(d == 0) d = 40;
        
        while(true){
            SetGraphic(NPC,defdir,d);
            if(CanTalk(NPC,input)){
                SetInput(input,false);
                if(sfx != 0) Game->PlaySound(sfx);
                Screen->Message(m);
            }
            Waitframe();
        }
    }
    bool CanTalk(ffc NPC,int input){
        return (SelectPressInput(input) && Abs(NPC->X-Link->X) < 24 && Abs(NPC->Y-Link->Y) < 24 && Link->Z == 0);
    }
    void SetGraphic(ffc NPC, int defdir, int d){
        int dx = NPC->X-Link->X; int ax = Abs(dx);
        int dy = NPC->Y-Link->Y; int ay = Abs(dy);
        if(defdir != 0){
            if(ax < d && ay < d){
                if(ax <= ay){
                    if(dy >= 0) NPC->Data = NPC->Misc[0]+DIR_UP;
                    else NPC->Data = NPC->Misc[0]+DIR_DOWN;
                }else{
                    if(dx >= 0) NPC->Data = NPC->Misc[0]+DIR_LEFT;
                    else NPC->Data = NPC->Misc[0]+DIR_RIGHT;
                }
            }else NPC->Data = NPC->Misc[0]+(defdir-1);
        }
    }
}

const int WSP_FALLING        = 100; //Weapon/Misc. sprite for Link falling down a hole
const int WSP_LAVA            = 101; //Weapon/Misc. sprite for Link drowning in lava
const int SFX_FALLING        = 38; //SFX for falling down a hole
const int SFX_LAVA            = 55; //SFX for drowning in lava
const int CMB_AUTOWARP        = 7; //Combo ID of a transparent AutoWarp A combotype

const int CT_HOLELAVA        = 11; //Combotype to give hole functionality to (default is Left Statue)

ffc script HoleLava{
    void run(int lava, int warpto, int damage){

    this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
    if(lava){
        this->Misc[0] = WSP_LAVA;
        this->Misc[1] = SFX_LAVA;
    }
    //Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
    if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
        Waitframes(5);
        this->X = Link->X; this->Y = Link->Y;
    }
    this->Misc[2] = warpto;
    if(damage) this->Misc[3] = damage;
    else this->Misc[3] = 8;
    
        while(true){
            while(!OnPitCombo()) Waitframe(); //Idle while not on pit
            int pitclk = 0;
            while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
            if(pitclk >= 5) Fall(this); //Fall
        }
    }
    void Fall(ffc Info){
        Screen->ClearSprites(SL_LWPNS);
        Game->PlaySound(Info->Misc[1]);
        int wait = CreateGraphic(Info->Misc[0]);

        Link->Invisible = true; Link->CollDetection = true;
        for(int i=0;i<wait+30;i++) WaitNoAction();
        Link->Invisible = false; Link->CollDetection = false;

        if(Info->Misc[2]) Warp(Info);

        Link->X = Info->X; Link->Y = Info->Y;
        Link->HP -= Info->Misc[3];
        Game->PlaySound(SFX_OUCH);
    }
    void Warp(ffc Warp){
        int orig = Warp->Data;
        Warp->Data = CMB_AUTOWARP;
        Warp->Flags[FFCF_CARRYOVER] = true;
        Waitframe();
        Warp->Data = orig;
        Warp->Flags[FFCF_CARRYOVER] = false;
        Link->Z = Link->Y;
        Quit();
    }
    bool OnPitCombo(){
        return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+8)] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
    }
    int CreateGraphic(int sprite){
        lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
        l->HitXOffset = 500;
        l->UseSprite(sprite);
        l->DeadState = l->NumFrames*l->ASpeed;
        l->X = Link->X; l->Y = Link->Y;
        return l->DeadState;
    }
}

ffc script FFCJumpCliff{

    void run(int verticalmovement, int horizontalmovement, int directiontopress) {
    
        int directiontopressmoreleft;
        int directiontopressmoreright;
        int LinkHmovementdone = 0;
        bool ffcsentlinkjumping = false;
    
        if (directiontopress==DIR_DOWN) {
            directiontopressmoreleft = DIR_RIGHTDOWN;
            directiontopressmoreright = DIR_LEFTDOWN;
        }
    
        else {
            if (directiontopress==DIR_UP) {
                directiontopressmoreleft = DIR_LEFTUP;
                directiontopressmoreright = DIR_RIGHTUP;
            }
            else {
                if (directiontopress==DIR_LEFT) {
                    directiontopressmoreleft = DIR_LEFTDOWN;
                    directiontopressmoreright = DIR_LEFTUP;
                }
                else {
                    if (directiontopress==DIR_RIGHT) {
                        directiontopressmoreleft = DIR_RIGHTUP;
                        directiontopressmoreright = DIR_RIGHTDOWN;
                    }
                    else {
                        if (directiontopress==DIR_LEFTDOWN) {
                            directiontopressmoreleft = DIR_DOWN;
                            directiontopressmoreright = DIR_LEFT;
                        }
                        else {
                            if (directiontopress==DIR_RIGHTDOWN) {
                                directiontopressmoreleft = DIR_RIGHT;
                                directiontopressmoreright = DIR_DOWN;
                            }
                            else {
                                if (directiontopress==DIR_LEFTUP) {
                                    directiontopressmoreleft = DIR_LEFT;
                                    directiontopressmoreright = DIR_UP;
                                }
                                else {
                                    if (directiontopress==DIR_RIGHTUP) {
                                        directiontopressmoreleft = DIR_UP;
                                        directiontopressmoreright = DIR_RIGHT;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        while (true){
    
            if (Link->Z==0) {
                LinkHmovementdone=0;
                ffcsentlinkjumping = false;
            }
    
            if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
                if (horizontalmovement<0) {Link->X--;}
                if (horizontalmovement>0) {Link->X++;}
                LinkHmovementdone++;
            }
    
            if ( (LinkCollision(this))
                && ( (Link->Dir==directiontopress)
                ||(Link->Dir==directiontopressmoreleft)
                ||(Link->Dir==directiontopressmoreright) ) ) {
                
                if (Link->Z==0){
                    Game->PlaySound(SFX_JUMP);
                    Link->Action=LA_HOPPING;
                }
                ffcsentlinkjumping=true;
                Link->Y=Link->Y+verticalmovement;
                Link->Z=Link->Z+verticalmovement;
            }
            
            Waitframe();
        }
    }
}
ffc script OrbReact
{
    void run(int a,int b,int c, int m)
    {
        if(Link->Item[a] && Link->Item[b] && Link->Item[c])
        {
            Screen->TriggerSecrets();
        }
        else
        {
            Screen->Message(m);
        }
    }
}

item script Give
{
    void run(int i)
    {
        Link->Item[i] = true;
    }
}

item script Message{
  void run(int m){
    Screen->Message(m);
  }
}


You need to change the values of these two variables yourself in the file though.
CODE
const int S_NORUPEES = 0;  //Message saying 'Not enough rupees'
const int S_THANKS     = 0; //Message saying 'Thanks for buying'

They need to be the correct String Message ID numbers for each message.

Your problem was that you didn't put the functions for that script in. They were in a separate block of code on that topic blaman originally sent you to.
what do i have to do on the const int S_NORUPEES = 0; //Message saying 'Not enough rupees'
const int S_THANKS = 0; //Message saying 'Thanks for buying' part?




#25 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 31 January 2010 - 07:07 PM

You're suppose to enter the I.D number of the strings you want to have play if you have enough rupees to buy the item, or if you don't have enough rupees to buy it.

#26 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 31 January 2010 - 08:08 PM

QUOTE(Christian @ Jan 31 2010, 06:07 PM)  

You're suppose to enter the I.D number of the strings you want to have play if you have enough rupees to buy the item, or if you don't have enough rupees to buy it.
in the script or in the arguments?


#27 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 31 January 2010 - 08:55 PM

Arguments.

#28 Joe123

Joe123

    Retired

  • Members

Posted 01 February 2010 - 10:29 AM

QUOTE(cremeens1000 @ Jan 31 2010, 07:14 PM)  
he wont talk to me for some reason or he is gone somewhere or something
It's because I hate you.



...just kidding, I've been away for the weekend. I didn't get any PMs from you though.
Link should hold the item up, I don't know why he isn't. I'll have a look though in a bit if you want.

#29 Tree

Tree

    Everything must go away

  • Members
  • Real Name:Mundy Fumple McStroodlestein
  • Location:The Milky Way Galaxy

Posted 01 February 2010 - 11:49 AM

QUOTE(Joe123 @ Feb 1 2010, 09:29 AM)  

It's because I hate you.
...just kidding, I've been away for the weekend. I didn't get any PMs from you though.
Link should hold the item up, I don't know why he isn't. I'll have a look though in a bit if you want.
oh ok well i'll try fixing it


#30 Joe123

Joe123

    Retired

  • Members

Posted 01 February 2010 - 12:16 PM

Oh, I got it.
Replace the 'CreatePickupItem' bit of your script with this one:
CODE
void CreatePickupItem(int x, int y, int itm){
    item Spawn = Screen->CreateItem(itm);
    Spawn->Pickup |= (IP_TIMEOUT|IP_HOLDUP);
    Spawn->HitWidth = 16; Spawn->HitHeight = 16;
    Spawn->X = x; Spawn->Y = y;
}


QUOTE(KINGOFALLME @ Jan 31 2010, 05:19 PM)  
I don't know what you're saying. That is one messy run-on sentence
I think that Kingy here (while posting off-topic, which he shouldn't have been) was hinting at was that it might be a good idea if in future you put a bit more effort into your spelling and grammar.
While it's not an offence on the boards not to use capital letters or full stops, it makes your posts a lot easier to read if you do use them. Help us to help you.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users