Jump to content

Photo

I Need Dungeon Entry Script To Repeat*


  • Please log in to reply
12 replies to this topic

#1 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 08 March 2019 - 02:53 AM

I want a working 'String'  Dungeon Entry Script:

 

I want it to 'Repeat' it's action when you leave the DMap and return to that DMAP. 

The String will Re-Appear again.

 

This FFC would be placed on a Dungeon Entry where it shows    ( LEVEL-1   Fruitbat's Palace )

Just like in Link's Awakening gameboy game for example. Where it shows:  ( Level-1 Tail Cave )

 

(I don't like the built in Dmap intro in ZC,  It has No background to it so you can't see the title on

my Dungeon entries is why. So i am using A FFC String because it looks better.

-----

 

Can somebody Fix this script below so that it does this??

-----

 

ffc script StringOnce{
     void run(int m, int delay, int d){
          if ( Screen->D[d] == 0 ) {
               Screen->D[d] = 1;
               Waitframes(delay);
               Screen->Message(m);
          }
     }
}

 



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 March 2019 - 05:15 AM

WIP

script typedef ffc struct;
script typedef ffc class;

stuct script locations
{
	enum{ curDMAP, curSCREEN, curLEVEL, pvsDMAP, pvsSCREEN, pvsLEVEL, locLAST};
	int data[locLAST];
	void run(){}
	void clear() for ( int q = 0; q < locLAST; ++q ) data[q] = 0;
	bool changed() { return ( Game->GetCurDMap() != data[curDMAP] || Game->GetCurScreen() != data[curSCREEN] ); }
	bool dmapchanged() { return ( Game->GetCurDMap() != data[curDMAP] ); }
	bool screenchanged() { return ( Game->GetCurScreen() != data[curSCREEN] ); }
	bool levelchanged() { return ( Game->GetCurLevel() != data[curLEVEL] ); }
	int priorDMap() { return ( data[pvsDMAP] );
	void update()
	{
		data[pvsSCREEN] = data[curSCREEN];
		data[pvsDMAP] = data[curDMAP];
		data[curSCREEN] = Game->GetCurScreen();
		data[curDMAP] = Game->GetCurDMap();
	}
	void update_dmap()
	{
		data[pvsDMAP] = data[curDMAP];
		data[curDMAP] = Game->GetCurDMap();
	}
	void update_level()
	{
		data[pvsLEVEL] = data[curLEVEL];
		data[curLEVEL] = Game->GetCurLevel();
	}
	void update_screen()
	{
		data[pvsSCREEN] = data[curSCREEN];
		data[curSCREEN] = Game->GetCurScreen();
	}
	
}

class script screenintros
{
	const int REGISTER = 6;
	const int BIT = 2;
	void run(){}
	void clear()
	{
		for ( int q = 0; q < 0x80; ++q )
		{
			SetScreenDBit(locations.data[pvsDMAP], q, REG, BIT, false);
		}
	}
	void update()
	{
	
		if ( locations.levelchanged() )
		{
			locations.update_level();
			clear(); /Re-display after changing dmaps, like DMap intros repeat, but for screens.
		}
	}
}

link script active
{
	void run()
	{
		while(1)
		{
			screenintros.update();
			
			Waitframe();
		}
	}
}

//Does not repeat if you revisit the screen, unless you change dmaps. 
ffc script screenmessage
{

	const int REGISTER = 6;
	const int BIT = 2;
	const int DELAY_DEFAULT = 150;
	void run(int delay, int reg )
	{
		reg = ( reg > 0 ) ? reg : REGISTER;
		delay = ( delay > 0 ) ? delay : DELAY_DEFAULT;
		
		while(1)
		{
			if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), REG, BIT)); )
			{
				Waitframes(delay);
				Screen->Message(Screen->String);
				SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), REG, BIT, true);
			}
			Waitframe();
		}
	}
}

link script init
{
	void run()
	{
		locations.clear();
		locations.clear(); //Call twice to push the previous screen down. 
	}
}

npc script screenguy
{
	void run(int delay)
	{
		delay = this->InitD[0];
		if ( !Screen-RoomType )
		{
			if ( Screen->CatchAll )
			{
				delay = Screen->CatchAll;
			}
		}
		this->CollDetection = false;
		//this->DrawYOffset = -32768;
		//Waitframes(Screen->CatchAll); //might be in use depending on room type
		Waitframes(delay);
		Screen->Message(Screen->String);
	}
}
		

  • SkyLizardGirl likes this

#3 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 08 March 2019 - 06:52 PM

Thank you.*   I will try this.

 

Do i need to change anything in it?



#4 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 08 March 2019 - 07:23 PM

Ok it said there was Compile error



#5 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 08 March 2019 - 08:19 PM

ffc script DungeonOutside{
    void run(int misc){
        Link->Misc[misc] = Game->GetCurDMap();
    }
}

ffc script StringDungeon{
    void run(int m, int delay, int misc){
        if (Link->Misc[misc] != Game->GetCurDMap()){
            Waitframes(delay);
            Screen->Message(m);
        }
    }
}

Place DungeonOutside script on the screen that has the entrance to the dungeon.
Place StringDungeon script on the first screen of the dungeon.
Set D0 of StringDungeon to the string you want to play.
Set D1 of StringDungeon to how many frames you want it to wait before it plays the string (a frame is equal to 1/60th of a second; 1 second is 60 frames).


  • SkyLizardGirl likes this

#6 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 08 March 2019 - 09:31 PM

Thank you.*   can i enter this into the data base also?

 

Ty.* \0~0/


  • Deedee likes this

#7 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 08 March 2019 - 10:26 PM

Sure, go ahead.


  • SkyLizardGirl likes this

#8 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 08 March 2019 - 11:17 PM

\0~0/ Oks i dids.*  I Put you as creator of the script.

 

Will take time for the entry to appear.


Edited by SkyLizardGirl, 08 March 2019 - 11:18 PM.


#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 March 2019 - 02:56 AM

ffc script DungeonOutside{
    void run(int misc){
        Link->Misc[misc] = Game->GetCurDMap();
    }
}

ffc script StringDungeon{
    void run(int m, int delay, int misc){
        if (Link->Misc[misc] != Game->GetCurDMap()){
            Waitframes(delay);
            Screen->Message(m);
        }
    }
}
Place DungeonOutside script on the screen that has the entrance to the dungeon.
Place StringDungeon script on the first screen of the dungeon.
Set D0 of StringDungeon to the string you want to play.
Set D1 of StringDungeon to how many frames you want it to wait before it plays the string (a frame is equal to 1/60th of a second; 1 second is 60 frames).


Isn't Misc[] cleared on death->continue? I could swear that Link.init() runs whenever his sprite is reinitialised, including both loading a quest from a save, [i[and[/i] on continue from death, or F6.

If so, then this message would continually play, per session, on every death. IDK if that's intended, but I suspect that it is not desired; although it's a good attempt at minimalism.

(I'd also use Level ID, and not DMap ID for this.)

That said, the script won't work, because assigning the current DMap outside the level will also need to occur, inside the level, or the ffc will always repeat running.
  • SkyLizardGirl likes this

#10 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 09 March 2019 - 03:36 AM

I ams realizing there are in fact different ways to do this.

 

The Dungeon ID Level thing i think could simplize it more, besides a combo outside and inside a dungeon.

 

There should be ways to access a pull-down list of currently installed scripts even for the Dmap itself i am thinking.

So that way everything works from the Dmap.

 

Reason is, you may be able to do other things like even cut-scenes easier and stuff i am envisioning.

It is hard to explain for me right now but,  i will eventually get to cut-scenes i have planned as another phase in my game developing 'scenes'  as the hero progresses dungeons.

 

In my game:   The 9 Generals start noticing things in the land changing after you beat the first 2 dungeons each.

The Single Strings can be useful for this - Scenes that happen only 1 time.

While the dungeon entry strings are useful for their items to repeat entry titles.

 

I am not considering just using 1 script over another - i plan to use all these tools you make together Zoria.

This is opening whole new future development ZC paths up.


Edited by SkyLizardGirl, 09 March 2019 - 03:43 AM.


#11 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 09 March 2019 - 06:05 AM

Completed Script | Demo Quest

 

You can use either the ffc script screenmessage, or an enemy on the screen, using the npc script screenguy. I did the latter of these two, in the example quest, as it is obviously more useful to show people how to set up npc scripts.

 

Don't forget to assign Link's scripts!
 

//v0.5 - 9th march, 2019
//Revision History

//v0.2
//v0.3
//v0.4 Fix compile
//v0.5 Update DMaps after Levels in Link Active


script typedef ffc struct;
script typedef ffc class;

struct script locations
{
	enum{ curDMAP, curSCREEN, curLEVEL, pvsDMAP, pvsSCREEN, pvsLEVEL, locLAST};
	int data[locLAST];
	void run(){}
	void clear() { for ( int q = 0; q < locLAST; ++q ) data[q] = 0; }
	bool changed() { return ( Game->GetCurDMap() != data[curDMAP] || Game->GetCurScreen() != data[curSCREEN] ); }
	bool dmapchanged() { return ( Game->GetCurDMap() != data[curDMAP] ); }
	bool screenchanged() { return ( Game->GetCurScreen() != data[curSCREEN] ); }
	bool levelchanged() { return ( Game->GetCurLevel() != data[curLEVEL] ); }
	int priorDMap() { return ( data[pvsDMAP] ); }
	void update()
	{
		data[pvsSCREEN] = data[curSCREEN];
		data[pvsDMAP] = data[curDMAP];
		data[curSCREEN] = Game->GetCurScreen();
		data[curDMAP] = Game->GetCurDMap();
	}
	void update_dmap()
	{
		data[pvsDMAP] = data[curDMAP];
		data[curDMAP] = Game->GetCurDMap();
	}
	void update_level()
	{
		data[pvsLEVEL] = data[curLEVEL];
		data[curLEVEL] = Game->GetCurLevel();
	}
	void update_screen()
	{
		data[pvsSCREEN] = data[curSCREEN];
		data[curSCREEN] = Game->GetCurScreen();
	}
	
}

class script screenintros
{
	const int REGISTER = 6;
	const int BIT = 2;
	void run(){}
	void clear()
	{
		for ( int q = 0; q < 0x80; ++q )
		{
			SetScreenDBit(locations.data[locations.pvsDMAP], q, REGISTER, BIT, false);
		}
	}
	void update()
	{
	
		if ( locations.levelchanged() )
		{
			locations.update_level();
			locations.update_dmap();
			clear(); //Re-display after changing dmaps, like DMap intros repeat, but for screens.
		}
	}
}

link script active
{
	void run()
	{
		while(1)
		{
			screenintros.update();
			
			Waitframe();
		}
	}
}

//Does not repeat if you revisit the screen, unless you change dmaps. 
ffc script screenmessage
{

	const int REGISTER = 6;
	const int BIT = 2;
	const int DELAY_DEFAULT = 1;
	void run(int delay, int reg, int bit )
	{
		reg = ( reg > 0 ) ? reg : REGISTER;
		bit = ( bit > 0 ) ? reg : BIT;
		delay = ( delay > 0 ) ? delay : DELAY_DEFAULT;
		
		while(1)
		{
			if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit)) )
			{
				Waitframes(delay);
				Screen->Message(Screen->String);
				SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit, true);
			}
			Waitframe();
		}
	}
}

link script init
{
	void run()
	{
		locations.clear();
		locations.clear(); //Call twice to push the previous screen down. 
	}
}

///////////////////////////
/// NPC Script Room Guy ///
/// v0.3                ///
/// 8th March, 2019     ///
/// By: ZoriaRPG        ///
///////////////////////////

//ZQuest Screen Menu Sets Options
//Set Screen->String to the string to display
//Set Screen->Catchall to the delay time, if the roomtype is none.
//Otherwise, you can set a default delay on the enemy using D0. 

//v0.2 Initial Fixes
//v0.3 Added Once Only Behavioural Flag

npc script screenguy
{
	const int DELAY = 20; //Time to spawn. 
	const int BFLAG_ONCE = 4;
	const int REGISTER = 6;
	const int BIT = 2;
	void run(int delay, int reg, int bit)
	{
		delay = this->InitD[0] > 0 ? delay : DELAY;
		reg = this->InitD[1] > 0 ? reg : REGISTER;
		bit = this->InitD[2] > 0 ? bit : BIT;
		
		if ( !Screen->RoomType )
		{
			if ( Screen->Catchall )
			{
				delay = Screen->Catchall;
			}
		}
		this->CollDetection = false;
		//this->DrawYOffset = -32768;
		//Waitframes(Screen->Catchall); //might be in use depending on room type
		Waitframes(delay);
		
		if ( this->BFlags[BFLAG_ONCE] ) 
		{
			if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit)) )
			{
				Screen->Message(Screen->String);
				SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit, true);
			}
		}
		else Screen->Message(Screen->String);
	}
}

  • SkyLizardGirl likes this

#12 SkyLizardGirl

SkyLizardGirl

    Unbeknownst to danger we call upon your help

  • Banned
  • Real Name:Arianna Crystal Ritter
  • Location:Earthia

Posted 09 March 2019 - 01:05 PM

Thank you Zoria, I will get to work on this also if is finished.*

0~0



#13 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 09 March 2019 - 01:10 PM

That said, the script won't work, because assigning the current DMap outside the level will also need to occur, inside the level, or the ffc will always repeat running.

 

...The most important thing, and I forget it. Lovely.


  • SkyLizardGirl likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users