PDA

View Full Version : Detecting the Combo where Link is standing



Joe123
11-14-2007, 06:49 PM
I had a pit script. Worked very nicely. However, it worked when Link was within a certain 'box'.

I thought it would be better to set it to work on a said screen, when Link walked on a certain combotype (Left Statue it happened to be).

I used:

if(Screen->ComboT[ComboAt(Link->X, Link->Y)] == 11){etc;}

However, this happens the moment Link's first pixel touches the pit, which is obviously undesirable because it basically results in him 'falling' into the tile one below the actual pit.

Is there an easy way of remedying this? I've been adding a lot of scripts to combotypes recently, and this is an incredibly large flaw.

C-Dawg
11-14-2007, 08:48 PM
Sure. Change the way the game checks for ComboAt. I'm not sure how the zh.std version works. The soft version that I've been using checks for the nearest tile, so it shouldn't trigger till you're at least half on top of it.

Alternatively, you could do some complicated logic checking: (1) the combos on all eight sides of the player, and (2) Link's distance from each one. Perhaps get the location of the eight combos around him (this involves Link's location modulus 16) and then get his distance to them, then act accordingly.

Joe123
11-15-2007, 03:48 AM
How would I do these though?
I don't understand how ComboAt works really, just that it does. This would be partly because I don't understand what 'return' does, or what a single ampersand does, or what two greater than signs in a row does, so obviously I wouldn't be able to modify it very easily. Could I have your version please?

And I haven't covered modulus in maths at school yet, I think it might be in a later module on my A level course (or I'm just getting confused) but either way, I wouldn't know how it that way.

Joe123
11-17-2007, 03:56 PM
C-Dawg?
Someone?
Please?

I don't understand how to do it myself or I would do.

DarkDragon
11-17-2007, 05:18 PM
Add an offset to the X, Y coordinates you're checking for.
For instance, use Link->X+8, Link->Y+8 to check Link's center instead of top-left corner.
Or maybe you want Link->X+8, Link->Y+15 to check the middle of Link's feet.

Play around with it until you get offsets you like.

Joe123
11-17-2007, 06:06 PM
Ugh, I feel really stupid now.
All it did was refernce the top left pixel of Link's sprite, and I just had to set it to not do that. I was thinking it worked different, but a single (X,Y) coordinate has to just be one pixel.

Well thanks anyway :)