Jump to content

Photo

Better than a lens


  • Please log in to reply
26 replies to this topic

#16 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Location:Earth

Posted 24 September 2018 - 09:17 AM

Yes, something like that.

 

I plan on using overheads that obscure the players view of the path as well as obstacles that would trigger out of the path once the "Compass" has been acquired.

 

I know it would be simple enough to use triggers to remove these, but I would prefer to leave the secret triggers for other events that the player can do once the "way is cleared".



#17 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 24 September 2018 - 09:44 AM

This is UNTESTED

const int I_MAGICCOMPASS = 125; //Set this to your compass item's ID
const int CF_MAZESECRET = 100; //Set this to whichever secret combo flag you want to use
const int C_CLEAREDPATH = 5; //Set this to the combo ID of whatever the cleared path will be. This could be the same as your regular ground combo.

//Place the following inside your global before while(true){

int curscreen;

//Place the following inside your global above Waitframe();

if(Link->Item[I_MAGICCOMPASS] && Game->GetCurScreen() != curscreen)
{
  curscreen = Game->GetCurScreen();
  for(int i = 0; i <= 176; i++)
  {
    if(Screen->ComboF[i] == CF_MAZESECRET) Screen->ComboD[i] = C_CLEAREDPATH;
  }
}

You'll need to set the specific constants to whatever you use for your quest, then you should just be able to have that item in inventory and whenever the screen changes it will check for that flag and replace any combos that have that flag on them with the combo you specify.


Edited by jsm116, 24 September 2018 - 09:45 AM.


#18 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Location:Earth

Posted 24 September 2018 - 11:58 AM

Perfect!! Thank you very much.

 

The other secrets on the screens remain intact to be triggered separately as well?

 

I definitely appreciate this!!

 

It also looks like I will need to have a few global scripts combined. This one would make my 3rd.


Edited by Rocksfan13, 24 September 2018 - 12:00 PM.


#19 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 24 September 2018 - 12:18 PM

It won't have any impact on screen secrets one way or the other. The script flags (98-102) are used for things like this and unless you specifically tie them to screen secrets (or something else like this item) they don't do anything.


If it's easier for you to use an FFC script (again, this is UNTESTED):

const int I_MAGICCOMPASS = 125; //Set this to your compass item's ID
const int CF_MAZESECRET = 100; //Set this to whichever secret combo flag you want to use
const int C_CLEAREDPATH = 5; //Set this to the combo ID of whatever the cleared path will be. This could be the same as your regular ground combo.

//D0: Item number to activate changes
//D1: Combo Flag number to check for
//D2: Combo number to change flagged combos to if Link has the item
//D3: CSet to change the combo to
ffc script MagicCompass
{
  void run(int itemnum, int compassflag, int newcombo, int newcset)
  {
    if(itemnum == 0) itemnum = I_MAGICCOMPASS;
    if(compassflag == 0) compassflag = CF_MAZESECRET;
    if(newcombo == 0) newcombo = C_CLEAREDPATH;
    if(Link->Item[itemnum])
​    {
      for(int i = 0; i <= 176; i++)
      {
        if(Screen->ComboF[i] == compassflag)
        {
          Screen->ComboD[i] = newcombo;
          if(newcset != 0) Screen->ComboC[i] = newcset;
        }
      }
    }
  }
}

With this you can set defaults with the constants and then if needed override them in the FFC itself. Just set the FFC to run on screen init. With this you don't need anything in your global script at all.


Edited by jsm116, 24 September 2018 - 12:20 PM.


#20 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Location:Earth

Posted 24 September 2018 - 12:58 PM

Oh awesome!!!

 

I will have to test it out and let you know how it works.

 

Thank you again!!

 

 

EDIT: It have imported the script and set everything. It does not work.

Upon importing it gives a line 19 lexical error, but still successfully compiles.

 

Test Quest

 

If you want to look at it.


Edited by Rocksfan13, 24 September 2018 - 01:35 PM.


#21 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 24 September 2018 - 02:53 PM

Couple of things:

 

The question mark in the code shouldn't be there. Was that for my benefit? When I run it without that question mark the only error in allegro is a note that 176 is an invalid call for ComboF[] (change the for loop to:

for(int i = 0; i < 176; i++)

The other issues with this are:

The Magic Compass item should be a Custom Itemclass and it MUST be an Equipment Item. If Equipment Item is not checked, the item disappears as soon as you collect it.

The script only runs when you enter the screen, so if Link never changes screens it won't run and the combos don't change.

For the FFC itself, on the Flags tab you can check the box marked Run Script at Screen Init. If it's checked, the script will run before the screen is visible and the player will never see the flagged trees. If you leave it unchecked, the player will see the trees while the screen scrolls and then they'll disappear.

https://ruq.io/MagicCompass.qst



#22 Rocksfan13

Rocksfan13

    Looks best in Blue

  • Members
  • Real Name:Doug
  • Location:Earth

Posted 24 September 2018 - 03:22 PM

Oh. I guess I didn't read the instructions right.

 

I am guessing the ? came from word saving it weird.

 

I added the corrected one and this now works perfectly!!!

 

THANK YOU KINDLY!!!



#23 jsm116

jsm116

    Script kludger

  • Members
  • Location:The 301

Posted 24 September 2018 - 03:58 PM

Word is fantastic for writing a paper and just about the worst possible thing for working on code. Get yourself notepad++. 



#24 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 26 September 2018 - 12:58 PM

Word is fantastic for writing a paper and just about the worst possible thing for working on code. Get yourself notepad++. 

 

 

Oh. I guess I didn't read the instructions right.

 

I am guessing the ? came from word saving it weird.

 

I added the corrected one and this now works perfectly!!!

 

THANK YOU KINDLY!!!

 

 

Or SciTE.:P



#25 Deedee

Deedee

    Bug Frog Dragon Girl

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

Posted 28 September 2018 - 09:56 PM

Or SciTE. :P

Wrong opinion. [Notepad++ Elitism Intensifies]



#26 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 28 September 2018 - 11:07 PM

Wrong opinion. [Notepad++ Elitism Intensifies]


**Notepad++ elitism intensifies further**

#27 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 29 September 2018 - 12:36 AM

**Notepad++ elitism intensifies further**

 

 

If you want something that uses 3x as much of your sys resources, and isn't running native, sure.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users