He makes a mistake in compiling...
item scriptspecialcost { void run(int msg, int counter, int cost, int errorSFX) { //Dummy script,just to get item cost data } }Encountered an error between tokens ....
Maybe it doesn't go into 2.53 (Beta 55) ???
Creator:
RephireZeKasual217
Updated: 30 Sep 2019
Tags:
Global,
Item
Downloads: 23
|
View Script
Download Example (903.45 KB) |
item scriptspecialcost { void run(int msg, int counter, int cost, int errorSFX) { //Dummy script,just to get item cost data } }Encountered an error between tokens ....
if(Game->Counter[CR_MAGIC]){ Cost = Cost*Game->Generic[GEN_MAGICDRAINRATE]; }In fact, the entire thing makes little sense there.
// A generic method of applying custom item counter/cost to any item, // including flipper diving with sound effects for errors. // 30th September, 2019 // By: ZoriaRPG //D0: The itempickup slot message. Reserved for pickup scripts. //D1: The counter to use. //D2: The item cost for that counter. //D3: The sound to play to indicate an error (cannot use item) item scriptspecialcost { void run(int msg, int counter, int cost, int errorSFX) { //Dummy script,just to get item cost data } } global script testItemCosts { void run() { while(1) { trybuttoncosts(); Waitframe(); } } void trybuttoncosts() { int attemptit = 1; if ( Link->Action == LA_NONE ) attemptit = 1; if ( Link->Action == LA_WALKING ) attemptit = 1; if ( Link->Action == LA_ATTACKING ) attemptit = 1; if ( Link->Action == LA_SWIMMING ) attemptit = 2; //dive only //other actions can't use items b_ButtonCosts(attemptit); a_ButtonCosts(attemptit); } void a_ButtonCosts(int attemptit) { itemdata theItem; if ( attemptit == 2 ) { theItem = Game->LoadItemData(I_FLIPPERS); } else if ( attemptit == 1 ) { theItem = Game->LoadItemData(GetEquipmentA()); } if ( Link->PressA ) { if ( attemptit ) { if ( Game->Counter[ theItem->InitD[1] ] < theItem->InitD[2] ) { Link->PressA = false; Link->InputA = false; Game->PlaySound(theItem->InitD[3]); } else { Game->Counter[ theItem->InitD[1] ] -= theItem->InitD[2]; } } else //can't use items with the current Action { Link->PressA = false; Link->InputA = false; Game->PlaySound(theItem->InitD[3]); } } } void b_ButtonCosts() { itemdata theItem = Game->LoadItemData(GetEquipmentB()); if ( Link->PressB ) { if ( attemptit ) { if ( Game->Counter[ theItem->InitD[1] ] < theItem->InitD[2] ) { Link->PressB = false; Link->InputB = false; Game->PlaySound(theItem->InitD[3]); } else { Game->Counter[ theItem->InitD[1] ] -= theItem->InitD[2]; } } else //can't use items with the current Action { Link->PressB = false; Link->InputB = false; Game->PlaySound(theItem->InitD[3]); } } } }That should be universally better, for 2.53. The item script just gives the global script's functions data for the costs and sounds for the item being used.