Uuhhg...Shop Script
#16
Posted 13 July 2010 - 11:54 PM
#18
Posted 14 July 2010 - 12:34 AM
#19
Posted 14 July 2010 - 07:00 PM
Did you put the shop script in the same .z file as the rest of your scripts? Can you post your script file again?
of course. the shop script appeared in the assign scripts page. its just, none of my scripts are working now.
[code=auto:0]
import "std.zh"
//========================================================
// FFC SCRIPT TRIGGER SECRETS (no pun intended) hah;)
// D0 - Item neccesary. Check std.zh for values
// Gleeok was here-
//========================================================
ffc script trigger_secrets{
void run(int have_item){
if (Link->Item[have_item] == true && Screen->NumNPCs() >= 1){
npc enemy_trig = Screen->LoadNPC(1);
enemy_trig->HP = 0;
}
}
}
const int CMB_AUTOWARPA = 0; //Set this to the combo ID of a transparent Autowarp A type combo
ffc script Boss{
void run(int health,int sfx,int ffcnum,int warp){
ffc f = this;
if(ffcnum > 0) f = Screen->LoadFFC(ffcnum);
while(health > 0){
for(int i=0;i<Screen->NumLWeapons();i++){
lweapon l = Screen->LoadLWeapon(i);
if(Collision(f,l) && DamagingLWeapon(l)){
health--;
if(sfx > 0) Game->PlaySound(sfx);
Waitframes(10);
}
}
Waitframe();
}
if(warp == 0) Screen->TriggerSecrets();
else{
ffc warper = Screen->LoadFFC(warp);
warper->Data = CMB_AUTOWARPA;
}
}
bool DamagingLWeapon(lweapon l){
return l->ID != LW_BOMB && l->ID != LW_SBOMB && l->ID != LW_BAIT && l->ID != LW_SPARKLE;
}
}
ffc script Shop{
void run(int itm, int price,int input){
while(true){
if(CanBuy(this,input)){
SetInput(input,false);
if(Game->Counter[CR_RUPEES] >= price){
ShopItemThanks(itm);
DeductRupees(price);
}else Screen->Message(S_NORUPEES);
}
Waitframe();
}
}
}
const int S_NORUPEES = 2; //Message saying 'Not enough rupees'
const int S_THANKS = 1; //Message saying 'Thanks for buying'
bool CanBuy(ffc buy,int input){
return (Abs(Link->X-buy->X) < 8 && Abs(Link->Y-(buy->Y+) < 8 && SelectPressInput(input) && Link->Dir == DIR_UP);
}
void ShopItemThanks(int itm){
Screen->Message(S_THANKS);
Game->PlaySound(SFX_SCALE);
WaitNoAction();
CreatePickupItem(Link->X,Link->Y,itm);
Game->PlaySound(SFX_PICKUP);
WaitNoAction();
}
void CreatePickupItem(int x, int y, int itm){
item Spawn = Screen->CreateItem(itm);
Spawn->Pickup |= (IP_TIMEOUT|IP_HOLDUP);
Spawn->HitWidth = 16; Spawn->HitHeight = 16;
Spawn->X = x; Spawn->Y = y;
}
void DeductRupees(int amount){
FreezeScreen();
for(int i=0;i<amount;i++){
Game->PlaySound(SFX_MSG);
Game->Counter[CR_RUPEES]--;
Waitframe();
}
UnFreeze();
}
int FreezeID;
void FreezeScreen(){
FreezeID = Screen->ComboT[0];
Screen->ComboT[0] = CT_SCREENFREEZE;
}
void UnFreeze(){
Screen->ComboT[0] = FreezeID;
}
//These functions should only be included in your script file once
bool SelectPressInput(int input){
if(input == 0) return Link->PressA;
else if(input == 1) return Link->PressB;
else if(input == 2) return Link->PressL;
else if(input == 3) return Link->PressR;
}
void SetInput(int input, bool state){
if(input == 0) Link->InputA = state;
else if(input == 1) Link->InputB = state;
else if(input == 2) Link->InputL = state;
else if(input == 3) Link->InputR = state;
}
void NoAction(){
Link->InputUp = false; Link->InputDown = false;
Link->InputLeft = false; Link->InputRight = false;
Link->InputA = false; Link->InputB = false;
Link->InputL = false; Link->InputR = false;
}
void WaitNoAction(){
NoAction();
Waitframe();
}
const int WSP_FALLING = 88; //Weapon/Misc. sprite for Link falling down a hole
const int WSP_LAVA = 89; //Weapon/Misc. sprite for Link drowning in lava
const int SFX_FALLING = 64; //SFX for falling down a hole
const int SFX_LAVA = 76; //SFX for drowning in lava
const int CMB_AUTOWARP = 29; //Combo ID of a transparent AutoWarp A combotype
const int CT_HOLELAVA = 11; //Combotype to give hole functionality to (default is Left Statue)
ffc script HoleLava{
void run(int lava, int warpto, int damage){
this->Misc[0] = WSP_FALLING; this->Misc[1] = SFX_FALLING; //Set up correct graphic and sound effect
if(lava){
this->Misc[0] = WSP_LAVA;
this->Misc[1] = SFX_LAVA;
}
//Find return point when falling in lava. (this->X,this->Y) used if ffc is not at (0,0)
if((this->X == 0 && this->Y == 0) || this->Flags[FFCF_CHANGER]){
Waitframes(5);
this->X = Link->X; this->Y = Link->Y;
}
this->Misc[2] = warpto;
if(damage) this->Misc[3] = damage;
else this->Misc[3] = 8;
while(true){
while(!OnPitCombo()) Waitframe(); //Idle while not on pit
int pitclk = 0;
while(OnPitCombo() && pitclk++ < 4) Waitframe(); //Wait for four frames whilst on pit
if(pitclk >= 5) Fall(this); //Fall
}
}
void Fall(ffc Info){
Screen->ClearSprites(SL_LWPNS);
Game->PlaySound(Info->Misc[1]);
int wait = CreateGraphic(Info->Misc[0]);
Link->Invisible = true; Link->CollDetection = false;
for(int i=0;i<wait+30;i++) WaitNoAction();
Link->Invisible = false; Link->CollDetection = true;
if(Info->Misc[2]) Warp(Info);
Link->X = Info->X; Link->Y = Info->Y;
Link->HP -= Info->Misc[3];
Game->PlaySound(SFX_OUCH);
}
void Warp(ffc Warp){
int orig = Warp->Data;
Warp->Data = CMB_AUTOWARP;
Warp->Flags[FFCF_CARRYOVER] = true;
Waitframe();
Warp->Data = orig;
Warp->Flags[FFCF_CARRYOVER] = false;
Link->Z = Link->Y;
Quit();
}
bool OnPitCombo(){
return (Screen->ComboT[ComboAt(Link->X+8,Link->Y+] == CT_HOLELAVA && Link->Z <= 0 && Link->Action != LA_FROZEN);
}
int CreateGraphic(int sprite){
lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
l->HitXOffset = 500;
l->UseSprite(sprite);
l->DeadState = l->NumFrames*l->ASpeed;
l->X = Link->X; l->Y = Link->Y;
return l->DeadState;
}
}
ffc script FFCJumpCliff{
void run(int verticalmovement, int horizontalmovement, int directiontopress) {
int directiontopressmoreleft;
int directiontopressmoreright;
int LinkHmovementdone = 0;
bool ffcsentlinkjumping = false;
if (directiontopress==DIR_DOWN) {
directiontopressmoreleft = DIR_RIGHTDOWN;
directiontopressmoreright = DIR_LEFTDOWN;
}
else {
if (directiontopress==DIR_UP) {
directiontopressmoreleft = DIR_LEFTUP;
directiontopressmoreright = DIR_RIGHTUP;
}
else {
if (directiontopress==DIR_LEFT) {
directiontopressmoreleft = DIR_LEFTDOWN;
directiontopressmoreright = DIR_LEFTUP;
}
else {
if (directiontopress==DIR_RIGHT) {
directiontopressmoreleft = DIR_RIGHTUP;
directiontopressmoreright = DIR_RIGHTDOWN;
}
else {
if (directiontopress==DIR_LEFTDOWN) {
directiontopressmoreleft = DIR_DOWN;
directiontopressmoreright = DIR_LEFT;
}
else {
if (directiontopress==DIR_RIGHTDOWN) {
directiontopressmoreleft = DIR_RIGHT;
directiontopressmoreright = DIR_DOWN;
}
else {
if (directiontopress==DIR_LEFTUP) {
directiontopressmoreleft = DIR_LEFT;
directiontopressmoreright = DIR_UP;
}
else {
if (directiontopress==DIR_RIGHTUP) {
directiontopressmoreleft = DIR_UP;
directiontopressmoreright = DIR_RIGHT;
}
}
}
}
}
}
}
}
while (true){
if (Link->Z==0) {
LinkHmovementdone=0;
ffcsentlinkjumping = false;
}
if ( (ffcsentlinkjumping)&&(LinkHmovementdone<Abs(horizontalmovement)) ) {
if (horizontalmovement<0) {Link->X--;}
if (horizontalmovement>0) {Link->X++;}
LinkHmovementdone++;
}
if ( (LinkCollision(this))
&& ( (Link->Dir==directiontopress)
||(Link->Dir==directiontopressmoreleft)
||(Link->Dir==directiontopressmoreright) ) ) {
if (Link->Z==0){
Game->PlaySound(SFX_JUMP);
Link->Action=LA_HOPPING;
}
ffcsentlinkjumping=true;
Link->Y=Link->Y+verticalmovement;
Link->Z=Link->Z+verticalmovement;
}
Waitframe();
}
}
}
ffc script OrbReact
{
void run(int a,int b,int c, int m)
{
if(Link->Item[a] && Link->Item[b] && Link->Item[c])
{
Screen->TriggerSecrets();
}
else
{
Screen->Message(m);
}
}
}
item script Give
{
void run(int i)
{
Link->Item[i] = true;
}
}
item script Message{
void run(int m){
Screen->Message(m);
}
}
Edited by cremeens1000, 14 July 2010 - 07:03 PM.
#20
Posted 17 July 2010 - 10:12 AM
can stop trying to figure out whats wrong now.
Edited by cremeens1000, 17 July 2010 - 09:04 PM.
#21
Posted 17 July 2010 - 10:37 AM
#23
Posted 17 July 2010 - 12:58 PM
#24
Posted 17 July 2010 - 01:46 PM
#25
Posted 17 July 2010 - 02:25 PM
are all of your scripts in the same .z file?
yes sir.
And did you place your scripts in the global/ffc script slots?
yes sir. this is really crazy but, i think it might be the tileset. if thats even possible.
#26
Posted 17 July 2010 - 02:36 PM
The only reason the tileset should make a difference is if the scripts are written to use certain tile or combo numbers.
#27
Posted 17 July 2010 - 03:32 PM
Have you tried any other tilesets? If you make a new quest in Pure, do they work with that?
The only reason the tileset should make a difference is if the scripts are written to use certain tile or combo numbers.
yes, it worked in my new pure game that i am never releasing.
#28
Posted 18 July 2010 - 01:00 PM
i fixed it! i just deleted my real npc script and put it back and now for some reason its working now. you
can stop trying to figure out whats wrong now.
okay, my real npc script is working. but, my shop script is not! i swear that i have everything set up right.
please guys. i need help. i will be ever so great full.
#29
Posted 18 July 2010 - 05:19 PM
okay, my real npc script is working. but, my shop script is not! i swear that i have everything set up right.
please guys. i need help. i will be ever so great full.
*cough* edit button *cough*
Anyway... Try simply exporting your script buffer from your unreleased version, and compile it in your new one?
#30
Posted 18 July 2010 - 06:56 PM
*cough* edit button *cough*
Anyway... Try simply exporting your script buffer from your unreleased version, and compile it in your new one?
yeah, maybe i should start trying to fix it myself before i ask you guys. i'll try that.
and what do you mean, "edit button"?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users