PDA

View Full Version : Sparkle sprites



Gleeok
06-16-2008, 04:16 PM
Is it possible to create arrow or boomerang weapons that act just like non-scripted versions with sparkles?

Anyone done this yet?

ScaryBinary
06-20-2008, 07:46 PM
**EDIT**
Don't waste your time reading this post! Scroll down!
**EDIT**

...OK, I don't understand what you're asking. I thought I had an answer for you, then I read your question again, and then I realized that I was waaaaay off (at least I think). :rolleyes:

So...you just want to create an arrow LWeapon? How do the sparkles fit in? My scripted arrows have sparkles (on impact)....?

I ran a little experiment, and it looks like when you use CreateLWeapon(LW_ARROW) what you get is the "Arrow 1 (Wooden)" item. Are you trying to get a different arrow?

Joe123
06-20-2008, 07:54 PM
Silver arrows and Gold arrows have a little trail of sparklies that follow them across the screen.

ScaryBinary
06-20-2008, 09:26 PM
Silver arrows and Gold arrows have a little trail of sparklies that follow them across the screen.

Ah....I see.

Then then for the wooden arrow, set the Sparkle Spite to the "MISC: Arrow 2 (Silver) Sparkle" or the gold one. I tried that and it worked.

Kind of screws up your wooden arrows though, so again I think you'd have to create a custom arrow item that was a copy of the original wooden arrow.

The issue (or at least *my* issue ) is that it seems the LW_ARROW value always spawns the Arrow 1 (Wooden) arrow. I don't know of any way to have the CreateLWeapon() method spawn a custom item, or a particular level of an item (like spawning a silver arrow instead of the wooden one)....There doesn't seem to be any relation between the value passed to CreateLWeapon() and the item that is spawned (for example, LW_ARROW is 8, and the Arrow 1 (Wooden) item is Item 13). So I think you're stuck spawning only the items allowed by the Great Developers.

*EDIT*
Interesting...I think, for arrows at least, you automatically spawn the level of weapon you have when you call CreateLWeapon? I started a quest with the gold arrow, and using CreateLWeapon(LW_ARROW) gave me the gold arrow - sparkles and all.

O_O So it seems like you could create a custom arrow weapon, readjust the levels of the various arrows a bit, and somehow end up spawning your custom arrow using the LW_ARROW value...?

Sorry this is all so jumbled up Gleeok. I'll try to go back and edit this a bit to clean it up.....later.

Joe123
06-21-2008, 04:48 AM
Yes; when you spawn an LWeapon, you spawn the level of LWeapon you currently have.

Gleeok
06-21-2008, 07:41 PM
Ah....I see.

*EDIT*
Interesting...I think, for arrows at least, you automatically spawn the level of weapon you have when you call CreateLWeapon? I started a quest with the gold arrow, and using CreateLWeapon(LW_ARROW) gave me the gold arrow - sparkles and all.

Wait, so you got it to work? Did the sparkles follow the arrow at angles also?

Shit, I'll try it yet again...my problem might be something simple, like item properties or whatnot.

ScaryBinary
06-22-2008, 07:36 AM
Wait, so you got it to work? Did the sparkles follow the arrow at angles also?

Sorry, I didn't try any weird angles, but the sparkles worked for up, down, left, and right.... All I did was create a new quest, and in the Init Data gave link gold arrows (you don't actually have to give him any amount, just make sure they're checked in the Equipment tab). Then I had a simple script that just spawned an LW_ARROW.

I'll experiment a bit more post my script and results here in a minute.

*EDIT*
OK, I get sparkles with weird angles (really weird angles - apparently I don't quite understand the weapon->Angle property yet....but it worked well enough to prove a point). See pics below. I did find a limitation - originally I had intended to spawn three arrows. The spawning part worked, but only one of the arrows had sparkles at any given time. For example, if the arrow that had sparkles went off-screen, another arrow on-screen would suddenly get sparkles until it went off-screen, etc. So it seems like the engine can only render one sparkle trail at a time? Also note I didn't "flip" the tile appropriately.

http://img145.imageshack.us/img145/7146/zelda003ka9.th.png

Here's my crappy test script. I had to comment out two of the arrows because of the sparkle anomaly noted above. Also my angles were a bit odd, but you get the idea. Don't forget to equip Link with a silver or gold arrow in the Init Data. The FFC script accepts an LW_ constant as the D0 argument (I used 8.0000, which is LW_ARROW).

import "std.zh"

ffc script Test_LWeapon{
void run(int LWeaponToCreate){

lweapon LW_0;
lweapon LW_p45;
lweapon LW_n45;

while(true){

if ( Link->InputA ){
// Spawn 3 projectile weapons. One in Link's "major" direction,
// and then two more offset by +45 and -45 degrees.
if ( Screen->NumLWeapons() == 0) {
//LW_0 = Screen->CreateLWeapon(LWeaponToCreate);
//LW_p45 = Screen->CreateLWeapon(LWeaponToCreate);
LW_n45 = Screen->CreateLWeapon(LWeaponToCreate);

// LW_0->X = Link->X;
// LW_0->Y = Link->Y;
// LW_p45->X = Link->X;
// LW_p45->Y = Link->Y;
LW_n45->X = Link->X;
LW_n45->Y = Link->Y;

// Let the game engine handle most of the computations.
// LW_0->DeadState = -1;
// LW_p45->DeadState = -1;
LW_n45->DeadState = -1;

// Figure out directions and angles.
// Make sure the weapon is oriented properly.
// THE FOLLOWING ASSUMES THE CLASSIC TILESET.
// LW_0->Dir = Link->Dir;
// LW_p45->Dir = Link->Dir;
LW_n45->Dir = Link->Dir;
// LW_p45->Angular = true;
LW_n45->Angular = true;
if(Link->Dir == DIR_LEFT){
// LW_0->Angle = 180;
// LW_p45->Angle = 225;
LW_n45->Angle = 135;
}
else if(Link->Dir == DIR_UP) {
// LW_0->Angle = 90;
// LW_p45->Angle = 135;
LW_n45->Angle = 45;
}
else if(Link->Dir == DIR_DOWN) {
// LW_0->Angle = 270;
// LW_p45->Angle = 315;
LW_n45->Angle = 225;
}
else if(Link->Dir == DIR_RIGHT) {
// LW_0->Angle = 0;
// LW_p45->Angle = 45;
LW_n45->Angle = 315;
}

} // NumWeapons == 0
} // InputA

Waitframe();

} // Inf Loop
}
}