Jump to content

Photo

Trouble with 2x2 enemies


  • Please log in to reply
34 replies to this topic

#16 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 27 June 2012 - 02:56 PM

Okay so I got it all set up. I made a 2x2 enemy and set attributes 11 and 12 to -2.
But does this mean I can only have a 2x2 hitbox?

Would it be a simple edit to have separate attribute boxes for the width and height of the hitbox,
so that I could have a 2x2 enemy with a hitbox that was 24x36 pixels for example?

If I did this:

QUOTE
//Extend-only mod: negative script number sets extend
if(enemy->Attributes[11] < 0 ){
enemy->Extend = 3;
enemy->TileWidth = enemy->Attributes[10]*-1; //Attribute 11 = -width
enemy->TileHeight = enemy->Attributes[11]*-1; //Attribute 12 = -height
enemy->HitWidth = enemy->Attributes[8]*-16;
enemy->HitHeight = enemy->Attributes[9]*-16;
enemy->Misc[__GHI_IN_USE] = 1;
continue;
}


Would it work?

#17 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 27 June 2012 - 03:24 PM

You'll want to change the -16's to -1's (or positive 1's) so that you don't have to use multiples of 16, but yes, it should work.

#18 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 27 June 2012 - 07:01 PM

As soon as I set the Type to Walking Enemy the data in Misc Attr. 9 is erased,
and Misc Attr. 8 becomes Effect Strength.

(If I leave my enemy as None type, the enemy does not appear on the screen at all)

It looks like the following types of enemies don't have Misc Attr. 8 & 9:
-Walking Enemy
-Digdogger
-Patra

Is there a way I can edit it so that the enemy height and width are ALWAYS 2x2
and make Misc Attr. 10 & 11 the hitbox width and height?

If I do this will the default 1x1 enemies be affected?

EDIT: Or maybe it might be better to simply use your original script, but make everything multiples of 1?
Hmmm.. no that wouldn't work for tile width, since it's in tiles, not pixels.

If I could simply set the width and height of BOTH hitbox AND tiles in pixels...

Edited by Cukeman, 27 June 2012 - 07:03 PM.


#19 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 27 June 2012 - 07:44 PM

Actually they do have those attributes - they just have special meanings to that type.

If you want to have a type-less enemy, set it to "Other". Why do we have "None"? I don't know.

To make them always 2x2:
CODE
//Extend-only mod: negative script number sets extend
if(enemy->Attributes[11] < 0 ){
enemy->Extend = 3;
enemy->TileWidth = 2; //If Attrib 12 is negative, tile width/height is 2x2
enemy->TileHeight = 2;
enemy->HitWidth = enemy->Attributes[10]*-1; //Negative attrib 11 = width in pixels
enemy->HitHeight = enemy->Attributes[11]*-1; //Negative attrib 11 = height in pixels
enemy->Misc[__GHI_IN_USE] = 1;
continue;
}


Remember: to change tiles to pixels, change the 16 into a 1.

Edited by MoscowModder, 27 June 2012 - 07:45 PM.


#20 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 27 June 2012 - 08:59 PM

Ok so I can successfully set the hitbox on a 2x2 Walking Enemy now icon_biggrin.gif Thank you!

I do have a question though, I am setting the hitbox with Misc Attr. 11 & 12, so why does the script say 10 & 11?

Edited by Cukeman, 27 June 2012 - 09:01 PM.


#21 Moosh

Moosh

    The Mush

  • Moderators

Posted 27 June 2012 - 09:11 PM

I'm very confused about what you're trying to do here, MoscowModder, but if I understand it correctly it appears you haven't set ASkipX on the combo you're using for that ghosted enemy. Hope that helps.

#22 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 27 June 2012 - 09:22 PM

I wasn't using combos on them - just setting their hit width and height. It is working now, though.

Cuke: The Attributes[] array, as with just about everything in programming, counts from 0 up. The Attribute labels in the editor count from 1.

#23 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 27 June 2012 - 09:30 PM

QUOTE(MoscowModder @ Jun 27 2012, 07:22 PM) View Post
Cuke: The Attributes[] array, as with just about everything in programming, counts from 0 up. The Attribute labels in the editor count from 1.


Ah, I understand now.

One last thing, am I limited to 2-Frame 4-Direction animation?
If I try for 3 or 4 Frame I end up getting black tiles - I THINK
this is happening because the animation is expecting the tiles
to keep going horizontally instead of searching for them in
the next row.

#24 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 27 June 2012 - 09:45 PM

No, animations that extend to another row don't work. I've heard of other people's attempts at it.

#25 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 12 July 2012 - 06:20 PM

I love the edit you made so that all the extended enemies are 2x2 and I can edit the hitbox values instead.

Would it be possible to edit the script so that the hitbox is automatically centered in the 2x2 area?
That way I could (for instance) have an enemy with a tall hat, but the hat wouldn't deal damage to Link
if he touched it. (I'd still like to be able to edit the hitbox values the way I can now.)

Hope I'm not asking for too much.

#26 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 July 2012 - 06:31 PM

Adjust the enemy's DrawXOffset and DrawYOffset values.

#27 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 12 July 2012 - 06:46 PM

I'm afraid I don't know how to do that. Can you give me an example?

I imagine I'd need to set up a bunch of cases, something like this:
if hitbox width = 6 offset = 13
if hitbox width = 8 offset = 12

if hitbox height = 6 offset = 13
if hitbox height = 8 offset = 12

etc.

#28 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 12 July 2012 - 09:00 PM

Yeah, you'd probably want to do something like that, or set up a special case for each enemy (using enem->ID).

#29 Cukeman

Cukeman

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

  • Banned
  • Location:Hyrule/USA

Posted 13 July 2012 - 03:13 PM

Well, I am not certain what I'm doing, but I'll give it a shot.
Please let me know how badly I messed up. icon_razz.gif


QUOTE
//Extend-only mod: negative script number sets extend
if(enemy->Attributes[11] < 0 ){
enemy->Extend = 3;
enemy->TileWidth = 2; //If Attrib 12 is negative, tile width/height is 2x2
enemy->TileHeight = 2;
enemy->HitWidth = enemy->Attributes[10]*-1; //Negative attrib 11 = width in pixels
enemy->HitHeight = enemy->Attributes[11]*-1; //Negative attrib 11 = height in pixels
if(enemy->HitWidth = enemy->Attributes[10]*-1; //Negative attrib 11 = width in pixels) = 0{
enemy->DrawXOffset = 15;
}
if(enemy->HitHeight = enemy->Attributes[11]*-1; //Negative attrib 11 = height in pixels) = 0{
enemy->DrawYOffset = 15;
}

enemy->Misc[__GHI_IN_USE] = 1;
continue;
}


Once the scripting format is correct I will be happy to fill out the rest of the cases for hitbox size / offset:

0, 1, 2 = 15
3, 4 = 14
5, 6 = 13
7, 8 = 12
9, 10 = 11
11, 12 = 10
13, 14 = 9
15, 16 = 8
17, 18 = 7
19, 20 = 6
21, 22 = 5
23, 24 = 4
25, 26 = 3
27, 28 = 2
29, 30 = 1
31, 32 = 0

Edited by Cukeman, 13 July 2012 - 03:14 PM.


#30 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 July 2012 - 03:50 PM

You included an assignment (=) and a comment (//) in that if() statement. Change the red section to this:
CODE
if(enemy->HitWidth == 0 )
    enemy->DrawXOffset = 15;
if(enemy->HitHeight == 0)
    enemy->DrawYOffset = 15;



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users