PDA

View Full Version : Link->Warp and Link->PitWarp



Master Maniac
06-02-2008, 05:31 PM
using build 758

these few lines of code:



if(Link->X=this->X){
Link->Warp(dmap,screen);
}


refuse to function.

it's the same using PitWarp. am i using them wrong?

bigjoe
06-02-2008, 05:44 PM
using build 758

these few lines of code:



if(Link->X=this->X){
Link->Warp(dmap,screen);
}
refuse to function.

it's the same using PitWarp. am i using them wrong?

Do you have that in a while loop with a waitframe within said script?

It should look like this.




ffc script do_warp_x{

void run(){

while(true){

if(Link->X == this->X) Link->Warp(dmap,screen); // Replace dmap and screen with desired destination

Waitframe();

}

}

}



That should work. If it doesn't, I dunno.

Master Maniac
06-02-2008, 05:56 PM
yes, it is within a while() loop.

EDIT: okay nevermind, it wasnt in the while loop. it was in a "blind spot" as i call them.

but now that i got the warp functioning, i noticed that it takes me to some strange Dmap. even when i set the Dmap in the script, and double-check it, it sends me somewhere with different music and an invisible link.

a bug maybe? because it does this with all script-declared warps.

bigjoe
06-02-2008, 06:09 PM
Well, the script I posted works in both your version and the latest version. Be sure you have it set on a Freeform Combo and that the combo has graphics applied to it. (you can set them to a combo that is set to a blank tile to simulate invisibility)

EDIT: Be sure of the properties of the destination dmap. If it is a Dungeon, Cave, or BS Overworld, it will only take you to a screen within its scope, which may not be the exact same number as the number you're looking at on the map. If it's an Overworld destination, it helps to just use the hex value. (I.E. if its screen 7E, just do 0x7E)

Joe123
06-02-2008, 06:23 PM
It's still easier to make the ffc into an autowarp combo you know MM

Master Maniac
06-02-2008, 06:34 PM
ok here's what i did. i made the script do stuff, and when link's X coordinates are equal to the X coordinates of the FFC, it triggers a warp. I chacked all of my DMaps, and made sure there was no errors. The Dmap is an overworld map. its Dmap 0. and the screen being warped to is one screen down from it, so from screen 00 to screen 10.

so my PitWarp is...

Link->PitWarp(0,10);

but for some reason, it goes to a completely different screen AND Dmap. for some reason it goes to Dmap 1 instead of 0.

maybe i'll just have to make Dmap 0 the overworld, since its just a test script.

and joe, i know, and i tried that, but it has the same result as this. besides, its just an insta-warp, to simulate trees growing. Hold on a little, and i'll export the script and post it here.


//=============//
//Elzo cutscene//
//=============//

//reproduction of the "elzo being attacked" scene from Minish Cap

//=====//
//SETUP//
//=====//

//you will need 5 ffc's and 8 combos total.you will need 2 message strings. you will need 3 identical screens.
//ffc 1 is an NPC (fairy, person, animal, whatever)
//ffc 2 and 3 are octorocks
//ffc 4 is the rock they spit.

//in each ffc's setup, set their coordinates in a straight line along the x-axis.
//all of theit x coordinates need to be the same.
//then, set the rock a few units to the right of the octo you placed on the left.

//the combo setup on the combo page:

//the fairy and the rock are nothing special. set them up how you want.
//however there should be 2 graphics for each octorock.
//1 will be an octorock just standing there. the other will be placed 2 combos ahead on the combo page,
//and should be the octo preparing to spit a rock.
//the other 2 should be sensitive warps with blank graphics. warps A and B.

//you will need 3 identical screens for this.
//1st screen: place all ffc's here.
//when link walks toward the scene to help the fairy (or whatever you want to put there),
//it will warp him to the second screen. (tile warp B)

//2nd screen: the FFC octos are replaced by real octos here.
//you get to set where they spawn. (there is a flag for that)
//there needs to be a fiary FFC here, also. when all the enemies are killed, the screen warps to the 3rd screen.
//this screen MUST be enclosed, or link will be able to leave at will during the battle, so
//edit the tiles at the entrance to the screen to block him off.

//3rd screen: nothing here, and the design is the same as the 1st screen.
//3rd screen should have no enemies on it and the side warps to the next areas and the previous area that link came from.

//=========//
//placement//
//=========//

//place the first script on the fairy FFC on the first screen
//and the second on the fairy on the second screen

//=========//
//ARGUMENTS//
//=========//

//*1st script*//

//D0=the message string to play. ("help me!!" or something to that effect.)
//D1= The Dmap that link warps to if this cutscene HAS played
//D2= The screen for the Dmap mentioned in D1
//D3= The Dmap to warp to if this is the first time the script is played
//D4= The screen for the Dmap mentioned in D3
//D5=number of tiles link must walk into the screen to start the battle.(not pixels, tiles)



//*Second script*//

//D0= message string to play. ("thank you" or something to that effect)
//D1= combo that you made that has a tile warp on it. sends link to the 3rd screen.

import "std.zh"

ffc script elzo_cutscene{
void run(int s,int your_dmap1,int your_screen1,int your_dmap2,int your_screen2){



int t;

bool warp=true;

while(t<=5){

if(Link->Item[255]){

Link->PitWarp(your_dmap1, your_screen1);
}



else{

ffc octo1=Screen->LoadFFC(2);
ffc octo2=Screen->LoadFFC(3);
ffc rock=Screen->LoadFFC(4);
ffc fairy=Screen->LoadFFC(1);
ffc warptrigger= Screen->LoadFFC(5);


if(Abs(rock->X-fairy->X)==4){

rock->X=octo2->X;
octo2->Data+=2;
rock->Vx*=-1;
t+=1;
}

if(Abs(rock->X-fairy->X)==11){

rock->X=octo1->X;
octo1->Data+=2;
rock->Vx*=-1;
t++;
}

if(t<4){

Link->InputLeft=false;
Link->InputRight=false;
Link->InputUp=false;
Link->InputDown=false;
Link->InputB=false;

}

if(t==4){

rock->Data=0;

Screen->Message(s);
t++;
}
if(Link->X==warptrigger->X){

Link->Item[255]=true;

Link->PitWarp(your_dmap2, your_screen2);
octo1->Data=0;
octo2->Data=0;
}
}
Waitframe();
}
}
}

ffc script message_after_kill{
void run(int s, int c1){

if(Screen->NumNPCs()==0){

Screen->Message(s);

int combo = Screen->ComboT[ComboAt(Link->X,Link->Y)];
Screen->ComboT[ComboAt(Link->X,Link->Y)] = c1;
Waitframes(3);
Screen->ComboT[ComboAt(Link->X,Link->Y)] = combo;

}
}
}

I have determined that it does not take him to the wrong Dmap, but to the wrong screen.

bigjoe
06-02-2008, 06:52 PM
Try sending him to screen 16. If that works, let me know, and I'll offer an explanation.

Or, I'll offer the explanation now.

Screens for overworld types need to be converted to hex.

What you see as "10" is actually "16"

To convert to and from hex, use the calculator program in Windows.

EDIT: This is important to do since I don't think you can write hex values into the freeform combo arguments.

Master Maniac
06-02-2008, 07:04 PM
actually, no matter what screen i type in, it always sends me to screen 14.

Joe123
06-02-2008, 07:14 PM
You don't need to use hex for that, if you type in a decimal number it counts across the rows and then moves down to the next column and counts across again.

Gleeok
06-02-2008, 08:29 PM
It's really easy, although note that the non-hex pitwarp function actually works nothing like it was supposed to originally (from what DD has said and what it actually does).

If you want to go to DMap 0, screen 7-0; You type in Link->PitWarp(0,112);
7 x 16 + 0 = 112.
If you want to go to DMap 0, screen 1-0; You type in Link->PitWarp(0,16);
1 x 16 + 0 = 16.

..DMap 435, screen 5b would be: Link->PitWarp(435,89);

5 x 16 + 9 = 89;

Master Maniac
06-02-2008, 08:58 PM
but for some reason, it always sends me to screen 14 (in hex of course)

Gleeok
06-02-2008, 09:52 PM
Set it to carry over and add:

Trace(GetCurDMapScreen);Waitframes(120);

;)


Post the results.



...or is that

Trace(Game->GetCurDMapScreen);Waitframes(120);

ScaryBinary
06-03-2008, 08:29 PM
If you want to go to DMap 0, screen 7-0; You type in Link->PitWarp(0,112);
7 x 16 + 0 = 112.
If you want to go to DMap 0, screen 1-0; You type in Link->PitWarp(0,16);
1 x 16 + 0 = 16.

..DMap 435, screen 5b would be: Link->PitWarp(435,89);

5 x 16 + 9 = 89;

:confused: Now I'm mildly confused. Can you use hex numbers as arguments? e.g., to go to screen 7-0, use:

Link->PitWarp(0, 0x70);

Also, 5-b would be 91 right? (5 x 16) + (B) = (5 x 16) + (11) = 91. (just want to make sure I haven't completely forgetton hexadecimal...:tongue:)

Also, if someone could double-check (and/or improve) the Wiki article Screen (ZQuest) (http://www.shardstorm.com/ZCwiki/Map_%28ZQuest%29), which talks about screen numbers in a map, that'd be great.

Gleeok
06-04-2008, 03:17 AM
Also, 5-b would be 91 right? (5 x 16) + (B) = (5 x 16) + (11) = 91. (just want to make sure I haven't completely forgetton hexadecimal...:tongue:)


Good catch.

I'm using interior type DMaps so I dont even use screens 8-f at all. I had erroniously added b to 7 instead of 9 due to some sort of a out-of-the 8x8 dmap grid, hex related brain trauma or something.

I prefer 10 digit math to hex. The only non-programmer persons who might think otherwise would probably be former rom-hackers.