Jump to content

Photo

Next combo if combo on screen


  • Please log in to reply
70 replies to this topic

#1 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 09 March 2012 - 12:20 PM

Hi, I am requesting an easy ffc script that does 3 different things:
1: it changes every combo99 on the screen to the next in the list if combo 97 is on screen. done
2: it changes every combo101 on the screen to the next in the list if there is no combo 96 on screen. done
3 (optional): if there are any combo107 on the screen, it always spawns combo27 at the same position as the combo107, but on layer 2. done
does it sound doable?
icon_smile.gif

Edited by Avataro, 10 March 2012 - 05:04 AM.


#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 09 March 2012 - 01:49 PM

Let's try this (item 1)...

See page 2

Edited by MoscowModder, 12 March 2012 - 01:11 PM.


#3 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 09 March 2012 - 07:23 PM

Thank you! It works. This great script can be used for many different things ;D

#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 09 March 2012 - 08:03 PM

Edit: here are all three put together. The use of a while(true) and break in the first worried me, so I changed that.

See page 2

Edited by MoscowModder, 12 March 2012 - 01:11 PM.


#5 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 09 March 2012 - 08:37 PM

Wow, ZC crashed when I tried the third script. Maybe it's because I had the same script 8 times on the same screen, but with other D numbers.

The first and second scripts work great. Thanks a lot for that. I just could not try the third script yet.. I don't really understand, why I have to enter the ID of 3 combos.

Edited by Avataro, 09 March 2012 - 08:41 PM.


#6 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 09 March 2012 - 09:10 PM

You've got the arguments to SetLayerComboD mixed up (which is understandable, as they're pretty poorly named). It should be SetLayerComboD(layer, i, layercombo).

#7 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 10 March 2012 - 04:58 AM

I have added your fix in my script. In the same line I have also changed the variable "targetCombo" into "targetcombo".

It still crashes, when I try to use this script.

EDIT: Oh, this script only crashes when I have it more than once per screen. That is not really a problem, this script is still useful to me. Thank you!

Edited by Avataro, 10 March 2012 - 05:04 AM.


#8 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 10 March 2012 - 10:23 AM

Added a waitframe...
*facepalm*

#9 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 11 March 2012 - 12:16 AM

Somehow, there problems about the first script.
I think the script does not work if I use this script in the same screen. Am I right?

CODE
//D0 is the ID of the combo you want to trigger the sound
//D1 is the sound to play
//This script find any combo of a certain ID and changes
//it to the next combo in the list, playing a sound while
//doing so.

ffc script soundcombo{
    void run(int comboid, int sfx){
        while(true){
            for(int i=0; i<=175; i++){
                if(Screen->ComboD[i]==comboid){
                    Game->PlaySound(sfx);
                    Screen->ComboD[i]++;
                }
            }
            Waitframe();
        }
    }
}
^Script made by Pokemonmaster64

#10 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 11 March 2012 - 01:05 AM

local variables seem to conflict with d functions if theres more than one script i use global ones so this doesnt happen.

Edited by tox_von, 11 March 2012 - 01:06 AM.


#11 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 11 March 2012 - 07:51 AM

alright,
So does anyone know a way to fix the three scripts by MoscowModder, so that they use global functions?

#12 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 11 March 2012 - 10:32 AM

What? No, no, no. That's not the problem.
What numbers are you using for the arguments? The SFX script changes the trigger combo whenever it sees it, so if you're using the same trigger for both, maybe they're being changed before the other script runs.

#13 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 11 March 2012 - 10:50 AM

Yeah, having two scripts check and change the same combo at the same time is bound to cause conflicts.

Concerning global variables - my CSC150 and CSC250 teachers told/tell us time and again not to use global variables unless you absolutely have to (not constants - those are okay to use). In the case of Zscript, every instance of an FFC script (like 2 different NPCs, for example) will share the values of the global variable, which are saved with your game save.

#14 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 11 March 2012 - 03:16 PM

No, I don't use the comboID for both scripts.

Testquest
http://www.mediafire...jy0z9o17bbg3s7r

Here I have an example, where the script does not work. In this quest I use the soundcombo script and the changeComboIfFound script. Try walking on the blue/green tiles. They are step->next tiles. This is what should happen:

These step->next tiles are combo 16. Walking on them changes them to combo 17.
The soundcombo script changes combo 17 to the next in the list (it also plays a sfx now).
Combo 18 is automatically combo-cycling to combo 19.
Combo 19 are the blue/red tiles. They automatically cycle to combo 20 (A-Speed set to 4).
Combo 20 are the blue/white tiles.
Ok, now the changeComboIfFound script should change this combo (combo 20) to the next in the list (combo 21) if combo 19 is on screen.
Combo 19 can only appear on the screen if you step on another one of these step->next tiles.

So basically, stepping on one of the blue/green tiles makes them become a blue/white tile. Stepping on another blue/green tile, should make the blue/white tile change to the next in the list, wich is an unwalkable combo.

The problem is, that the script does not work. Combo 20 does not change to the next, if combo 19 is on screen. I have D0 set to 19 and D1 to 20, though, so it should work.

Edited by Avataro, 11 March 2012 - 03:21 PM.


#15 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 11 March 2012 - 04:03 PM

there might need to be a break statement there seem to be heaps of if statements.Possibly one isn't ending.

When i tried the example it didnt cylcle wrong and it worked about 10 times when i tried it.

I think its been fixed above.

Edited by tox_von, 11 March 2012 - 08:22 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users