Jump to content

Photo

Can't Continue this way Combo


  • Please log in to reply
20 replies to this topic

#1 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 06:24 AM

I want a combo that displays a string of my choosing when I stand on it. The string will usually say "You can't go this way" or something along those lines, it's best to let the script point to a string number I can use myself. After the string is displayed, Link walks back the opposite way a step. So to narrow down the main points:

 

> Link walks on tile and stops.

> String Appears.

> Link walks back the opposite direction he came for a single step. 



#2 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 08 December 2016 - 06:56 AM

//D0: The combo ID of the combo that you want to use for this. 
//D1: A timer, to ensure that messages don't repeat too quickly. I'd advice 60 or 80 for this.
//D2: The layer that you placed the combo onto.
//D3: The ZString that you want to display.
//D4: A sound effect ID that you wish to play, if any.

ffc script NotThisWayCombo{
	void run(int comboID , int delay, int layer, int msg, int sfx){
		int timer;
		int lastcombo = -1; int dir;
		while(true){
			if ( GetLayerComboD(layer, ComboAt(Link->X+8, Link->Y+8)) == comboID && !timer ) { //&& ComboAt(Link->X+8, Link->Y+8) != lastcombo ){
				timer = delay;
				lastcombo = ComboAt(Link->X+8, Link->Y+8);
				Screen->Message(msg);
				dir = Link->Dir;
				if ( sfx ) Game->PlaySound(sfx);
				for ( int q = 0; q < 32; q++ ) {
					if ( dir == DIR_UP && q%4 == 0 ) Link->Y += 1;
					if ( dir == DIR_DOWN && q%4 == 0 ) Link->Y -= 1;
					if ( dir == DIR_RIGHT && q%4 == 0 ) Link->X += 1;
					if ( dir == DIR_LEFT && q%4 == 0 ) Link->X -= 1;
					WaitNoAction();
				}
			}
			Waitframe();
		}
	}
}
 
Try that.

Edited by ZoriaRPG, 08 December 2016 - 10:03 AM.

  • ShadowTiger likes this

#3 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 08:16 AM

Okay thanks, I'll add it and test it now.

 

Oh ya, do you have setup instructions? I'm a novice with scripts. 


also: syntax error, unexpected identifier, on token it. (solved this error just now)

new error: variable Link is undeclared. (Wait... Link is undeclared? What? Seriously?)



#4 Saffith

Saffith

    IPv7 user

  • ZC Developers
  • Gender:Male

Posted 08 December 2016 - 09:26 AM

There's an uncapitalized instance on line 6 (the if statement).
  • NewJourneysFire likes this

#5 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 09:39 AM

So I don't really understand how to set this up. I'll need instructions from the looks of it.



#6 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 08 December 2016 - 10:05 AM

So I don't really understand how to set this up. I'll need instructions from the looks of it.


Edited above, plus what the D values do.

Place the ffc on the screen with the combo that you want to use for this.

D0 is the ID of that combo.
D1 is a delay timer, to prevent messages from repeating. Try using 60.
D2 is the layer on which you placed the combo (D0).
D3 is the message ID.
D4 is a sound ID from Quest->Audio->SFX. Use '0' for none.

#7 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 12:03 PM

Script not working.

 

I'm using combo 1 on layer 0.

 

Cheats tell me that script is active, but they aren't doing anything.

 

Also, this quest has diagonal movement just for the record.. Not sure if this needs to be taken into account. 



#8 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 08 December 2016 - 12:13 PM

Script not working.
 
I'm using combo 1 on layer 0.
 
Cheats tell me that script is active, but they aren't doing anything.
 
Also, this quest has diagonal movement just for the record.. Not sure if this needs to be taken into account.


Did you remember to set the ffc's data (combo) to combo 1 as well; or is that what you meant?

An ffc that is still set to use combo 0 won't actually run its script, but it will still display what scripts are on the screen.

#9 Dimentio

Dimentio

    Edgy unwanted opinions

  • Members
  • Real Name:Joshua
  • Gender:Male
  • Location:America's Hat.

Posted 08 December 2016 - 12:18 PM

Also, this quest has diagonal movement just for the record.. Not sure if this needs to be taken into account. 

Yeah, it doesn't appear to account for that. I'd recommend holding a direction via script and disabling all the other inputs. I'd also recommend maybe having Link be almost entirely on the combo on either the X or Y plane to make it look good.

EDIT: Also, did you set the D0 of the FFC to the Combo ID (the number of the combo in the combo list that pushes you back, not the combo type?)


Edited by Dimentio, 08 December 2016 - 12:20 PM.


#10 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 12:27 PM

Both the FFC and d0 was set to combo 1.



#11 Dimentio

Dimentio

    Edgy unwanted opinions

  • Members
  • Real Name:Joshua
  • Gender:Male
  • Location:America's Hat.

Posted 08 December 2016 - 12:32 PM

And did you place Combo 1 on layer 0 where you wanted Link to be moved?



#12 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 12:38 PM

And did you place Combo 1 on layer 0 where you wanted Link to be moved?

I get it now. I thought you actually step on the FFCs themselves. 


Okay, so the message popped up, but the script literally pushed Link towards the direction he was walking. Also, it only happened once so if Link tried to leave again the script was no longer functional.

 

I want to present the image that Link himself is walking back (or conforming) to the message that is being presented. Thus ignoring it the 2nd time you walk on it probably defeats the purpose as well. 



#13 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 08 December 2016 - 02:11 PM

I was diagonal movement with this script right now, as it happens. This script should prevent glitching through the barriers:

Both of those above issues, I had fixed about 20 minutes ago, and then I noticed the diagonal movement issue, and I knew I had to resolve it.
 
Try this out...
 
//D0: The combo ID of the combo that you want to use for this. 
//D1: A timer, to ensure that messages don't repeat too quickly. I'd advice 60 or 80 for this.
//D2: The layer that you placed the combo onto.
//D3: The ZString that you want to display.
//D4: A sound effect ID that you wish to play, if any.

ffc script NotThisWayCombo{
	void run(int comboID , int delay, int layer, int msg, int sfx){
		int adj[10]; //x = 0, y = 1; dir = 2, timer = 3, 5 = loc
		//int lastcombo = -1; int timer; int dir; 
		while(true){
			//! this could be good for solid damage combos
			if ( adj[3] ) adj[3]--;
			if ( adj[3] <= 0 ) adj[3] = 0;
			if ( Link->Dir == DIR_LEFT ) { adj[0] = 2; adj[1] = 8;}
			if ( Link->Dir == DIR_RIGHT ) { adj[0] = 7; adj[1] = 8;}
			if ( Link->Dir == DIR_DOWN ) { adj[1] = 14; adj[0] = 8; }
			if ( Link->Dir == DIR_UP ) { adj[1] = 6; adj[0] = 8; }
			adj[2] = Link->Dir;
			if ( ( GetLayerComboD(layer, ComboAt(Link->X+8, Link->Y+8)) == comboID ) || ( GetLayerComboD(layer, ComboAt(Link->X+adj[0], Link->Y+adj[1]) ) == comboID ) && !adj[3] ) { //&& ComboAt(Link->X+8, Link->Y+8) != lastcombo ){
				adj[3] = delay;
				adj[4] = ComboAt(Link->X+8, Link->Y+8);
				//lastcombo = ComboAt(Link->X+8, Link->Y+8);
				Screen->Message(msg);
				
				
				if ( sfx ) Game->PlaySound(sfx);
				for ( int q = 0; q < 32; q++ ) {
						//he's on the left edge of the screen 
					if ( adj[2] == DIR_UP && q%4 == 0 ) { 
						if ( ComboAt(Link->X, Link->Y-2) > 0x9F ) break;
						if ( CanWalk(Link->X, Link->Y, DIR_DOWN,1, false) 
							&& GetLayerComboD(layer, ComboAt(Link->X, Link->Y+16) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+4, Link->Y+16) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+8, Link->Y+16) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+12, Link->Y+16) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+15, Link->Y+16) )!= comboID
							) Link->Y += 1;
						if ( GridY(Link->Y) == Link->Y ) break;
					}
					if ( adj[2] == DIR_DOWN && q%4 == 0 ) {
						if ( ComboAt(Link->X, Link->Y+18) < 0x10 ) break;
						if ( CanWalk(Link->X, Link->Y, DIR_UP,1, false) 
							&& GetLayerComboD(layer, ComboAt(Link->X, Link->Y-1) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+4, Link->Y-1) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+8, Link->Y-1) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+12, Link->Y-1) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+15, Link->Y-1) )!= comboID
							) Link->Y -= 1;
						if ( GridY(Link->Y) == Link->Y ) break;
					}
					if ( adj[2] == DIR_RIGHT && q%4 == 0 ) {
						if ( ComboAt(Link->X, Link->Y) % 16 == 0 ) break;
						if ( CanWalk(Link->X, Link->Y, DIR_LEFT,1, false) 
							&& GetLayerComboD(layer, ComboAt(Link->X-1, Link->Y) ) != comboID
							&& GetLayerComboD(layer, ComboAt(Link->X-1, Link->Y+4) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X-1, Link->Y+8) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X-1, Link->Y+12) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X-1, Link->Y+15) )!= comboID
							) Link->X -= 1;
						if ( GridX(Link->X-2) == Link->X ) break;
					}
					if ( adj[2] == DIR_LEFT && q%4 == 0 ) {
						if ( (ComboAt(Link->X+18, Link->Y) & 15) == 1 ) break;
						if ( CanWalk(Link->X, Link->Y, DIR_RIGHT,1 ,false) 
							&& GetLayerComboD(layer, ComboAt(Link->X+16, Link->Y) ) != comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+16, Link->Y+4)) != comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+16, Link->Y+8) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+16, Link->Y+12) )!= comboID
							&& GetLayerComboD(layer, ComboAt(Link->X+16, Link->Y+15) )!= comboID
							) Link->X += 1;
						if ( GridX(Link->X) == Link->X ) break;
					}
					WaitNoAction();
				}
			}
			Waitframe();
		}
	}
}
Plus a test quest that will demonstrate the set-up.

This might be an interesting way to handle solid damage combos, too. Just force Link->HitDir to -1, and get rid of the message.

If Link enters at an odd angle, the script won't move him, but the player gains control. That isn't an ideal solution, but as a temporary work-around, it gives you something to work with.

I have an idea for how to determine the point of entry for diagonal movement, and such, too.

Edited by ZoriaRPG, 08 December 2016 - 02:16 PM.


#14 NewJourneysFire

NewJourneysFire

    Deified

  • Contributors
  • Real Name:Grant
  • Gender:Male

Posted 08 December 2016 - 03:02 PM

With this current setup you can literally just force yourself into the tile. 

 

 

I also tested this by making the combos solid because maybe that was your intention, and the message string doesn't appear.



#15 ZoriaRPG

ZoriaRPG

    ZC Contributor & Wiki Editor

  • Members
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 08 December 2016 - 03:19 PM

With this current setup you can literally just force yourself into the tile. 
 

 
I also tested this by making the combos solid because maybe that was your intention, and the message string doesn't appear.


I know, hence why I said, 'temporary'.

What I'm going to have to do, is store Link's coordinates, until he enters the forbidden space; then use a vector between his present position, and the stored coordinates, to walk him back. Will him backtracking along diagonals and such, and not necessarily falling dead into the centre of a grid square, be problems?

I could also use DrawString, and drawing, instead of Screen->Message, as that's what is allowing you to brute-force through it.

Alternatively, I could set those tiles solid, temporarily. That would be the absolute easiest way.

(I popped out four builds of ZC in the last 24 hours, after about 12 hours of coding, merging, and doing other things that are mentally debilitating. If I missed an easier way to do this, you can all have a good laugh.)

Edited by ZoriaRPG, 08 December 2016 - 03:23 PM.

  • ShadowTiger likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users