Jump to content

Photo

"Cover-up" Script


  • Please log in to reply
19 replies to this topic

#1 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 23 February 2008 - 07:24 PM

Is there any way to cover up an arrow sprite when it's fired? Apparently, animated projectiles are not appreciated in ZC, and therefore uses only the animation frames and does not rotate them in any way.

So, all I need is a FFC script that checks for fired projectiles, and "covers" them with a FFC that faces the correct direction that it's going.

#2 Joe123

Joe123

    Retired

  • Members

Posted 23 February 2008 - 08:16 PM

Well what you'd do is make the sprites for it empty, and script an ffc weapon (or even DrawTile perhaps) onto the bow to send out an arrow that went at the same speed.

Not too difficult.

#3 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 23 February 2008 - 11:24 PM

It's actually possible? I would have posted that it's impossible.

Nice workaround method BTW. Kinda like my Press R to shield method.

#4 Joe123

Joe123

    Retired

  • Members

Posted 24 February 2008 - 05:13 AM

Well I don't see why it shouldn't work.

I was thinking about doing it before with the boomerang actually, so that we could have one that cut grass.


Anyway, your code would want to look a bit like this:
CODE

item script arrow{
    void run(){
    int spd = 1; // You'll have to work out what the speed of the arrows are, by leaving graphics on the arrow sprites and sending the ffc along at the same time, until you get it right.
    int cmb = 0; // Set here the combotype of the up-facing arrow combo. Combos should be arranged 'Up, Down, Left, Right' on the page.

    ffc arw = Screen->LoadFFC(32);
    arw->X = Link->X; arw->Y = Link->Y;
        if(Link->Dir == 0){
            arw->Vy = -spd;
            arw->Data = cmb;

        }
        if(Link->Dir == 1){
            arw->Vy = spd;
            arw->Data = cmb+1;
        }
        if(Link->Dir == 2){
            arw->Vx = -spd;
            arw->Data = cmb+2;
        }
        if(Link->Dir == 3){
            arw->Vx = spd;
            arw->Data = cmb+3;
        }
    }
}


Should work, but you'll have to find out the speed of the arrow yourself.

#5 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 24 February 2008 - 04:01 PM

Thanks, but it doesn't work with Z3 movement which shoots it at an angle, and it doesn't recognize counters. I'm trying to fix the counter, but it says it Counter is undeclared in Line 9.

Here's the attempted fix;
CODE

import std.zh
item script arrow{
    void run(){
    int spd = 2; // You'll have to work out what the speed of the arrows are, by leaving graphics on the arrow sprites and sending the ffc along at the same time, until you get it right.
    int cmb = 56; // Set here the combotype of the up-facing arrow combo. Combos should be arranged 'Up, Down, Left, Right' on the page.

    ffc arw = Screen->LoadFFC(32);
    arw->X = Link->X * Link->Y; arw->Y = -Link->Y * Link->X;
        if(Counter->CR_RUPEES >= 1){
            if(Link->Dir == 0){
                arw->Vy = -spd;
                arw->Data = cmb;
            }
            if(Link->Dir == 1){
                arw->Vy = spd;
                arw->Data = cmb+1;
            }
            if(Link->Dir == 2){
                arw->Vx = -spd;
                arw->Data = cmb+2;
            }
            if(Link->Dir == 3){
                arw->Vx = spd;
                arw->Data = cmb+3;
            }
        }
    }
}


EDIT: Apparently ZQuest can't copy to the clipboard, and I posted the wrong script.

Edited by Linkus, 24 February 2008 - 04:27 PM.


#6 Joe123

Joe123

    Retired

  • Members

Posted 24 February 2008 - 05:39 PM

CODE
item script arrow{
    void run(){
    int spd = 2;
    int cmb = 56;
    bool go;

    ffc arw = Screen->LoadFFC(32);
    arw->X = Link->X; arw->Y = Link->Y; //Why are you multiplying Link's coordinates together?! That's not good...
        if(Game->Counter[1] > 0){ //That's how you access counters.
            if(Link->Dir == 0){
                arw->Vy = -spd;
                arw->Data = cmb;
                go = true;
            }
            if(Link->Dir == 1 && !go){
                arw->Vy = spd;
                arw->Data = cmb+1;
                go = true;
            }
            if(Link->Dir == 2 && !go){
                arw->Vx = -spd;
                arw->Data = cmb+2;
                go = true;
            }
            if(Link->Dir == 3 && !go){
                arw->Vx = spd;
                arw->Data = cmb+3;
            }
        }
    }
}


Have a go with that one.

#7 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 24 February 2008 - 06:40 PM

QUOTE(Joe123 @ Feb 24 2008, 05:39 PM) View Post

Why are you multiplying Link's coordinates together?! That's not good...


Oops. I was merely trying to create a "slope" that the arrow would follow when Z3 movement occurs, which would've corrected the diagonal directions. However, it seems to happen only after you go a diagonal direction.

A few other things I found--

It can only fire "once", where the FFC is made only once for the most recent arrow fired.
It needs to cancel itself when the Smack sprite occurs on the original arrow, instead of keep going.
Finally, it seems that the spd integer doesn't work. No matter what I put in, it still keeps going the same speed.

This is going to be a pain...

#8 Joe123

Joe123

    Retired

  • Members

Posted 24 February 2008 - 06:46 PM

QUOTE
Oops. I was merely trying to create a "slope" that the arrow would follow when Z3 movement occurs, which would've corrected the diagonal directions. However, it seems to happen only after you go a diagonal direction.


Oh well urm, you don't really need slopes to correct that.
Did my go boolean correct it?

QUOTE
A few other things I found--

It can only fire "once", where the FFC is made only once for the most recent arrow fired.
It needs to cancel itself when the Smack sprite occurs on the original arrow, instead of keep going.
Finally, it seems that the spd integer doesn't work. No matter what I put in, it still keeps going the same speed.


What do you mean it can only fire once?
You can't have more than one arrow on the screen at a time can you?

That's not going to be so easy *sigh*
It's do-able though, just require the global script and some checking of the ffc and things.

That is very interesing.
And very wrong.
Oh dear.

#9 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 24 February 2008 - 06:57 PM

QUOTE(Joe123 @ Feb 24 2008, 06:46 PM) View Post

Did my go boolean correct it?

Not at all. It seems to make LinkDir->0,1,2,3,and 4 diagonal as soon as a diagonal direction is followed.


QUOTE

What do you mean it can only fire once?
You can't have more than one arrow on the screen at a time can you?

Wait... Alright, it seems that the arrow can fire only once, but the FFC doesn't recognize this and can fire again instead of waiting for the arrow sprite to disappear.

I'd help some more, but unfortunately scripting is like a banana yet I'm a ostrich. I'd try, but I'm likely to choke myself trying to eat it.

#10 Joe123

Joe123

    Retired

  • Members

Posted 24 February 2008 - 07:01 PM

Oh right well.
Might be able to check whether Link is pressing a direction key aswell or something.

A ha.
Well yeah, when the global script section is added to sort out the smacking animation, that shouldn't be too hard to do.

That's alright, you did more than most, multiplying Link's coordinates together kept me entertained at least =P
And you did get the syntax right =P

#11 jman2050

jman2050

    Illustrious

  • Members

Posted 25 February 2008 - 03:33 AM

Geez, this is precisely the reason I added the ability to spawn weapon spites into the scripting engine. So you wouldn't have to use FFCs for that purpose.

Actually, looking at the code now, the ZScript code to create and manipulate weapon sprites doesn't even exist yet... how did I not notice this before? The ZASM is there, but no ZScropt stuff :/

#12 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 February 2008 - 10:52 AM

QUOTE(jman2050 @ Feb 25 2008, 12:33 AM) View Post

Geez, this is precisely the reason I added the ability to spawn weapon spites into the scripting engine. So you wouldn't have to use FFCs for that purpose.

Actually, looking at the code now, the ZScript code to create and manipulate weapon sprites doesn't even exist yet... how did I not notice this before? The ZASM is there, but no ZScropt stuff :/

Wait, ZASM can script weapon sprites!? I didn't know that. That changes everything. Now I just have to learn ZASM. icon_biggrin.gif

#13 Joe123

Joe123

    Retired

  • Members

Posted 25 February 2008 - 11:58 AM

QUOTE(jman2050 @ Feb 25 2008, 08:33 AM) View Post

Geez, this is precisely the reason I added the ability to spawn weapon spites into the scripting engine. So you wouldn't have to use FFCs for that purpose.

Actually, looking at the code now, the ZScript code to create and manipulate weapon sprites doesn't even exist yet... how did I not notice this before? The ZASM is there, but no ZScropt stuff :/


=O

I will love you for ever if you add that to ZScript.

#14 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 February 2008 - 01:55 PM

QUOTE(Joe123 @ Feb 25 2008, 08:58 AM) View Post

=O

I will love you for ever if you add that to ZScript.

I will too.

#15 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 25 February 2008 - 04:07 PM

QUOTE(jman2050 @ Feb 25 2008, 03:33 AM) View Post

Geez, this is precisely the reason I added the ability to spawn weapon spites into the scripting engine. So you wouldn't have to use FFCs for that purpose.

Actually, looking at the code now, the ZScript code to create and manipulate weapon sprites doesn't even exist yet... how did I not notice this before? The ZASM is there, but no ZScropt stuff :/


ZASM isn't that popular apparently, given that you can only work with numbers and such, and it has no function for comments, meaning confusion for someone who tries to edit it.
You know, you could claim that the weapon sprites' command lines was accidentally left off of Zscript and add it to the next beta.... icon_razz.gif But I don't know, it just seems to me that Zscript got cheated out of a very much relevant utility.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users