Oh, hey, how did I miss that? That's one problem down. Well, if I can't get them to reverse direction mid-stream, I may have to scrap the idea, though. It just looks wrong. A TK skill isn't terrible, even if it's not as cool.
if ( l->DeadState == WDS_BOUNCE ) //Set a return tile.
Try that.
You should also know, that you can set other tile rotation and flip values.
Here are the values from std.zh ( try looking at std.zh for 2.54, to see all the new goodies).
Flip Values
I would probably need to examine the quest itself to determine what it is doing, or not doing and what it needs to do.
If you are just changing the o.tile, you can likely do this far more simply by setting:
falcon->OriginalTile = FALCON_TILE_BASE;
//Do not manually set flip for o.tile.
If you arrange your falcon tiles precisely as boomerang tiles are arranged, then you should not need to set the flip values at all. You need those when you are setting l->Tile or l->UseSprite. You need these for weapons that do not have internal sprite rotation, or flipping. Of course, if yo want to avoid the spinning animation, then you want to set these properties, rather than o.tile.
Changing the flip and rotation in conjunction with OriginalTile is likely the culprit here.
Please read all of my notes. Your use of int index as a variable identifier is a potentially bad idea, although in this instance, it is not as bad as if it were a global variable, as it is scoped.
More important is that you have arrays with a size of 13, and you are checking indices 0 to 11 of each. (I am not sure if this is intentional.)
I would replace each instance of 'index' in those loops and array calls with ffc_follower_index, and I would verify that you never need to read index 12 in those loops. If you do, then change < 12 to to < 13.
You can also use decrement loops and SizeOfArray() as follows:
for ( int q = SizeOfArray(arr_id); q >= 0; q-- ) {
arr_id[q] += foo;
}
This reads them backwards, mind. If you must read them forward, then it is faster (more efficient) to set a var to the array size.
Let me know if this makes sense to you.
Another Pro Tip: Get rid of all of those individual global vars, and make one array for them with some accessors. Your game is complex, and it is likely to need quite a lot of those in the end, and it is best to plan ahead.
Add this to your script file:
That is a generic global array and four basic accessors for it. You can make dedicated accessors for specific values too, which increases readability.
Damn you ZScript...
Well it was to good to be true. I'll be back after changing a few hundred lines of code.
This will likely be fixed for 2.54 and above. Gray has been working on it. My pro tip is to make a nest of if statements, using the most common denominator, or, in this case, you can just do if/else as:
for ( int q = Screen->NumLWeapons(); q > 0 q-- ) {
lweapon l = Screen->LoadLWeapon(q);
if ( !globalCondition ) { break; }
if ( q->ID != weapon_type ) { continue; } //short circuit
if ( q->Misc[n1] != n2 ) { continue; }
//Otherwise it matches, so do things here.
}
That is an alternative to nested if statements. Otherwise, just follow the format that I used in the post.
Edited by ZoriaRPG, 25 May 2017 - 11:21 AM.