Simple torch script
#1
Posted 17 June 2008 - 03:17 PM
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
Posted 18 June 2008 - 02:28 AM
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
Posted 18 June 2008 - 07:29 AM
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
Posted 18 June 2008 - 12:39 PM
so... i think that D0 is the combo that is a flame?
#5
Posted 18 June 2008 - 01:10 PM
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..:
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
Posted 19 June 2008 - 04:14 PM
#7
Posted 22 June 2008 - 02:18 AM
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;
}
}
}
}
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
Posted 22 June 2008 - 09:17 AM
C'mon now, A little effort wouldn't hurt you y'know!!
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;
}
}
}
}
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...
#9
Posted 22 June 2008 - 10:04 AM
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
Posted 22 June 2008 - 10:55 AM
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
Posted 22 June 2008 - 11:20 AM
type that in the beginning of the line with the error. be sure to use a space! the line should look like this:
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:
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:
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:
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:
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 it's not even barely scratching the surface, but it is vital.
Edited by Master Maniac, 22 June 2008 - 11:41 AM.
#12
Posted 22 June 2008 - 06:09 PM
I usually have these declared automatically is why. So I never have to worry about it.
I just forgot the lweapon declare.....
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?
#13
Posted 27 July 2008 - 08:26 PM
#14
Posted 27 July 2008 - 08:29 PM
==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
Posted 17 August 2008 - 04:58 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users