Jump to content

Photo

3 Questions.


  • Please log in to reply
2 replies to this topic

#1 Teilyr

Teilyr

  • Members
  • Real Name:Adam
  • Location:Louisiana

Posted 08 December 2008 - 04:06 PM

So, I've been gone for about a year. ZC's undergone ALOT of changes in this time. So, I have some n00bish (by today's standards, anyway) questions I'd like an answer to.

1. What language is scripting done in?
I'm referring to ZScript here, as it seems to be the favorite. I've not even bothered to look at ZASM.

By language, I mean.. Where do the cause and effect codes come from? Example being.. I'll just use a snippet from Joe123's "Bottomless Pits and Lava" script.

CODE
ffc script hole{
    void run(int lava, int warpx, int warpy, int combotype, int tile){    
    int sfx = fallingsfx;
    if(warpx == 0 && warpy == 0){Waitframes(5); warpx = Link->X; warpy = Link->Y;}
    if(tile == 0){tile = linkfalling;}
    if(combotype == 0){combotype = 35;}
    if(lava != 0){if(tile == linkfalling){tile = linklava;}sfx = lavasfx;}
    int i; int x; int y; bool falling;


Where does one get the void run(int lava, int warpx, etc., etc. from?

2. What are Freeform Combos? (FFCs)
Pretty straightforward here.

3. How are FFCs used to do cutscenes with smooth character animation?
In the topic talking about Mr. Z's quest, Quest For Light (Beta Link also does it in IoD) I queried how he did such smooth character animation. I figured it was just ALOT of combo cycling. I was later informed that it was a combination of FFCs and Scripting, which left me with a big question mark over my head.

Answers to these questions, as well as any such tutorial I could be linked to, would be greatly appreciated. Thank you.

#2 Joe123

Joe123

    Retired

  • Members

Posted 08 December 2008 - 04:30 PM

QUOTE(Teilyr @ Dec 8 2008, 09:06 PM) View Post
1. What language is scripting done in?

ZScript.
Nobody uses ZASM.

The only person who I'm aware of that ever used it was Revfan, and obviously he's not around anymore.
ZScript is based on C, whereas ZASM is based on ASM (surprisingly enough).

To someone who already knows a bit about coding in C, it shouldn't be very hard to pick up ZScript.
To get the 'cause and effect codes', open up your copy of 'ZScript.txt' in your ZC folder, and have a look.
Each function/variable is accessed by a pointer with the name of the heading it's under.

So for 'Dir' in the 'Link' section, you'd use the 'Link' pointer, and an arrow operator; 'Link->Dir = 3;' or whatever.

CODE
ffc script hole{
    void run(int lava, int warpx, int warpy, int combotype, int tile){    
    int sfx = fallingsfx;
    if(warpx == 0 && warpy == 0){Waitframes(5); warpx = Link->X; warpy = Link->Y;}
    if(tile == 0){tile = linkfalling;}
    if(combotype == 0){combotype = 35;}
    if(lava != 0){if(tile == linkfalling){tile = linklava;}sfx = lavasfx;}
    int i; int x; int y; bool falling;


"void run(int lava, int warpx,"
'void run' must be in every script. That's where the script starts running from. The script terminates when you get to the end of void run.
Those values declared within void run are the arguments of the FFC (D0->D7, which I'll explain later on) or Item the script is attached to (so on a global script they wouldn't mean much).
Most of the rest of the code you've posted is just declaration of local variables (ie, they don't directly affect the game itself), but as you can see, the Link->X and Link->Y are Link's current coordinates.

QUOTE(Teilyr @ Dec 8 2008, 09:06 PM) View Post
2. What are Freeform Combos? (FFCs)

Freeform combos...
Hrm.

The best way to describe them probably is as a 'Custom Screen Sprite'.
It's a combo which you can apply various attributes to, making it more like a sprite than a combo.
You can set it to any (x,y) position (so it's not quantised into the 16 pixel grid), give it a speed and/or acceleration in x and y directions, make it change directions (and or graphics) when it hits another ffc, make it up to 4x4 combos in size, set various other attributes - and most importantly - apply scripts to it.
They're really quite flexible for making cutscenes and things, although their usefulness without also using scripting is a little limited at that point, because there's no option for them to be solid.
I did make some rollers like in OoS/OoA which used ffcs and changers with no scripts attached which were quite nice though in The Fort Knights.

The 'arguments' I mentioned earlier allow for you to 'customize' a script due to where it's attached.
It lets you pass up to 8 paramaters through from the ffc into the script.
The prime example (I think) is the item pickup message script.
Changing the argument allows you to use it for all of your items, because you choose in the item itself which message string it should play.
Otherwise, you'd have to write a seperate script for each item.

Obviously the same goes for FFCs. As for what the effects of a script on an ffc are; they're pretty much limitless. They obviously can manipulate the ffc they're attached to, but don't assume they're restricted to that.

QUOTE(Teilyr @ Dec 8 2008, 09:06 PM) View Post
3. How are FFCs used to do cutscenes with smooth character animation?

Well, what you'd do for example is...

Set up your 'Link moving left' graphiced ffc, at the right hand side of the screen with X velocity '-2'.
In the middle of the screen at the same y coordinate, set up a 'changer' ffc.
Changers are invisible, and pass on their attributes to any ffc that touches them.
When the ffc moving left at two pixels per frame hits this second ffc, it's graphic and x/y velocity will change to the value set in this ffc.
So you can set on the second ffc your 'Link moving up' graphic, and an X velocity 0, Y velocity -1, and when your first ffc 'walks' over and touches this one, it'll start moving upward and change graphics.


Obviously I haven't explained how any of these things work in great detail, just what they are.
I can do though, if you'd like.

#3 Majora

Majora

    Unironic Marxist-Leninist

  • Members

Posted 08 December 2008 - 04:33 PM

God dammit Joe beat me to it ;_;

Edited by Majora, 08 December 2008 - 04:34 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users