LA style sideview ladders?
#16
Posted 23 July 2011 - 06:09 PM
#17
Posted 23 July 2011 - 06:36 PM
Also, I'm having trouble using my other global script with this: one which turns Counters script2 and script3 into life and magic counters. Where were other global scripts supposed to fit in with this? I applied it once right after "void run - while(true)", but this caused the ladder to behave incorrectly. I tried placing it later in that same set, only to have the counters not count!
Edited by King Aquamentus, 23 July 2011 - 06:54 PM.
#18
Posted 23 July 2011 - 07:56 PM
#19
Posted 23 July 2011 - 11:04 PM
I'll look into the scrolling warp issue. As for the issue with the other scripts, it should work with others. If you don't mind making your script file available to me, I might be able to find the problem.
Next time I get to working on it, I'll try and remember to do that. Thanks for everything, Isdrakthul.
and Blackbishop
#20
Posted 24 July 2011 - 10:52 AM
I think I may have eliminated the problem, altough it's hard for me to tell since I'm not experiencing it.
#21
Posted 24 July 2011 - 06:55 PM
#22
Posted 24 July 2011 - 07:07 PM
Basically, yes, but it could be a week or so.
Edited by Isdrakthül, 24 July 2011 - 08:53 PM.
#23
Posted 24 July 2011 - 08:33 PM
#24
Posted 24 July 2011 - 09:04 PM
http://zctut.com/ladder.php
But this is from 2008, and Zscript has improved so much from this, that it might not even compile.
#25
Posted 24 July 2011 - 10:30 PM
Ah it's no biggie. The script is already effective as is. Excellent work
Of interesting note, my request has Link facing downward, so he appears to be on an elevator, looking at you. I'm assuming you want him facing northward, but it shouldn't be that big a deal to change.
#26
Posted 25 July 2011 - 10:19 AM
This version sets Link's direction to down and uses flags instead of combos (per King Aquamentus' request):
int scrolltile = 31264;
int SaveX;
int SaveY;
int SaveS;
int SaveM;
bool WasOnLadder = false;
bool HookGrab(){
int HSFor;
for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
lweapon HSCheck = Screen->LoadLWeapon(HSFor);
if(HSCheck->ID == LW_HOOKSHOT && Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y+15)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y+15)] == CT_HSGRAB){
return(true);
}
}
return(false);
}
bool OnLadder()
{
if(ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) || ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1)){
return(true);
}
return(false);
}
bool OnLadderDown()
{
if(!ComboFI(Link->X, Link->Y+8, CF_SCRIPT1) && !ComboFI(Link->X+15, Link->Y+8, CF_SCRIPT1) && (ComboFI(Link->X, Link->Y+17, CF_SCRIPT1) || ComboFI(Link->X+15, Link->Y+17, CF_SCRIPT1))){
return(true);
}
return(false);
}
bool isLSolidHorz(int y)
{
int x;
for(x=Link->X; x<=Link->X+16; x+=8)
{
if(x==Link->X+16) x--;
if(Screen->isSolid(x, y)) return(true);
}
return(false);
}
bool isFiringHS(){
int HSFor;
for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
lweapon HSCheck = Screen->LoadLWeapon(HSFor);
if(HSCheck->ID == LW_HOOKSHOT){
return(true);
}
}
return(false);
}
bool isJumping(){
if((GetEquipmentA() == I_ROCSFEATHER && Link->InputA == true) || (GetEquipmentB() == I_ROCSFEATHER && Link->InputB == true) || Link->Jump > 1){
return(true);
}
return(false);
}
bool aboutToScroll(){
if(Link->Y<=1 && Link->InputUp) return true;
else if(Link->Y>=159 && Link->InputDown) return true;
else if(Link->X<=1 && Link->InputLeft) return true;
else if(Link->X>=239 && Link->InputRight) return true;
else return false;
}
global script Slot2{
void run(){
while(true){
if(Game->GetCurDMapScreen()!=SaveS || Game->GetCurDMap()!=SaveM){
Link->Invisible=false;
while(Link->Action==LA_SCROLLING){ //Waitframes(49);
if(OnLadder() == true && HookGrab() == false && isJumping() == false){
Waitdraw();
Link->Dir=DIR_DOWN;
}
Waitframe();
}
SaveX=Link->X;
SaveY=Link->Y;
}
if(OnLadder() == true && HookGrab() == false && isJumping() == false){
if(WasOnLadder == false){
Link->Jump = 1;
if(OnLadderDown()){
Link->Y++;
SaveY = Link->Y;
}
}
else{
Link->Jump = 0;
}
if(!isFiringHS()){
if(Link->InputUp == true && !isLSolidHorz(Link->Y+7)){
SaveY--;
}
else if(Link->InputDown == true && !isLSolidHorz(Link->Y+16)){
SaveY++;
}
if(Link->InputLeft == true && !Screen->isSolid(Link->X-1, Link->Y+8) && !Screen->isSolid(Link->X-1, Link->Y+15)){
SaveX--;
}
else if(Link->InputRight == true && !Screen->isSolid(Link->X+16, Link->Y+8) && !Screen->isSolid(Link->X+16, Link->Y+15)){
SaveX++;
}
}
Link->X = SaveX;
Link->Y = SaveY;
WasOnLadder = true;
SaveS=Game->GetCurDMapScreen();
SaveM=Game->GetCurDMap();
if(!aboutToScroll()){
Waitdraw();
Link->Dir=DIR_DOWN;
}
else{
Link->Invisible=true;
Screen->FastTile(3, Link->X, Link->Y, scrolltile, 6, 128);
}
}
else{
if(WasOnLadder == true){
Link->Jump = 0;
WasOnLadder = false;
}
SaveX = Link->X;
SaveY = Link->Y;
}
SaveS=Game->GetCurDMapScreen();
SaveM=Game->GetCurDMap();
Waitframe();
}
}
}
item script Roc{
void run(){
if(OnLadder() == true){
Link->Jump = 3;
}
}
}
item script NewScrollTile{
void run(int newtile){
scrolltile = newtile;
}
}
This version uses combos and sets the direction to up:
int scrolltile = 31260;
int SaveX;
int SaveY;
int SaveS;
int SaveM;
bool WasOnLadder = false;
bool HookGrab(){
int HSFor;
for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
lweapon HSCheck = Screen->LoadLWeapon(HSFor);
if(HSCheck->ID == LW_HOOKSHOT && Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X, HSCheck->Y+15)] == CT_HSGRAB || Screen->ComboT[ComboAt (HSCheck->X+15, HSCheck->Y+15)] == CT_HSGRAB){
return(true);
}
}
return(false);
}
bool OnLadder()
{
if(Screen->ComboT[ComboAt (Link->X, Link->Y+8)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+8)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X, Link->Y+17)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+17)] == CT_SCRIPT1){
return(true);
}
return(false);
}
bool OnLadderDown()
{
if(Screen->ComboT[ComboAt (Link->X, Link->Y+8)] != CT_SCRIPT1 && Screen->ComboT[ComboAt (Link->X+15, Link->Y+8)] != CT_SCRIPT1 && (Screen->ComboT[ComboAt (Link->X, Link->Y+17)] == CT_SCRIPT1 || Screen->ComboT[ComboAt (Link->X+15, Link->Y+17)] == CT_SCRIPT1)){
return(true);
}
return(false);
}
bool isLSolidHorz(int y)
{
int x;
for(x=Link->X; x<=Link->X+16; x+=8)
{
if(x==Link->X+16) x--;
if(Screen->isSolid(x, y)) return(true);
}
return(false);
}
bool isFiringHS(){
int HSFor;
for(HSFor = 1; HSFor <= Screen->NumLWeapons(); HSFor++){
lweapon HSCheck = Screen->LoadLWeapon(HSFor);
if(HSCheck->ID == LW_HOOKSHOT){
return(true);
}
}
return(false);
}
bool isJumping(){
if((GetEquipmentA() == I_ROCSFEATHER && Link->InputA == true) || (GetEquipmentB() == I_ROCSFEATHER && Link->InputB == true) || Link->Jump > 1){
return(true);
}
return(false);
}
bool aboutToScroll(){
if(Link->Y<=1 && Link->InputUp) return true;
else if(Link->Y>=159 && Link->InputDown) return true;
else if(Link->X<=1 && Link->InputLeft) return true;
else if(Link->X>=239 && Link->InputRight) return true;
else return false;
}
global script Slot2{
void run(){
while(true){
if(Game->GetCurDMapScreen()!=SaveS || Game->GetCurDMap()!=SaveM){
Link->Invisible=false;
while(Link->Action==LA_SCROLLING){ //Waitframes(49);
if(OnLadder() == true && HookGrab() == false && isJumping() == false){
Waitdraw();
Link->Dir=DIR_UP;
}
Waitframe();
}
SaveX=Link->X;
SaveY=Link->Y;
}
if(OnLadder() == true && HookGrab() == false && isJumping() == false){
if(WasOnLadder == false){
Link->Jump = 1;
if(OnLadderDown()){
Link->Y++;
SaveY = Link->Y;
}
}
else{
Link->Jump = 0;
}
if(!isFiringHS()){
if(Link->InputUp == true && !isLSolidHorz(Link->Y+7)){
SaveY--;
}
else if(Link->InputDown == true && !isLSolidHorz(Link->Y+16)){
SaveY++;
}
if(Link->InputLeft == true && !Screen->isSolid(Link->X-1, Link->Y+8) && !Screen->isSolid(Link->X-1, Link->Y+15)){
SaveX--;
}
else if(Link->InputRight == true && !Screen->isSolid(Link->X+16, Link->Y+8) && !Screen->isSolid(Link->X+16, Link->Y+15)){
SaveX++;
}
}
Link->X = SaveX;
Link->Y = SaveY;
WasOnLadder = true;
SaveS=Game->GetCurDMapScreen();
SaveM=Game->GetCurDMap();
if(!aboutToScroll()){
Waitdraw();
Link->Dir=DIR_UP;
}
else{
Link->Invisible=true;
Screen->FastTile(3, Link->X, Link->Y, scrolltile, 6, 128);
}
}
else{
if(WasOnLadder == true){
Link->Jump = 0;
WasOnLadder = false;
}
SaveX = Link->X;
SaveY = Link->Y;
}
SaveS=Game->GetCurDMapScreen();
SaveM=Game->GetCurDMap();
Waitframe();
}
}
}
item script Roc{
void run(){
if(OnLadder() == true){
Link->Jump = 3;
}
}
}
item script NewScrollTile{
void run(int newtile){
scrolltile = newtile;
}
}
For both versions, int scrolltile is a tile of Link facing his assigned direction. item script NewScrollTile is a pickup script that sets scrolltile to the desired number, which is set by D0.
Edited by Isdrakthül, 26 July 2011 - 09:17 AM.
#27
Posted 25 July 2011 - 01:39 PM
script before was that it was really difficult to get off of the ladder to an adjacent
unwalkable combo. I needed Link to stand "on top" of the ladder.
Edited by Cukeman, 25 July 2011 - 01:40 PM.
#28
Posted 25 July 2011 - 02:47 PM
#29
Posted 25 July 2011 - 05:55 PM
Edited by Christian, 25 July 2011 - 05:55 PM.
#30
Posted 25 July 2011 - 06:18 PM
The tile itself is just for the frame directly before Link begins to scroll. I can't set Link's direction in that frame, so I needed to add it to prevent Link from turning to face a different direction for a moment.
I'm not entirely sure what you mean by the second sentence, though. I'll test it and see if I experience any glitches that could be described along those lines. EDIT: I tested it and it appears to be working.
Edited by Isdrakthül, 25 July 2011 - 06:26 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users