PDA

View Full Version : Simple Scripts



Master_of_Power
12-26-2006, 07:33 PM
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.

C-Dawg
12-28-2006, 11:32 AM
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.

Master_of_Power
12-28-2006, 03:51 PM
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 =\

C-Dawg
12-28-2006, 04:52 PM
It should, I would think, if the "hold up item" flag is checked. Does it work for you, though?

Master_of_Power
12-28-2006, 06:25 PM
nope

I have the hold item up screen flag checked and I don't hold the item up.

C-Dawg
12-28-2006, 06:39 PM
Alright, sounds like it works otherwise though. One satisfied customer.