Jump to content

Photo

ghost.zh


  • Please log in to reply
645 replies to this topic

#526 Yloh

Yloh

    My Face!!!

  • Members
  • Real Name:Michael
  • Location:Mike's Fun House

Posted 01 May 2016 - 11:27 AM

IT WORKS!!!! I really appreciate your time and patience Lejes. You have been a great help.



#527 Avaro

Avaro

    >w<

  • Members

Posted 05 May 2016 - 12:16 PM

I've been scripting a 2x2 sized patra in ghost.zh and I need help with one thing. So far I got everything to work correctly. The only problem is that the patra kids will always face up even though I enabled the 8 way flag. Apparently if you set Ghost_X and Ghost_Y to move an enemy it won't change the direction of the enemy accordingly. What would be a way to do it? Here's my script:

 

Spoiler

Edited by Avataro, 05 May 2016 - 12:35 PM.


#528 Saffith

Saffith

    IPv7 user

  • Members

Posted 05 May 2016 - 05:41 PM

I'd say just set it along with the position. You could simplify the angle handling, too.
        int angleOffset=(ghost->Misc[1]-1)*45;
        while(true){
            Ghost_X = GetEnemyProperty(Screen->LoadNPC(1), ENPROP_X)+8 + 36*Cos(Screen->D[0]+angleOffset);
            Ghost_Y = GetEnemyProperty(Screen->LoadNPC(1), ENPROP_Y)+8 + 36*Sin(Screen->D[0]+angleOffset);
            Ghost_Dir = AngleDir8(WrapDegrees(Screen->D[0]+angleOffset-90);
            Ghost_Waitframe(this, ghost, true, true);
        }

  • Avaro likes this

#529 ywkls

ywkls

    Master

  • Members

Posted 15 May 2016 - 12:34 AM

Here's some things I think would be useful, since no easy method of doing this exists that I'm aware of.

 

A command that would make a ghosted enemy move towards a specific set of coordinates- There are times when I want to make a foe go from wherever it is to somewhere else. I often have to rely on workarounds like calculating the distance between it's location and the desired end point; which doesn't always work out.

 

Ghosted Enemies Can Only Be Seen By Lens of Truth- What would it take to do this? I believe ghost.zh displays enemies of larger sizes mostly by creating an ffc at the location of the enemy and setting that ffc's combo to whatever you put in the code; then changing the size as needed. Flags exist now for things like the amulet, so why not the lens?

 

These are all I can come up with for the moment, but I'm sure that more things which ghost.zh can't do easily at the moment exist.


Edited by ywkls, 15 May 2016 - 12:34 AM.


#530 Saffith

Saffith

    IPv7 user

  • Members

Posted 15 May 2016 - 11:38 AM

A command that would make a ghosted enemy move towards a specific set of coordinates

Ghost_MoveAtAngle(step, Angle(Ghost_X, Ghost_Y, targetX, targetY));
 

Ghosted Enemies Can Only Be Seen By Lens of Truth- What would it take to do this?

if __GH_USE_DRAWCOMBO is disabled, set this->Flags[FFCF_LENSVIS]=true. Otherwise, the only way to do it is to set the lens effect in screen data. That would require knowing what layer it'll be drawn on (normally 2), and it would apply to all ghosted enemies on the screen.
  • ywkls likes this

#531 ywkls

ywkls

    Master

  • Members

Posted 15 May 2016 - 01:16 PM

Ghost_MoveAtAngle(step, Angle(Ghost_X, Ghost_Y, targetX, targetY));
 
if __GH_USE_DRAWCOMBO is disabled, set this->Flags[FFCF_LENSVIS]=true. Otherwise, the only way to do it is to set the lens effect in screen data. That would require knowing what layer it'll be drawn on (normally 2), and it would apply to all ghosted enemies on the screen.

That first one I think I can use...

 

Doesn't disabling that constant have the potential of interfering with other stuff?

 

Also, how would you use the screen data to affect things? I know that it can cause the lens to reveal things on different layers but I'm not sure how that would work in this instance.

 

For the moment, I'm just creating a scripted lens that draws combos at the enemy's location by reading the attributes of the enemy; then storing the actual combo data for the enemy in a different attribute than normal while making the ffc's data the invisible combo.



#532 Saffith

Saffith

    IPv7 user

  • Members

Posted 15 May 2016 - 06:39 PM

Also, how would you use the screen data to affect things? I know that it can cause the lens to reveal things on different layers but I'm not sure how that would work in this instance.

It also affects script drawing commands.

For the moment, I'm just creating a scripted lens that draws combos at the enemy's location by reading the attributes of the enemy; then storing the actual combo data for the enemy in a different attribute than normal while making the ffc's data the invisible combo.

If you're already using a scripted lens, I'd say keep using it. Rather than changing the combo, you could set the enemy's draw offset so that it's drawn offscreen. That way, there's no need to keep track of the combo
  • ywkls likes this

#533 ywkls

ywkls

    Master

  • Members

Posted 15 May 2016 - 07:19 PM

Well, I wasn't using a scripted lens; but it seemed like the best way to solve the problem.

 

Anyways... I was trying to add some variety to a boss by giving it some options when it came to behavior. Before, I was using Ghost_MoveXY; but for some reason whenever I changed the position that the boss spawned at it got stuck in the wall.

 

Then I switched to Ghost_MoveTowardLink, but now things aren't working as planned.

 

Here's some example code.

Ghost_MoveTowardLink(ghost->Step/100, 0);
if(Ghost_X>PrevX)
     fake->X--;
else
      fake->X++;
PrevX = Ghost_X;
if(Ghost_Y>PrevY)
     fake->Y--;
else
     fake->Y++;
PrevY = Ghost_Y;

The script creares a fake copy of the boss at the opposite side of the room from the real one. The idea was that if the boss moved left; the copy would move right and if it moved right; the copy would move left. Or if it moved down, the copy would go up and if up, the copy would go down.

 

However, the copy is shooting off at a tangent across the room instead. Any idea what's causing this or how to fix it?


Edited by ywkls, 15 May 2016 - 07:19 PM.


#534 Saffith

Saffith

    IPv7 user

  • Members

Posted 15 May 2016 - 07:29 PM

Well, I wasn't using a scripted lens; but it seemed like the best way to solve the problem.

Oh, okay. The thing is, it's difficult if not impossible to tell reliably when the lens is active. A script made for a specific quest might be doable, but a general-purpose one is out of the question.
 

However, the copy is shooting off at a tangent across the room instead. Any idea what's causing this or how to fix it?

I'm guessing it's that the position is adjusted by one pixel at a time, even though the change in Ghost_X and Ghost_Y may be much less than that. You could use separate variables to track the fake one's position.
Ghost_MoveTowardLink(ghost->Step/100, 0);
fakeX+=prevX-Ghost_X;
fakeY+=prevY-Ghost_Y;
fake->X=fakeX;
fake->Y=fakeY;
prevX=Ghost_X;
prevY=Ghost_Y;
Or you could work out the relationship mathematically.
fake->X=240-Ghost_X;
fake->Y=160-Ghost_Y;


#535 ywkls

ywkls

    Master

  • Members

Posted 15 May 2016 - 07:34 PM

Oh, okay. The thing is, it's difficult if not impossible to tell reliably when the lens is active. A script made for a specific quest might be doable, but a general-purpose one is out of the question.

 

Mine relies on two things... first, if you're pressing the button. I've got it devoted to B, but using either wouldn't be too hard.

 

Second, if you have enough MP to use it still. If not, it ends. It's actually pretty neat, working on regular enemies that are invisible and if using ghost.zh; able to display them too without too much trouble. I was actually considering submitting it to the database. But I'd kind of need an enemy to go with it, so I'm holding off until I develop one.



#536 Saffith

Saffith

    IPv7 user

  • Members

Posted 13 June 2016 - 02:15 PM

Can we get this library added to the script database? I mean, I see no reason as for why it shouldn't.

You know, I don't really know why I haven't done that. Just a habit held over from before there was a database, I guess. Maybe I'll add it next time I update something.
  • Mani Kanina and Alucard648 like this

#537 ywkls

ywkls

    Master

  • Members

Posted 24 June 2016 - 05:30 PM

Here's something I think I'd like to see. (I could probably write this up myself, given a few days, but I'm not familiar enough with the internal workings of ghost.zh to know that I'd succeed.)

 

Right now, you can change the appearance and even the size of an enemy by using Ghost_AddCombo. However, any combos that are added with this method don't actually damage you if you run into them.

 

So, what's the best way to go about making that possible?



#538 Saffith

Saffith

    IPv7 user

  • Members

Posted 01 July 2016 - 07:21 PM

Make an additional invisible enemy for each piece and keep them lined up. I don't think that's something I'll add in; it'd be a lot harder to handle in the library than in individual scripts.

#539 ywkls

ywkls

    Master

  • Members

Posted 01 July 2016 - 07:40 PM

Make an additional invisible enemy for each piece and keep them lined up. I don't think that's something I'll add in; it'd be a lot harder to handle in the library than in individual scripts.

 

That's what I was doing, before I discovered Ghost_AddCombo. Now, I'm detecting whether Link walks within the boundaries of the drawn combo at any time and if so, spawning an invisible eweapon at his location for one frame.



#540 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 05 July 2016 - 06:57 PM

Out of curiousity, why are ghost and ffcscript separate files rather than placed in the imported script file itself?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users