Jump to content

Photo

Simple torch script


  • Please log in to reply
14 replies to this topic

#1 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 17 June 2008 - 03:17 PM

Okay, this is a little hard to explain but I need an FFC script.

This is how it works:

There is one lit torch, (FFC 1), And one unlit torch, (FFC 2). Here is what happens: When you throw the boomerang through FFC 1, the boomerang sprite changes and when the boomerang hits FFC 2 after going through FFC 1 then FFC 2's sprite changes and it activates a secret. So basically, you throw a boomerang through a lit torch and the boomerang lights on fire and when it hits the unlit torch the unlit torch lights on fire and it activates a secret.

If anyone needs a screen of what I mean I'll show one.

#2 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 18 June 2008 - 02:28 AM

uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhhh.....Okey dokey.



CODE

bool BRANG_SECRET;
int tt;

//D0 - fire graphic */

ffc script torch_Brang{
  void run(int fire){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        tt--;
        int ew_num =  Screen->NumEWeapons();
        for(int e = ew_num; e>0; e--){
          lw_sprite = Screen->LoadLWeapon(e);
          if( lw_sprite->ID==3 ){
            this->X=lw_sprite->X;this->Y=lw_sprite->Y;
            this->Data=fire;
          }
        }
      }
      else if(ColCheck_BRang(this->X,this->Y))tt=120;
      else{ this->Data=ogd;this->X=ogx;this->Y=ogy;}
    }
  }
}


ffc script torch_trigger{
  void run(){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        if(ColCheck_BRang(this->X,this->Y))BRANG_SECRET=true;
      }
    }
  }
}


bool ColCheck_BRang(int x, int y){
int i;
int ew_num =  Screen->NumEWeapons();

for(int e = ew_num; e>0; e--){

  lw_sprite = Screen->LoadLWeapon(e);
  if( lw_sprite->ID==3 &&
  Abs(lw_sprite->X-x)<12 &&
  Abs(lw_sprite->Y-y)<12)i=1;

if(i==1) return true;
else return false
}
}



ffc script scrts{
  void run(){
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;
      }
    }
  }
}

Edited by Gleeok, 18 June 2008 - 02:28 AM.


#3 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 18 June 2008 - 07:29 AM

Thanks! icon_biggrin.gif

But I have a few questions::

- What do I change in the script?

- So for D0, do I put the combo for the firey boomerang?

Edited by ZebraStallion, 18 June 2008 - 07:30 AM.


#4 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 18 June 2008 - 12:39 PM

from what I see, it places a graphic of a flame over the boomerang.

so... i think that D0 is the combo that is a flame?

#5 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 18 June 2008 - 01:10 PM

Sorry, some huge typos here....


CODE

bool BRANG_SECRET;
int tt;

//D0 - fire graphic */

ffc script torch_Brang{
  void run(int fire){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        tt--;
        int lw_num =  Screen->NumLWeapons();
        for(int e = lw_num; e>0; e--){
          lw_sprite = Screen->LoadLWeapon(e);
          if( lw_sprite->ID==3 ){
            this->X=lw_sprite->X;this->Y=lw_sprite->Y;
            this->Data=fire;
          }
        }
      }
      else if(ColCheck_BRang(this->X,this->Y))tt=90;
      else{ this->Data=ogd;this->X=ogx;this->Y=ogy;}
    }
  }
}
ffc script torch_trigger{
  void run(){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        if(ColCheck_BRang(this->X,this->Y))BRANG_SECRET=true;
      }
    }
  }
}
bool ColCheck_BRang(int x, int y){
int i;
int lw_num =  Screen->NumLWeapons();

for(int e = lw_num; e>0; e--){

  lw_sprite = Screen->LoadLWeapon(e);
  if( lw_sprite->ID==3 &&
  Abs(lw_sprite->X-x)<12 &&
  Abs(lw_sprite->Y-y)<12)i=1;

if(i==1) return true;
else return false;
}
}
ffc script scrts{
  void run(){
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}

[/quote]


Fixed.

Yeah, just set D0 as a fire combo that will move with the B_RANG, and set the ffcs over the torches.

As for secrets triggering, I only used triggers and enemy->Secrets in the past. If you want the torches to reset, just add this instead of..:
CODE

ffc script scrts{
  void run(){
    en = Screen->CreateNPC(NPC_TRIGGER);
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}

Edited by Gleeok, 18 June 2008 - 01:11 PM.


#6 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 19 June 2008 - 04:14 PM

Thanks, but it doesn't compile. icon_heh.gif

#7 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 22 June 2008 - 02:18 AM

C'mon now, A little effort wouldn't hurt you y'know!!

CODE

bool BRANG_SECRET;
int tt;

//D0 - fire graphic */

ffc script torch_Brang{
  void run(int fire){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        tt--;
        int lw_num =  Screen->NumLWeapons();
        for(int e = lw_num; e>0; e--){
          lw_sprite = Screen->LoadLWeapon(e);
          if( lw_sprite->ID==3 ){
            this->X=lw_sprite->X;this->Y=lw_sprite->Y;
            this->Data=fire;
          }
        }
      }
      else if(ColCheck_BRang(this->X,this->Y))tt=90;
      else{ this->Data=ogd;this->X=ogx;this->Y=ogy;}
    }
  }
}
ffc script torch_trigger{
  void run(){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        if(ColCheck_BRang(this->X,this->Y))BRANG_SECRET=true;
      }
    }
  }
}
bool ColCheck_BRang(int x, int y){
int i;
int lw_num =  Screen->NumLWeapons();

for(int e = lw_num; e>0; e--){

  lw_sprite = Screen->LoadLWeapon(e);
  if( lw_sprite->ID==3 &&
  Abs(lw_sprite->X-x)<12 &&
  Abs(lw_sprite->Y-y)<12)i=1;
  }
if(i==1) return true;
else return false;
}
ffc script scrts{
  void run(){
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        npc e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}


CODE

ffc script scrts{
  void run(){
    npc e;
                e  = Screen->CreateNPC(NPC_TRIGGER);
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}

[/quote]


#8 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 22 June 2008 - 09:17 AM

QUOTE(Gleeok @ Jun 22 2008, 02:18 AM) View Post

C'mon now, A little effort wouldn't hurt you y'know!!

CODE

bool BRANG_SECRET;
int tt;

//D0 - fire graphic */

ffc script torch_Brang{
  void run(int fire){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        tt--;
        int lw_num =  Screen->NumLWeapons();
        for(int e = lw_num; e>0; e--){
          lw_sprite = Screen->LoadLWeapon(e);
          if( lw_sprite->ID==3 ){
            this->X=lw_sprite->X;this->Y=lw_sprite->Y;
            this->Data=fire;
          }
        }
      }
      else if(ColCheck_BRang(this->X,this->Y))tt=90;
      else{ this->Data=ogd;this->X=ogx;this->Y=ogy;}
    }
  }
}
ffc script torch_trigger{
  void run(){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        if(ColCheck_BRang(this->X,this->Y))BRANG_SECRET=true;
      }
    }
  }
}
bool ColCheck_BRang(int x, int y){
int i;
int lw_num =  Screen->NumLWeapons();

for(int e = lw_num; e>0; e--){

  lw_sprite = Screen->LoadLWeapon(e);
  if( lw_sprite->ID==3 &&
  Abs(lw_sprite->X-x)<12 &&
  Abs(lw_sprite->Y-y)<12)i=1;
  }
if(i==1) return true;
else return false;
}
ffc script scrts{
  void run(){
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        npc e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}


CODE

ffc script scrts{
  void run(){
    npc e;
                e  = Screen->CreateNPC(NPC_TRIGGER);
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}


Sorry, I can't script at all... icon_heh.gif

#9 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 22 June 2008 - 10:04 AM

I'm sure it's just typos and stuff. (gleeok's too good of a scripter to make non-functional functions icon_razz.gif)

actually, ZS, you may want to learn Zscript. it's not really difficult to understand.
... now mastering it is insanely hard...

but just learning what you need to isn't.

#10 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 22 June 2008 - 10:55 AM

Well, if I'm going to learn it, what should I start with?

And also, it still doesn't compile. It says, "Error S09: Variable LW_SPRITE is undeclared." I found those lines in the script but I don't know what to do with them.

#11 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 22 June 2008 - 11:20 AM

CODE
lweapon


type that in the beginning of the line with the error. be sure to use a space! the line should look like this:

CODE
lweapon lw_sprite = Screen->LoadLWeapon(e);


EDIT:

ok so you wanna know how to script? i can teach you a little bit, but joe and gleeok would be better for the more confusing parts.

first off, every time you load a script file into the buffer, double check to make sure it has this at the top:
CODE
inport "std.zh"

BUT only put it there once. only once. this loads all of the variables stated in the std.zh into the file to be used, as well as some functions too. But if you try to load it twice, the compiler will go through and tell you that each variable has been stated already, and it will scroll for about 5 seconds before stopping, because there's definately over 250 variables stated in the file.

Next order of business, this line:
CODE
script_type script script_name{

you will notice that all scripts have this as the outline for the first line. This is called Script Declaration. i'll explain each part.

script_type= the type of script. this determines where the script will be assigned. there are 3 script types. ffc, item, and global. do not capitalize these for this particular line.

script= just a word. you will see what i mean in my example below.

script_name= the name of the script (of course) this is what shows up in the compiler when you assign your scripts to their slots. spaces cannot be used in names, though. either leave them out, find a different name, or use "_" instead.

example:
CODE
ffc script monster{

ffc is the script_type
script is as it should (and will always) be
and script_name is monster.

and then, after that line you MUST include this one:
CODE
void run(){

because this tells the quest to start running the script. you will notice that some people put variables and things like that inside the "()". those are your D arguments for FFCs and sometimes items. Global scripts do not use D arguments. there is no place to edit them. you will have to edit variables that the script maker points out to personalize it.

hope this helps icon_razz.gif it's not even barely scratching the surface, but it is vital.

Edited by Master Maniac, 22 June 2008 - 11:41 AM.


#12 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 22 June 2008 - 06:09 PM

D'oh!

I usually have these declared automatically is why. So I never have to worry about it.
I just forgot the lweapon declare.....

CODE



bool BRANG_SECRET;
int tt;

//D0 - fire graphic */

ffc script torch_Brang{
  void run(int fire){
    int ogx=this->X; lweapon lw_sprite;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        tt--;
        int lw_num =  Screen->NumLWeapons();
        for(int e = lw_num; e>0; e--){
          lw_sprite = Screen->LoadLWeapon(e);
          if( lw_sprite->ID==3 ){
            this->X=lw_sprite->X;this->Y=lw_sprite->Y;
            this->Data=fire;
          }
        }
      }
      else if(ColCheck_BRang(this->X,this->Y))tt=90;
      else{ this->Data=ogd;this->X=ogx;this->Y=ogy;}
    }
  }
}
ffc script torch_trigger{
  void run(){
    int ogx=this->X;
    int ogy=this->Y;
    int ogd=this->Data;
    while(true){
      Waitframe();
      if(tt>0){
        if(ColCheck_BRang(this->X,this->Y))BRANG_SECRET=true;
      }
    }
  }
}
bool ColCheck_BRang(int x, int y){
int i; lweapon lw_sprite;
int lw_num =  Screen->NumLWeapons();

for(int e = lw_num; e>0; e--){

  lw_sprite = Screen->LoadLWeapon(e);
  if( lw_sprite->ID==3 &&
  Abs(lw_sprite->X-x)<12 &&
  Abs(lw_sprite->Y-y)<12)i=1;
  }
if(i==1) return true;
else return false;
}



ffc script scrts{
  void run(){
    npc e;
    e  = Screen->CreateNPC(NPC_TRIGGER);
    while(true){
      Waitframe();
      if(BRANG_SECRET)
      {
        // do stuff ....or.......
        e=Screen->LoadNPC(1);
        e->HP=0;BRANG_SECRET=false;
      }
    }
  }
}



OK, I comiled it myself. No errors. Try that.

It should work as follows:

1)throw the boomerang through ffc torch_B_rang location.
2)it has 1.5 seconds to contact with ffc torch_trigger
3)If so, it kills screen enemy 1. [the trigger](you can change this later.)
4)so you want enemies->Secrets in that room, and currently, no other enemies, though if it has no bugs you can always change that.

The end? icon_wink.gif

#13 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 27 July 2008 - 08:26 PM

Well, does it work?

#14 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 27 July 2008 - 08:29 PM

Oh, I didn't see that you posted a new version in the first place. Well, I can't really test it out yet because MasterManiac has my quest file. But I'll try to test it on a new quest file or something. Hang on a sec... I'll edit this post.

==EDIT==

It works. I didn't test it out fully but from what I can see it works.

Edited by ZebraStallion, 27 July 2008 - 08:37 PM.


#15 Shoelace

Shoelace

    The Shaman of Sexy!

  • Members
  • Real Name:Michael
  • Pronouns:He / Him
  • Location:Arizona

Posted 17 August 2008 - 04:58 PM

Oooo, nice, I am going to test this out, I would like to have this in my game. Thanks!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users