Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Creating a combo with a script

5 replies · 1,629 views · Started 08 October 2007

How do I go about doing this? I only really want to apply combo types (autowarp, sens. perm trigger etc) to the tile below link (well, to anywhere in the case of autowarp), so how would I go about doing this? I couldn't really glean much info from zscript.txt about said topic.

Well, depending on what you want to do, you can do this in two ways.

This script will change the combo of an FFC and stick it below the player:

this_ffc->Data=(whatever_combo_you_want);
this_ffc->X = Link->X;
this_ffc->Y = Link->Y;

If you actually want to draw a combo on the screen, you need to find the number of the screen combo Link is on. (Starts at the top left, counts right). This is not a simple task, but we scripters have developed a routine that does this. Check the Ice_Beam script in Zodiac to see the routine.

If there's a method that takes screen coordinates and returns the combo number, I'm not aware of it. We scripted one up.


// ======================================
// Combo Position finder
// Returns the Combo ID of the combo nearest
// to a given x, y coordinate.
// ======================================

int comboPosition(int x, int y){

int remainder = x % 16;
if (remainder <= 8){
x = x - remainder;
}
else{
x = x + 16 - remainder;
}

int remainder_y = y % 16;

if (remainder_y <= 8){
y = y - remainder_y;
}
else{
y = y + 16 - remainder_y;
}
return ((y & 240)+(x>>4));

} // end of comboPosition

Ahhhh thankyou. That command is also useful to know.

Although, in this case, it doesn't really help, because I don't want the player to be able to see the combo.

Unless, if I do that with a combo that's just assigned to an empty tile, will you still see it in ZC?