Jump to content

Photo

Crow enemy


  • Please log in to reply
22 replies to this topic

#1 Jenny

Jenny

    Hero of Time

  • Contributors
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 28 February 2012 - 03:57 PM

I would like a script for an enemy that acts like the crows from A Link to the Past, any help would be appreciated. icon_smile.gif

Edited by Dragonite, 28 February 2012 - 03:57 PM.


#2 aaa2

aaa2

    Wizard

  • Banned

Posted 28 February 2012 - 04:36 PM

Can you maybe describe its behaviour appropriately like how they suggest it in this thread http://www.purezc.co...showtopic=41233
If you can i might be able to help you. Otherwise i have no idea what that enemy does.

#3 Jenny

Jenny

    Hero of Time

  • Contributors
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 28 February 2012 - 04:49 PM

The enemy stays on trees, then when you walk by it, it charges towards you.

#4 Saffith

Saffith

    IPv7 user

  • Members

Posted 28 February 2012 - 05:02 PM

I've got one (not exactly the same as LttP, but close). It wasn't really written for general use, but it's usable. It's a ghost.zh script, but it requires setting up the FFCs manually. If that's okay, here it is:

CODE
const int NPC_CROW=0;
const int SFX_FLUTTER=0;

ffc script Crow
{
    void run()
    {
        npc ghost=Ghost_InitWait2(this, NPC_CROW, false, GHF_NO_FALL|GHF_IGNORE_ALL_TERRAIN);
        int baseCombo=Ghost_Data;
        Ghost_SpawnAnimationPuff(this, ghost);
        
        while(Distance(Link->X, Link->Y, Ghost_X, Ghost_Y)>56)
        {
            if(Link->X>Ghost_X)
                Ghost_Data=baseCombo+1;
            else
                Ghost_Data=baseCombo;
            Ghost_Waitframe(this, ghost, true, true);
        }
        
        float idealAngle;
        float idealXVel;
        float idealYVel;
        float xVel=0;
        float yVel=0;
        
        Ghost_SetFlag(GHF_KNOCKBACK_4WAY);
        Ghost_Data+=2;
        Game->PlaySound(SFX_FLUTTER);
        
        for(int i=0; true; i++)
        {
            if(xVel>0)
                Ghost_Data=baseCombo+3;
            else
                Ghost_Data=baseCombo+2;
            
            Ghost_X+=xVel;
            Ghost_Y+=yVel;
            
            Ghost_Waitframe(this, ghost, true, true);
            
            if(i<300)
            {
                idealAngle=ArcTan(Link->X-Ghost_X, Link->Y-Ghost_Y);
                idealXVel=2*RadianCos(idealAngle);
                idealYVel=2*RadianSin(idealAngle);
            }
            
            if(idealXVel<xVel)
                xVel=Max(xVel-0.03, idealXVel);
            else
                xVel=Min(xVel+0.03, idealXVel);
            
            if(idealYVel<yVel)
                yVel=Max(yVel-0.03, idealYVel);
            else
                yVel=Min(yVel+0.03, idealYVel);
        }
    }
}


Uses four combos:
1: Standing, facing left
2: Standing, facing right
3: Flying, facing left
4: Flying, facing right

Place the enemy, place the FFC, and set its "Draw Over" and "Run Script at Screen Init" flags.

#5 Jenny

Jenny

    Hero of Time

  • Contributors
  • Real Name:Jennette
  • Pronouns:She / Her

Posted 28 February 2012 - 05:24 PM

....I'm a bit confused about how to set this up...

#6 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 28 February 2012 - 06:04 PM

It's really simple, actually (as far as I can tell). Just compile the FFC script, create an invisible crow enemy with the right stats, and create 4 animated combos of the crow facing each direction in the order standing left, standing right, flying left, flying right.

Next, place one FFC per crow enemy with the FFC's data set to the standing/facing left combo. Set the FFC's "Draw over" and "Run at screen init" flags and you should be good to go.

#7 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 28 February 2012 - 08:33 PM

i had about 20 compile errors when i tried it saying nothing was declared.

And when i tried to int ghost_initwait it still said error.

Edited by tox_von, 28 February 2012 - 08:36 PM.


#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 28 February 2012 - 08:48 PM

Chances are you forgot to include both std.zh and ghost.zh (which needs to be downloaded separately from here).

#9 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 28 February 2012 - 10:10 PM

yeah but i did that then got another error ghost.zh line 336 printf not declared.

Doesnt zc use drawstring not printf from c++? And i also wanted to know how drawstring works.

#10 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 28 February 2012 - 10:14 PM

You'll also need to import string.zh in order to use ghost.zh. String.zh comes with ZC though, so you're good there. icon_smile.gif

#11 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 28 February 2012 - 10:27 PM

QUOTE
Uses four combos:
1: Standing, facing left
2: Standing, facing right
3: Flying, facing left
4: Flying, facing right

Place the enemy, place the FFC, and set its "Draw Over" and "Run Script at Screen Init" flags.



Where does this need to be done? and what does placing the enemy mean like setting a eg enemy1 or something else.

Edited by tox_von, 28 February 2012 - 10:28 PM.


#12 Saffith

Saffith

    IPv7 user

  • Members

Posted 28 February 2012 - 11:21 PM

You add four consecutive new combos to the combo list and set up an FFC using the first one.
In addition to the FFC, you place the enemy on the screen the same way as a normal one.

#13 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 28 February 2012 - 11:37 PM

Where is there a combo list and how do i put them to enemys?

When i placed the ffc all it did was disappear and placing enemy1 didnt do anything i dont think.

#14 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 28 February 2012 - 11:40 PM

The combo list is the same combo sheet you place combos from normally. Basically, you just have to create the 4 combos mentioned above, and set the FFC to the first.

I think you have to set the enemy's unique ID to the constant NPC_CROW.

#15 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 29 February 2012 - 01:22 AM

how do you set the enemys id

is it ghost-> = NPC_CROW?

is that what you mean.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users