Jump to content

Photo

Script Help: Hookshot rips off shield


  • Please log in to reply
22 replies to this topic

#1 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 03 November 2019 - 02:12 AM

I want it to where the hookshot can rip off (Break) enemy shields, similar to how it works in a link between worlds, the oracle games, ect.



#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 03 November 2019 - 11:23 AM

I want it to where the hookshot can rip off (Break) enemy shields, similar to how it works in a link between worlds, the oracle games, ect.

Not possible if you are using any version before 2.55.

In 2.55, you'd need to check collision of the hookshot with an enemy, and use `npc->Shield[]` to disable the shield for the given side. Or, for every side, if you want. Keep in mind that `npc->Shield[4]` is "Shield is breakable", so you'd want to check that.

 

I don't have time to write something like this, but, that's the basic stuff that needs to happen.


  • ChrisHunter64 likes this

#3 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 03 November 2019 - 04:53 PM

oh okay, im using 2.53 until 2.55 is finished. so ill deal without it. thanks.



#4 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 11 December 2019 - 12:00 PM

What if you use Hookshot Defense (Transformation) to change into Enemy, without Shield?



#5 coolgamer012345

coolgamer012345

    🔸

  • Members
  • Location:Indiana, USA

Posted 11 December 2019 - 08:58 PM

Not possible if you are using any version before 2.55.

In 2.55, you'd need to check collision of the hookshot with an enemy, and use `npc->Shield[]` to disable the shield for the given side. Or, for every side, if you want. Keep in mind that `npc->Shield[4]` is "Shield is breakable", so you'd want to check that.

 

I don't have time to write something like this, but, that's the basic stuff that needs to happen.

But can't you just use npc->BreakShield() when there's a collision with a hookshot?



#6 Orithan

Orithan

    Studying Scientist - Commission from Silvixen

  • Members
  • Location:Australia

Posted 11 December 2019 - 09:47 PM

That will work if you just want simple collision to remove the shield. But for anything more complicated you have to manually define shield directions for every enemy in the quest, which is hardly elegant



#7 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 25 December 2019 - 02:07 AM

That will work if you just want simple collision to remove the shield. But for anything more complicated you have to manually define shield directions for every enemy in the quest, which is hardly elegant

 That was my intention, i didn't want anything fancy or complex. Just to remove the shield off of an enemy with a shield when collided with the hookshot. But if its impossible to do so in 2.53, it's okay.



#8 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 25 December 2019 - 04:23 AM

The problem here is that hookshotting them in the back would take the shield off of their front; which is probably a bit odd. In 2.55, you can check every side for a shield separately, and remove them side-by-side; so you could have an enemy shielded on all 4 sides, and when you hit it with the hookshot, it takes the shield off of only the side that you hit it from. But, 2.53 can't do that.



#9 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 25 December 2019 - 01:14 PM

The problem here is that hookshotting them in the back would take the shield off of their front; which is probably a bit odd. In 2.55, you can check every side for a shield separately, and remove them side-by-side; so you could have an enemy shielded on all 4 sides, and when you hit it with the hookshot, it takes the shield off of only the side that you hit it from. But, 2.53 can't do that.

I can work with the odd method.

Edited by RephireZeKasual217, 25 December 2019 - 03:44 PM.


#10 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 29 December 2019 - 04:58 AM

I got it to Somewhat work, the problem is that it seems to only break the shield when hit by only the handle, is there a way to get it to break it via the head of the hookshot?

 

 

item script HookshotSB{
void run(){   
int n; npc enemy;
for ( n = 1; n <= Screen->NumNPCs(); n++ ) {
enemy = Screen->LoadNPC(n);
                if ( Collision(enemy) && GetNPCMiscFlag(enemy, NPCMF_HAMMERBREAKS) ){
                        enemy->BreakShield();
}
}
}
}

Edited by RephireZeKasual217, 29 December 2019 - 05:00 AM.


#11 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 29 December 2019 - 06:32 AM

err, you are't loading the lweapon anywhere? I don't see you checking collision with the hookshot anywhere at all.



#12 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 29 December 2019 - 03:49 PM

item script HookshotSB{
void run(){   
int n; npc enemy;
for ( n = 1; n <= Screen->NumNPCs(); n++ ) {
enemy = Screen->LoadNPC(n);
                if ( Collision(LW_HOOKSHOT, enemy) && GetNPCMiscFlag(enemy, NPCMF_HAMMERBREAKS) ){
                        enemy->BreakShield();
}
}
}
}
Here you go.
Idk why, but it seems to be less consistent with it though.

Edited by RephireZeKasual217, 29 December 2019 - 04:17 PM.


#13 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 29 December 2019 - 04:21 PM

LW_HOOKSHOT isn't a weapon, it's a weapon TYPE

You need to actually find the hookshot weapon on-screen, with `Screen->LoadLWeapon()`, and then check collision

 

In fact, I'm almost certain that the code you just posted shouldn't even compile; `Collision(int, npc)` isn't a function. Collision either needs one object type (which checks if that object is colliding with Link) or two object types (which checks if they are colliding with each other). 


Also, please use code tags when you are posting code. (The little '<>' symbol in the post editor)



#14 RephireZeKasual217

RephireZeKasual217

    Initiate

  • Members

Posted 29 December 2019 - 04:49 PM

I honestly don't know how its compiling. the first one works to some extent, and the second one is inconsistent.


and as for the lweapon situation do i set it up like this? Where do i go from here, or am I just wrong entirely? baby steps i guess.

item script HookshotSB{

void run(){   
int n; npc enemy; lweapon hookshot;
for ( n = 1; n <= Screen->NumNPCs(); n++ ) {
enemy = Screen->LoadNPC(n);
                        hookshot = Screen->LoadLWeapon(20);
                if ( Collision(hookshot, enemy) && GetNPCMiscFlag(enemy, NPCMF_HAMMERBREAKS) ){
                        enemy->BreakShield();
}
}
}
}


#15 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 29 December 2019 - 04:55 PM

lweapon hook;
for(int q = 1; q <= Screen->NumLWeapons(); ++q)
{
    lweapon l = Screen->LoadLWeapon(q);
    if(l->Type == LW_HOOKSHOT)
        hook = l;
}
if(hook->isValid())
{
    for(int q = 1; q <= Screen->NumNPCs(); ++q)
    {
        npc n = Screen->LoadNPC(q);
        if(Collision(n, hook))
            n->BreakShield();
    }
}

Something like this.


  • ShadowTiger likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users