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

Simple Scripts

5 replies · 1,484 views · Started 26 December 2006

One that when you press a button on an FCC and you get an item or items.

A shop script for more than 3 items(press A on the FCC and you buy the item)
- Make tell me how to make it check if you have a certain item as before you can buy it

A script that when you press the A button on it, you warp to a different location

As I don't currently have a clue how to script yet(despite I'm learning a little at a time) I'd really like these scripts.

Okie dokie. I've made the script create an item at Link's location, rather than just GIVING him the item, because that way you can use screen flags to have Link hold it up if you like.


// ================================
// pushA_getitem = This script will check the
// player's location when they push the A button.
// if the A button is pressed while the player
// is within 16 pixels of the FFC, the game will
// create an item at Link's location. The FFC will
// only do this if Link has a specified precursor item.
// The script will only trigger once, until Link exits
// and re-enters the screen.
// D0 = The item to be created.
// D1 = An item necessary to get the new one.
// Set to zero if you don't want there to be
// any precursor item.
// ================================

ffc script pushA_getitem{

void run( int item, int pre_item ){

int wastriggered = 0; // whether or not the script has created an item yet.

while(true){
if ( (Link->InputA) && ( (Link->Item[pre_item]) || (pre_item == 0) ) && (Link->X < this->X+16) && (Link->X > this->X-1) && (Link->Y < this->Y+16) && (Link->Y > this->Y-1) && (wastriggered == 0)){

item new_item = Screen->CreateItem(item);
new_item->X = Link->X;
new_item->Y = Link->Y;
} // end of if

Waitframe();
}

} // end of void run

} // end of ffc script

Havn't tried complining it, but that should work.

Quick edit:

// ================================
// pushA_getitem = This script will check the
// player's location when they push the A button.
// if the A button is pressed while the player
// is within 16 pixels of the FFC, the game will
// create an item at Link's location. The FFC will
// only do this if Link has a specified precursor item.
// The script will only trigger once, until Link exits
// and re-enters the screen.
// D0 = The item to be created.
// D1 = An item necessary to get the new one.
// Set to zero if you don't want there to be
// any precursor item.
// ================================

ffc script pushA_getitem{

void run( int sc_item, int pre_item ){

int wastriggered = 0; // whether or not the script has created an item yet.

while(true){
if ( (Link->InputA) && ( (Link->Item[pre_item]) || (pre_item == 0) ) && (Link->X < this->X+16) && (Link->X > this->X-1) && (Link->Y < this->Y+16) && (Link->Y > this->Y-1) && (wastriggered == 0)){

item new_item = Screen->CreateItem(sc_item);
new_item->X = Link->X;
new_item->Y = Link->Y;
wastriggered = 1;
} // end of if

Waitframe();
}

} // end of void run

} // end of ffc script

Oh and it doesn't let you hold the item up anyway =\

It should, I would think, if the "hold up item" flag is checked. Does it work for you, though?