Jump to content

Photo

Shield can "push away" (block) enemies


  • Please log in to reply
5 replies to this topic

#1 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 15 April 2011 - 04:57 AM

Heyho. icon_smile.gif
Is there a way that your Shields also block enemies themselves (not only their attacks), like in Link's Awakening and the other Game Boy games?
I want this function, because I use the GBshield-globalscript.
Is it possible (and not too difficult) for someone of you, to make a itemscript for the shields in that way?

Thank you for your answers. icon_biggrin.gif


(sorry for my bad english)

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 15 April 2011 - 07:55 AM

Here is an idea for willing coders:

CODE
(Psuedocode)
if (Link->Dir==DIR_RIGHT){
  if ({enemy}->X == Link->X + 9){
    {enemy}->X = Link->X + 10
    }
  }
And so on...

Edited by MoscowModder, 15 April 2011 - 07:55 AM.


#3 lucas92

lucas92

    Defender

  • Members

Posted 15 April 2011 - 09:08 PM

It's actually not that simple MoscowModder...

The idea is to check whether Link touches an npc or a eweapon while using the shield, then making him move backward depending on his direction, while making sure Link doesn't end on solid combos.

I might take a deeper look into it tomorrow, but now I got to sleep.

#4 Zeldaman23

Zeldaman23

    Darkie & Dhane

  • Members
  • Real Name:Bradley Dotson

Posted 15 April 2011 - 09:47 PM

That pretty hard to make that to push enemy away. I have no idea how to do it myself because I never make a quest.

#5 lucas92

lucas92

    Defender

  • Members

Posted 16 April 2011 - 08:12 PM

Zeldaman23: I would suggest not to post in a scripting request topic unless your post can actually help the topic author.

Anyway, try this one:
CODE
const int LINK_MISC_SHIELD     = 0;
const int LINK_SHIELD_SOUND = 45;
const int LINK_SHIELD_ID    = 90;
item script GB_shield
{
    void run(int equip_sound)
    {
        Link->Misc[LINK_MISC_SHIELD] = !Link->Misc[LINK_MISC_SHIELD];
        Game->PlaySound(equip_sound);
    }
}
global script activeScript
{
    void run()
    {
        Link->Misc[LINK_MISC_SHIELD]     = 0;
        float previous_hp                 = Link->HP;
        int previous_action             = Link->Action;
        while(true)
        {
            if(Link->Misc[LINK_MISC_SHIELD] && Link->HeldItem == LINK_SHIELD_ID)
            {
                float previous_hp     = Link->HP;
                int previous_action = Link->Action;
                                Link->InputA = false;

                Waitdraw();
                
                if(Link->HP < previous_hp && (Link->Action == LA_GOTHURTLAND || Link->Action == LA_GOTHURTWATER ) )
                {
                    Link->HP         = previous_hp;
                    Link->Action     = previous_action;
                    Game->PlaySound(LINK_SHIELD_SOUND);
                }
            }
            else
                Link->Misc[LINK_MISC_SHIELD] = 0;
            Waitframe();
        }
    }
}


I'm too tired to test this now... :S

EDIT- Hmm, this one is not pushing Link, but making him invincible while not be able to put out his sword... Aww it's not that easy... icon_frown.gif

#6 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 18 April 2011 - 05:00 AM

Thank you. icon_smile.gif
But I get an error on this line:
QUOTE
Link->Misc[LINK_MISC_SHIELD] = !Link->Misc[LINK_MISC_SHIELD];


Pass4: Error T17: "Cannot cast from bool to float"


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users