Jump to content

Photo

Hold a sword during using the GB-pegasus-boots


  • Please log in to reply
24 replies to this topic

#1 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 13 December 2010 - 07:22 AM

I'm using the Pegasus boots script from Joe123:
http://www.purezc.co...showtopic=38916

The script uses this function:

QUOTE
//Stops all Link's inputs
void NoAction(){
Link->InputUp = false;
Link->InputDown = false;
Link->InputLeft = false;
Link->InputRight = false;
Link->InputR = false;
Link->InputL = false;
Link->InputA = false;
Link->InputB = false;




But I want Link to hold his sword in front of him during the dashing (like in Links Awakening).

Is this possible anyhow?



(sorry for my bad english)

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 December 2010 - 09:41 AM

If you don't have "Select A button item", setting Link->InputA to true and perhaps setting Link->Action to stabbing would do the trick. Otherwise, you'll probably have to generate the sword with the script (actually an arrow that looks like a sword because Link's swords can't be made with scripts).

#3 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 13 December 2010 - 01:30 PM

Thank you for your answer. icon_smile.gif

But the problem is, I'm using the rule "select A button item"...

How can I generate the sword with the script? My scripting-knowledge is not the best...

(sorry for my bad english)

#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 December 2010 - 01:38 PM

I am not an expert scripter either, but I know the esword script has code to make a scripted sword (actually an arrow) and set its position to the position of an enemy every frame. It shouldn't be too hard to modify it into an Lweapon at Link's position.

Edit: I'm saying this in case a more practiced scripter comes along who knows how to turn this idea into a script.

Edited by MoscowModder, 13 December 2010 - 01:39 PM.


#5 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 14 December 2010 - 05:47 AM

OK, thank you. icon_smile.gif

Is there anywhere an expert-scripter, who can help me? XD

#6 Zepinho

Zepinho

    Experienced Forumer

  • Members
  • Location:Trieste, Italy

Posted 15 December 2010 - 05:40 PM

Here it is:
CODE

...
if(!PegasusCollision){
...
  //Play SFX
  if(DashCounter%DashSFXLength == 0) Game->PlaySound(SFX_DASH);


// using sword while running
if((GetEquipmentA()==I_SWORD1 || GetEquipmentB()==I_SWORD1) && DashCounter>10){
mysword = LoadLWeaponOf(LW_SCRIPT3);
if(!mysword->isValid()){
  mysword = Screen->CreateLWeapon(LW_SCRIPT3);
  mysword->Damage = 8;
}
mysword->UseSprite(0);
mysword->X = Link->X+InFrontX(Link->Dir, 6);
mysword->Y = Link->Y+InFrontY(Link->Dir, 6);
mysword->Dir = Link->Dir;
if(mysword->Dir < 2){
  if(mysword->Dir == DIR_DOWN) mysword->Flip = 3;
}
else{
  mysword->OriginalTile += 1;
  mysword->Tile = mysword->OriginalTile;
  if(mysword->Dir == DIR_LEFT) mysword->Flip = 1;
  mysword->Y += 3;
}
// slash the bushes
int loc = ComboAt(TouchedX()+InFrontX(mysword->Dir,4),TouchedY()+InFrontY(mysword->Dir,4));
bool playsound = true;
if(Screen->ComboT[loc] == CT_BUSH) Screen->ComboD[loc] = 0;
else if(Screen->ComboT[loc] == CT_TALLGRASS) Screen->ComboD[loc] = 0;
else if(Screen->ComboT[loc] == CT_BUSHNEXT) Screen->ComboD[loc] += 1;
else if(Screen->ComboT[loc] == CT_TALLGRASSNEXT) Screen->ComboD[loc] += 1;
else playsound = false;
if(playsound){
  // CreateGraphicAt(92,ComboX(loc),ComboY(loc)); // external function to create the graphic of a slashed bush
  Game->PlaySound(SFX_GRASSCUT);
  // ItemSetAt(IS_COMBOS,loc); // external function to randomly create an item
}
}
else Remove(mysword);


}
else{
  //Bounceback after hitting a wall
  NoAction();
...


You will need a little bit of work to implement this in your script, but anyway, this is just to give you a suggestion icon_wink.gif

#7 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 16 December 2010 - 06:06 AM

Thank you very much. icon_biggrin.gif

But I get some errors:


QUOTE
Function "mysword" is undeclared


But I think, i fixed that with writing "bool mysword;" on the top of the script.
[Edit: OK, "bool mysword;" doesn't fixed that...]


And the other errors:

QUOTE
Function "TouchedX" is undeclared

QUOTE
Function "TouchedY" is undeclared



I don't know, how to fix that.
Can you help me again please? icon_smile.gif

Edited by Lord Settra!, 16 December 2010 - 06:33 AM.


#8 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 16 December 2010 - 12:27 PM

mysword is not a bool it's a variable and it is declared in the script.

Make sure you have :

CODE

import "std.zh"


on top of the script file.

Edited by Christian, 16 December 2010 - 12:27 PM.


#9 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 16 December 2010 - 12:43 PM

I'm using about 20 scripts, so, yes, there is "import std.zh" on the top of my script file. icon_biggrin.gif

But thank you. ^^

#10 Kite

Kite

  • Members

Posted 17 December 2010 - 02:44 PM

"mysword" is probably an lweapon. While the script does try to set mysword, it doesn't have an actual initialization.

Try this at the top of the script:

CODE
lweapon mysword;


As for TouchedX() and TouchedY(), those are user created functions. You would need those functions from the person that provided the script to you for the script to be closer to working.

Edited by Nick, 17 December 2010 - 02:50 PM.


#11 Zepinho

Zepinho

    Experienced Forumer

  • Members
  • Location:Trieste, Italy

Posted 17 December 2010 - 03:43 PM

Yes, sorry,
you have to declare mysword:
CODE

lweapon mysword;


Also, you have to include these functions:
CODE

int TouchedX(){
int x;
if(Link->Dir == DIR_UP)         x = Link->X+8;
else if(Link->Dir == DIR_DOWN)  x = Link->X+8;
else if(Link->Dir == DIR_LEFT)  x = Link->X-2;
else if(Link->Dir == DIR_RIGHT) x = Link->X+18;
return x;
}

int TouchedY(){
int y;
if(Link->Dir == DIR_UP)         y = Link->Y+6;
else if(Link->Dir == DIR_DOWN)  y = Link->Y+18;
else if(Link->Dir == DIR_LEFT)  y = Link->Y+8;
else if(Link->Dir == DIR_RIGHT) y = Link->Y+8;
return y;
}


Tell me if there is anything else missing.
I have a very complicated set of scripts split among different files...

#12 symbiote01

symbiote01

    Doyen(ne)

  • Members
  • Real Name:Doug
  • Location:WA

Posted 17 December 2010 - 06:59 PM

I just implemented a version of this (minus the TouchedX and TouchedY stuff, which I worked out for myself) for my quest, that requires you to have the Pegasus Boots and a sword in A and B (or B and A, if you want), and also have an item 'Scroll: Dash Attack' to work. (If A is sword and B is Pegasus Boots and Link has the scroll, or if A is Pegasus Boots and B is sword and Link has the scroll, then DashAttack = true). The weapon's graphic and Damage change depending on which sword you have.

My version cuts grass like a dream, but:
Telling it to UseSprite(0) gave me no weapon at all, so I defined it's ->Tile instead.
In order to keep it from just drawing dozens of swords in a straight line whenever I ran, I put in a ->Deadstate time of 4, which makes the sword vanish after 4 frames (about as long as it takes for Link to rush past it). It doesn't like to cut bushes, though it will on occasion. I'm also having problems with it not damaging enemies, however (probably something on my end, as I am a very novice scripter).

I am very curious as to know if
CODE
ItemSetAt(IS_COMBOS,loc);

actually works, and if so, if the code for it could be shared. This would be of great help.

#13 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 19 December 2010 - 12:58 PM

Thank you. icon_smile.gif

But there is still another problem with "lweapon mysword;":

Errormessage:
QUOTE
Pointer Types (FFC, ETC) cannot be declared as global variables



Where should I declare it?

I declared it on the top of my script after
QUOTE
//Input Constants Pegasusboots
const int CF_DASH = 101; //Flag that Link can't dash through if walkable, and will break if solid
const int SFX_DASH = 82; //Dashing SFX
const int SFX_HITWALL = 84; //Hitting a wall
const int SFX_PEGASUSBREAK = 85; //SFX to play when breaking a Pegasus Boot block
const int T_DUST = 943; //Dust Kick-up tile
const int DustAFrames = 6; //Dust Kick-up animation frames
const int DustASpeed = 4; //Dust Kick-up animation speed
const int DustCSet = 8; //Dust Kick-up CSet
const int DashSFXLength = 9; //Time between repeating Dash SFX

//Variables
bool PegasusDash;
bool PegasusCollision;
int DashCounter;

lweapon mysword;
int TouchedX(){
int x;
if(Link->Dir == DIR_UP) x = Link->X+8;
else if(Link->Dir == DIR_DOWN) x = Link->X+8;
else if(Link->Dir == DIR_LEFT) x = Link->X-2;
else if(Link->Dir == DIR_RIGHT) x = Link->X+18;
return x;
}

int TouchedY(){
int y;
if(Link->Dir == DIR_UP) y = Link->Y+6;
else if(Link->Dir == DIR_DOWN) y = Link->Y+18;
else if(Link->Dir == DIR_LEFT) y = Link->Y+8;
else if(Link->Dir == DIR_RIGHT) y = Link->Y+8;
return y;
}


Edited by Lord Settra!, 19 December 2010 - 01:00 PM.


#14 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

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

Posted 19 December 2010 - 01:37 PM

Somewhere inside the ffc script outside the scope of PegasusCollision... probably right after "void run().

#15 Rastael

Rastael

    Wizard

  • Members
  • Real Name:Raphael
  • Location:Austria

Posted 19 December 2010 - 03:16 PM

There is no ffc-script.

This is an item-/global-script.

And after the voidrun(); of the global script doesn't work...


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users