PDA

View Full Version : Creating another FFC in Zasm



Revfan9
11-05-2006, 03:32 PM
How do I use Zasm to create another FFC, and that FFC having a script of it's own? I saw it done in _L_'s Revolution Dungeon with that boss at the end, but I have been looking over that script over and over again and I just cannot figure it out. Can someone explain it for me?

Saffith
11-05-2006, 04:36 PM
There's basically only one way to do anything like that, as far as I know.
Have the "created" FFC start out invisible. When you want to activate it, change its combo so that it's visible. Have the FFC watch for this change, and not do anything until then. Something like this:

SETR d7, data
waitLoop COMPARER data, d7
GOTOFALSE activate
WAITFRAME
GOTO waitLoop

Revfan9
11-06-2006, 12:06 AM
Okay, another question: How can I get the position of another FFC? Do I use SETA1 and LOAD1? If so, how do I use them? What I am trying to do is have a "laser" that goes from FFC to FFC at regular intervals.

Saffith
11-06-2006, 01:03 AM
Yep, those're the ones. If I'm not mistaken, the syntax is like this:


SETV a1, 2 ; Load FFC #2 into a1
LOAD1 d0, y ; Load FFC #2's Y position into the current FFC's d0
SETA1 x, d1 ; Set FFC #2's X position to the current FFC's d0
Basically, for LOAD1 and LOAD2, the first argument is in the current FFC and the second argument is in the other FFC, and SETA1 and SETA2 are the other way around. They all set the first argument's value to that of the second argument.

I believe that will work, but it's not what the compiler does. It uses an argument called REFFFC. I'm not sure how that works.

Saffith
11-06-2006, 01:06 AM
(Edit: Oops.)

Revfan9
11-06-2006, 01:39 AM
Another question (sorry about all of the questions, but there really needs to be more documentation on this lying around ): How can I set a random value in Zasm? Is there a way to set an upper and lower limit on the random value with a command, or do I have to do it manually?

Saffith
11-06-2006, 02:01 AM
There are random number instructions, but I don't think they work quite right. As I understand it, RNDV d0, 5 should give you a random number n such that 0<=n<5. I think it should be an integer, but I'm not certain of that. Either way, it doesn't. Regardless, I can't get it to produce 4 or greater, so I think it's a bit off.
However, RNDV d0, 1 does seem to give numbers 0<=n<1, as one would expect. I suggest, therefore, that you get your random numbers as min+(random 0..1)*(max-min). That is:

RNDV d0, 1
MULTV d0, 5
ADDV d0, 5
... should set d0's value to a random number between 5 and 10.