PDA

View Full Version : Since we have Item Scripts now... (Item Request)



Nimono
01-11-2007, 08:04 PM
I just noticed that Beta 16b allows us to attach scripts to items! Yay! I'm assuming the scripts will only activate when the item is used, but just in case it isn't, I'd appreciate a piece attached to my request that prevents the function from happening until the item is used. Anyways, my request...

Because of scripts, I take it it'd be possible to make a certain combo spawn 2 tiles in front of you in the direction you're facing when the script activates? And then destroy the combo and either spawn magic going in 4 directions or simply place it 2 tiles away from you in whatever direction you're facing? In other words, a Cane of Somaria script. And remember, it functioned differently in both LttP and OoA. If BOTH scripts are possible (one that removes said combo if it's already on the screen and spawns Magic (not enemy Magic) going in 4 directions, and one that removes said combo if one is already on-screen when the Cane is used and places it in the new location), I'd like them both. Out of the little Scripting knowledge I have, I'm sure you could remove the combo by first checking to see if a combo of the same ID is already present, but as for removing it... I have no idea if you can make push blocks work on Layers 1 and 2, or if the push flags will work inherently. If so, then that'd make it easier, as you could just place Combo 0 (Which SHOULD be a "transparent" combo) on its location. Sigh... I'm rambling. You get the idea. (Oh yeah, if you see any spelling errors, just ignore it- It's VERY hard to type using a laptop keyboard...)

CJC
01-11-2007, 11:01 PM
Well, you could 'make' the block by putting a FFC off-screen, and then having the item's script move it to a position in relation to Link's current position and facing (Probably 32 pixels or so.)


I don't know if you'd be able to interact with it, though, even if it was a push-block. And there would probably have to be some other conditions to prevent you from making blocks on solid locations.



....I could probably handle the AlttP version (Make a block, swing again and it makes another block), but I'm not going to try just yet. Maybe someone else has a little better advise on how to handle a script like this.


But if you want me to, I'll try my best. Maybe I can lay out a groundline for better scripters to work off of.


EDIT: Hmmm... if you select a pushblock as the FFC to which this script would apply, would it be out of the park to assume that said pushblock would obey normal rules of walkability? So there wouldn't need to be walk-flag checks in the script itself to avoid pushing the block over walls... feasibly that would make the script very easy (If you put a Sumaria block on a wall, you'll just have to swing the wand again.)
I'm not exactly sure how the item script ties to the FFC, though, so you'll have to wait on that a bit.

Nimono
01-11-2007, 11:16 PM
FFCs can't use normal walkability, so that won't work AT ALL. I want it to spawn a COMBO. Though, I'll have to play both LttP and OoA again, because I can't remember if the block spawns in front of the cane or at the exact grid square the cane was at last. XD But what to do if Link isn't ON the grid? :confused:

The_Amaster
01-11-2007, 11:20 PM
I think I remember, in OoA, the block appeared at the tip of the cane, and if Link was off grid, it closely aproximated the on-grid position.

itsyfox
01-12-2007, 12:00 AM
You can still get an exact nearest tile location...I figured this out by looking at the ComboAt() function that's now part of std.zh.

One of them says return X & 224;

But I didn't know how to use bit math yet. So I looked it up and learned.

224 is, in binary, all the flags for 16, 32, 64, and 128. But not 8, 4, 2, or 1. So basically, after the & operation, it'll ONLY keep numbers that are in BOTH numbers when converted to binary, or in other words, no value that isn't a multiple of 16. If you do this for both x and y, you can get the exact location of the nearest upper-left corner (the identifying corner) of a tile on screen.

C-Dawg
01-13-2007, 07:28 PM
FFCs can't use normal walkability, so that won't work AT ALL.

FFCs can simulate walkability. Don't get your panties in a bundle.

Nimono
01-13-2007, 07:31 PM
FFCs can simulate walkability. Don't get your panties in a bundle.

I know that, but wouldn't that mean you couldn't push them? That's what I need the Somaria Block to do. In fact, it'd require its own script if it had to be an FFC!