Some scripts for a sideview gravity area?
Started by
Moosh
, Jun 03 2010 07:21 PM
11 replies to this topic
#1
Posted 03 June 2010 - 07:21 PM
I was wondering if someone could either make or send me a link to these scripts (if they already exist)
1. A ladder combo that link can walk up and down on without falling
2. A block combo that link will stick to and can wall jump off of (no extra animations needed)
1. A ladder combo that link can walk up and down on without falling
2. A block combo that link will stick to and can wall jump off of (no extra animations needed)
#2
Posted 04 June 2010 - 02:31 AM
Hi!
For the ladder: http://zctut.com/ladder.php
For the second one, I'm not sure I understand what you mean, but may be you can use the ladder script in some way...
For the ladder: http://zctut.com/ladder.php
For the second one, I'm not sure I understand what you mean, but may be you can use the ladder script in some way...
#4
Posted 04 June 2010 - 02:55 PM
I would in my quest require the feather, but because someone else might use it, could you maybe make it a variable?
#5
Posted 04 June 2010 - 03:45 PM
Hi!
For the ladder: http://zctut.com/ladder.php
For the second one, I'm not sure I understand what you mean, but may be you can use the ladder script in some way...
That script from pkmnfrk's website breaks in the newer builds. So it wouldn't be a good idea to get that one.
#6
Posted 04 June 2010 - 04:12 PM
I would in my quest require the feather, but because someone else might use it, could you maybe make it a variable?
That's no problem. Would you rather it be in a global, or FFC script?
EDIT: Whoop. Roadblock. This one isn't too difficult, just need to know, does the GetEquipment function return the values of the I_ Constants?
Edited by Master Maniac, 04 June 2010 - 04:53 PM.
#7
Posted 05 June 2010 - 11:34 AM
Yes.
#8
Posted 28 June 2010 - 09:04 PM
CODE
int cmb1=716; //These will be the combos that link can wall-jump from.
int cmb2=716; //MAKE SURE THEY'RE SOLID COMBOS!!!
int cmb3=716;
int sound=0; //the ID of your jump sound.
int waittime=30; //the amount of time to wait (in frames) before link is able to jump after completing a wall jump
//Remember, 30 frames = 1 second
int jheight=4; //Number of tiles high link should be able to jump. (Feather jump is 3)
if(ScreenFlag(SF_ROOMTYPE, 2) > 0){ //checks for sideview flag
if(GetEquipmentA()==I_ROCSFEATHER){ //Checks if feather is equipped to "A"
//the following checks the combo to the left of link's ID, checks if link is facing to the left,
//and checks if link presses "A"
if((Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb3)){
if(Link->Dir==DIR_LEFT && Link->InputA){
Link->Dir=DIR_RIGHT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
//the following checks the combo to the right of link's ID, checks if link is facing to the right,
//and checks if link presses "A".
else if((Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb3)){
if(Link->Dir==DIR_RIGHT && Link->InputA){
Link->Dir=DIR_LEFT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
}
else if(GetEquipmentB()==I_ROCSFEATHER){ //Checks if feather is equipped to "B"
//the following checks the combo to the right of link's ID, checks if link is facing to the right,
//and checks if link presses "B".
if((Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb3)){
if(Link->Dir==DIR_RIGHT && Link->InputB){
Link->Dir=DIR_LEFT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
//the following checks the combo to the left of link's ID, checks if link is facing to the left,
//and checks if link presses "B"
else if((Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb3)){
if(Link->Dir==DIR_LEFT && Link->InputB){
Link->Dir=DIR_RIGHT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
}
}
int cmb2=716; //MAKE SURE THEY'RE SOLID COMBOS!!!
int cmb3=716;
int sound=0; //the ID of your jump sound.
int waittime=30; //the amount of time to wait (in frames) before link is able to jump after completing a wall jump
//Remember, 30 frames = 1 second
int jheight=4; //Number of tiles high link should be able to jump. (Feather jump is 3)
if(ScreenFlag(SF_ROOMTYPE, 2) > 0){ //checks for sideview flag
if(GetEquipmentA()==I_ROCSFEATHER){ //Checks if feather is equipped to "A"
//the following checks the combo to the left of link's ID, checks if link is facing to the left,
//and checks if link presses "A"
if((Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb3)){
if(Link->Dir==DIR_LEFT && Link->InputA){
Link->Dir=DIR_RIGHT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
//the following checks the combo to the right of link's ID, checks if link is facing to the right,
//and checks if link presses "A".
else if((Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb3)){
if(Link->Dir==DIR_RIGHT && Link->InputA){
Link->Dir=DIR_LEFT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
}
else if(GetEquipmentB()==I_ROCSFEATHER){ //Checks if feather is equipped to "B"
//the following checks the combo to the right of link's ID, checks if link is facing to the right,
//and checks if link presses "B".
if((Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X+18, Link->Y)]==cmb3)){
if(Link->Dir==DIR_RIGHT && Link->InputB){
Link->Dir=DIR_LEFT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
//the following checks the combo to the left of link's ID, checks if link is facing to the left,
//and checks if link presses "B"
else if((Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb1||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb2||Screen->ComboD[ComboAt(Link->X-5, Link->Y)]==cmb3)){
if(Link->Dir==DIR_LEFT && Link->InputB){
Link->Dir=DIR_RIGHT;
Link->Jump=jheight;
Game->PlaySound(sound);
Waitframes(waittime);
}
}
}
}
Alright. So here's a walljump script. Just put this inside of the while loop of your global script
It is missing something, though. I had a lot of trouble with it, so I eventually just gave up, but link doesn't rebound from the wall. I couldn't make it work properly, so I left it out. I'm going to look for help on that part, if you want it. Otherwise, this works just as intended (because if link is jumping, and the player isn't pressing in a direction, then link will stay still in the air, but he can move after being still. This script keeps the same function.)
Enjoy! =)
#9
Posted 08 August 2010 - 12:07 PM
CODE
import "std.zh"
//global variables go here
bool has_hover = false;
bool on_ladder = false;
global script onstart {
void run() {
//one time things go here
bool isSolid(int x, int y) {
if(x<0 || x>255 || y<0 || y>175) return false;
int mask=1111b;
if(x % 16 < 8)
mask &= 0011b;
else
mask &= 1100b;
if(y % 16 < 8)
mask &= 0101b;
else
mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x, y)] & mask;
return (ret!=0);
}
void ladder(int f) {
int lc;
lc = ComboAt(Link->X+8, Link->Y+15); //for speed
if(Screen->ComboF[lc] == f || Screen->ComboI[lc] == f) {
if(!on_ladder) {
on_ladder = true;
has_hover = Link->Item[I_HOVERBOOTS];
Link->Item[I_HOVERBOOTS] = false;
}
Link->Jump = 0;
Link->Z = 0;
Link->Dir = DIR_UP;
if(Link->InputDown) {
Link->InputDown = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X, Link->Y + 16)) Link->Y += 1;
}
if(Link->InputUp) {
Link->InputUp = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
}
if(Link->InputLeft) {
Link->InputLeft = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X - 1 , Link->Y)) Link->X -= 1;
}
if(Link->InputRight) {
Link->InputRight = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X + 16, Link->Y)) Link->X += 1;
}
} else {
if(on_ladder) {
Link->Item[I_HOVERBOOTS] = has_hover;
on_ladder = false;
}
}
}
while(true) {
//function calls go here
ladder(98);
Waitframe();
}
}
//functions go here
}
//global variables go here
bool has_hover = false;
bool on_ladder = false;
global script onstart {
void run() {
//one time things go here
bool isSolid(int x, int y) {
if(x<0 || x>255 || y<0 || y>175) return false;
int mask=1111b;
if(x % 16 < 8)
mask &= 0011b;
else
mask &= 1100b;
if(y % 16 < 8)
mask &= 0101b;
else
mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x, y)] & mask;
return (ret!=0);
}
void ladder(int f) {
int lc;
lc = ComboAt(Link->X+8, Link->Y+15); //for speed
if(Screen->ComboF[lc] == f || Screen->ComboI[lc] == f) {
if(!on_ladder) {
on_ladder = true;
has_hover = Link->Item[I_HOVERBOOTS];
Link->Item[I_HOVERBOOTS] = false;
}
Link->Jump = 0;
Link->Z = 0;
Link->Dir = DIR_UP;
if(Link->InputDown) {
Link->InputDown = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X, Link->Y + 16)) Link->Y += 1;
}
if(Link->InputUp) {
Link->InputUp = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
}
if(Link->InputLeft) {
Link->InputLeft = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X - 1 , Link->Y)) Link->X -= 1;
}
if(Link->InputRight) {
Link->InputRight = false;
Link->Action = LA_WALKING;
if(!isSolid(Link->X + 16, Link->Y)) Link->X += 1;
}
} else {
if(on_ladder) {
Link->Item[I_HOVERBOOTS] = has_hover;
on_ladder = false;
}
}
}
while(true) {
//function calls go here
ladder(98);
Waitframe();
}
}
//functions go here
}
So this is the code I got from http://zctut.com/ladder.php
...and it will not compile correctly. I know this is an old script by this threat is not that old, so can someone help with this please.
#10
Posted 08 August 2010 - 12:25 PM
CODE
const int CF_LADDER = 98; //CF_SCRIPT1
//global variables go here
bool hasHoverBoots = false;
bool onLadder = false;
global script Slot2
{
void run()
{
while(true)
{
Ladder();
Waitdraw();
LadderDir();
Waitframe();
}
}
void Ladder()
{
if(!ScreenFlag(SF_ROOMTYPE, 2))
return;
if(!ComboFI(Link->X + 8, Link->Y + 15, CF_LADDER))
{
if(onLadder)
{
Link->Item[I_HOVERBOOTS] = hasHoverBoots;
onLadder = false;
}
return;
}
if(!onLadder)
{
onLadder = true;
hasHoverBoots = Link->Item[I_HOVERBOOTS];
Link->Item[I_HOVERBOOTS] = false;
}
Link->Jump = 0;
Link->Z = 0;
Link->Dir = DIR_UP;
if(Link->InputDown)
{
Link->InputDown = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X, Link->Y + 16))
Link->Y++;
}
if(Link->InputUp)
{
Link->InputUp = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X, Link->Y - 1))
Link->Y--;
}
if(Link->InputLeft)
{
Link->InputLeft = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X - 1 , Link->Y))
Link->X--;
}
if(Link->InputRight)
{
Link->InputRight = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X + 16, Link->Y))
Link->X++;
}
}
void LadderDir()
{
if(onLadder)
Link->Dir = DIR_UP;
}
}
//global variables go here
bool hasHoverBoots = false;
bool onLadder = false;
global script Slot2
{
void run()
{
while(true)
{
Ladder();
Waitdraw();
LadderDir();
Waitframe();
}
}
void Ladder()
{
if(!ScreenFlag(SF_ROOMTYPE, 2))
return;
if(!ComboFI(Link->X + 8, Link->Y + 15, CF_LADDER))
{
if(onLadder)
{
Link->Item[I_HOVERBOOTS] = hasHoverBoots;
onLadder = false;
}
return;
}
if(!onLadder)
{
onLadder = true;
hasHoverBoots = Link->Item[I_HOVERBOOTS];
Link->Item[I_HOVERBOOTS] = false;
}
Link->Jump = 0;
Link->Z = 0;
Link->Dir = DIR_UP;
if(Link->InputDown)
{
Link->InputDown = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X, Link->Y + 16))
Link->Y++;
}
if(Link->InputUp)
{
Link->InputUp = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X, Link->Y - 1))
Link->Y--;
}
if(Link->InputLeft)
{
Link->InputLeft = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X - 1 , Link->Y))
Link->X--;
}
if(Link->InputRight)
{
Link->InputRight = false;
Link->Action = LA_WALKING;
if(!Screen->isSolid(Link->X + 16, Link->Y))
Link->X++;
}
}
void LadderDir()
{
if(onLadder)
Link->Dir = DIR_UP;
}
}
#11
Posted 08 August 2010 - 11:04 PM
Thanks Joe, but I get and error on line 11 on the WaitDraw function. is there another library I have to import? I'm using build 1283!
#12
Posted 09 August 2010 - 04:32 AM
Oh, oops. Waitdraw doesn't have a capital D. I edited the post above, grab it again.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users