Jump to content

Photo

Interactable people and signs.


  • Please log in to reply
6 replies to this topic

#1 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 03 July 2019 - 11:32 PM

I looked around the forum a bit before posting this but if there is a post about this already it would be nice to have a link.

So ive seen in alot of quests that there areoften signs or people that will output text when you press the a button by them but i cant seem to find any combo that will do this unless i have to go the roundabout way and make a duplicate screen and teleport to it or something. Or perhaps i would have to use a script? If theres an easier way it would be nice to know.

#2 Lüt

Lüt

    Germanize

  • Members
  • Real Name:Steve
  • Location:Chicago

Posted 04 July 2019 - 12:04 AM

Or perhaps i would have to use a script?

Right.

This is the basic script most people have been using for years: https://www.purezc.n...e=scripts&id=98

However, if you want something more complex, there's a full NPC interaction system in two forms ("simple" and "full") here: https://www.purezc.n...=scripts&id=149
  • ChrisHunter64 likes this

#3 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 04 July 2019 - 03:01 AM

Much appreciation my friend. And its awesome that you responded so quickly so thank you.
Unfortunately im limited to my phone right now so i cant get access to the official website, but i will be able to later.

#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 July 2019 - 07:17 AM

While aye, you can do this with warps, it is ugly, messy, and buggy. It leads to forced, repeated cutscenes and other problems; and scripts are far better to accomplish this task at present.

 

Interactive objects/npcs are on the table for in-editor features in the future.

 

v2.53.x includes 'Classic.zh' that has this capability, by default, via scripting. Note that this is an entirely different script that has the same general effect.


  • ChrisHunter64 likes this

#5 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 23 July 2019 - 08:36 PM

Right.

This is the basic script most people have been using for years: https://www.purezc.n...e=scripts&id=98

However, if you want something more complex, there's a full NPC interaction system in two forms ("simple" and "full") here: https://www.purezc.n...=scripts&id=149

 

    So this is the first time ive ever implamented a script, ive been following the wiki and i get the file into the compiler but when i hit compile it comes up with an error saying a bunch of things are undeclared. Im assuming the x and y is the positions but i dont know what combo_at is or the dir_up error is. Would i have to put that in the combo cause i thought i had to put all of that information in at the ffc page.

 

Dont really wanna be that guy asking questions for things that have a simple answer but i dont want to mess with the script and would like to be able to actually know how to use them not only for this one but any i would feel i need to use in the future.


Edited by ChrisHunter64, 23 July 2019 - 08:37 PM.


#6 Lüt

Lüt

    Germanize

  • Members
  • Real Name:Steve
  • Location:Chicago

Posted 23 July 2019 - 09:28 PM

Oh, you need the line import "std.zh" at the top of your script file if you're using 2.53 versions.

 

That's a header containing a number of core functions which most scripts rely upon to operate. Certain scripts may require additional libraries, like ghost.zh for enemies or tango.zh for advanced dialogue features.

 

So your full signpost script file should look like this:

import "std.zh"

ffc script SignPost
{
    void run(int m,int input)
    {
        int loc = ComboAt(this->X,this->Y);
        while(true)
        {
            while(!AgainstComboBase(loc) || !SelectPressInput(input)) Waitframe();
            SetInput(input,false);
            Screen->Message(m);
            Waitframe();
        }
    }
    bool AgainstComboBase(int loc)
    {
        return Link->Z == 0 && (Link->Dir == DIR_UP && Link->Y == ComboY(loc)+8 && Abs(Link->X-ComboX(loc)) < 8);
    }
}

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;
}

Though actually, if you're using the base classic tileset that came with 2.53, you might have a version of it built in already.

 

If you press F7 to bring up the FFC window, just go ahead and edit any one of them, and at the bottom of the "Data" tab, there'll be a "Script" dropdown. If there's a "SignPost" selection available, you should be able to use that. Then in the "Arguments" tab, put the string number you want the sign to display in the "D0" box.

 

And, back on the "Data" tab, choose the combo you actually want to use for the sign post. Or, there's actually 2 ways to do it. FFCs don't have solidity in 2.53, so you can either place a solid combo on layer 0 or 1 beneath the FFC with the sign combo, or you can place the solid sign combo on the map itself, then select an invisible combo for your FFC (combo 1 is fine) and line it up with the sign combo.


  • ChrisHunter64 likes this

#7 ChrisHunter64

ChrisHunter64

    average everyday normal guy

  • Members

Posted 23 July 2019 - 10:17 PM

Oh, you need the line import "std.zh" at the top of your script file if you're using 2.53 versions.

 

That's a header containing a number of core functions which most scripts rely upon to operate. Certain scripts may require additional libraries, like ghost.zh for enemies or tango.zh for advanced dialogue features.

 

So your full signpost script file should look like this:

import "std.zh"

ffc script SignPost
{
    void run(int m,int input)
    {
        int loc = ComboAt(this->X,this->Y);
        while(true)
        {
            while(!AgainstComboBase(loc) || !SelectPressInput(input)) Waitframe();
            SetInput(input,false);
            Screen->Message(m);
            Waitframe();
        }
    }
    bool AgainstComboBase(int loc)
    {
        return Link->Z == 0 && (Link->Dir == DIR_UP && Link->Y == ComboY(loc)+8 && Abs(Link->X-ComboX(loc)) < 8);
    }
}

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;
}

Though actually, if you're using the base classic tileset that came with 2.53, you might have a version of it built in already.

 

If you press F7 to bring up the FFC window, just go ahead and edit any one of them, and at the bottom of the "Data" tab, there'll be a "Script" dropdown. If there's a "SignPost" selection available, you should be able to use that. Then in the "Arguments" tab, put the string number you want the sign to display in the "D0" box.

 

And, back on the "Data" tab, choose the combo you actually want to use for the sign post. Or, there's actually 2 ways to do it. FFCs don't have solidity in 2.53, so you can either place a solid combo on layer 0 or 1 beneath the FFC with the sign combo, or you can place the solid sign combo on the map itself, then select an invisible combo for your FFC (combo 1 is fine) and line it up with the sign combo.

 

 

  I tried the import std and it seems to work perfectly thank you. things are all coming together now.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users