Jump to content

Photo

Periodic reduction to a counter


  • Please log in to reply
49 replies to this topic

#31 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 15 December 2014 - 09:32 PM

Yeah you want a single equality sign. double equality is used for compairson. IS EQUAL TO



#32 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 15 December 2014 - 09:37 PM

Yeah, it was just a random thing I wanted to check. Changed it back immediately, then I tried the one you posted most recently, still not counting down.

 

Oh, also, no, there are no other ways currently in my quest to make Link drunk

 

Strange, though... It should only be setting the timer if Link is not already drunk, based on what you wrote, correct? Maybe I forgot to do something...


Edited by Lineas, 15 December 2014 - 09:44 PM.


#33 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 15 December 2014 - 09:47 PM

//Drunk script
           void run(){
               while(true) {
     if (Game->Counter[CR_SCRIPT1] > 0 && Link->Drunk==0){
         Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600;
     }
     if(Link->Drunk>0){
        Link->InputL = false;
        Link->InputR = false;
     }
     //else

     Waitframe(); //Moving Around The House

     if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0; //Let's put it here instead
            //Waitframe(); //This needs to go else where so...
           }
    }
}



#34 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 15 December 2014 - 09:52 PM

Ok, like this, yes?

//Drunk script
                     void run(){
               while(true) {
     if (Game->Counter[CR_SCRIPT1] > 0 && Link->Drunk==0){
         Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600;
     }
     if(Link->Drunk>0){
        Link->InputL = false;
        Link->InputR = false;
     }
     Waitframe();
     if(Link->Drunk==1) Game->Counter[CR_SCRIPT1] = 0; 
           }
    }
}

Now, it's just not increasing the counter,so Link's never getting drunk.

EDIT: Changed the "(Link->Drunk==0)" in the last line to "(Link->Drunk==1)" and that seemed to fix the issue, but I'm not sure if it will stack properly, since it only checks the timer if Link isn't already drunk.


Edited by Lineas, 15 December 2014 - 09:58 PM.


#35 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 15 December 2014 - 09:58 PM

What are you using to increase the counter?



#36 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 15 December 2014 - 10:00 PM

A dummy item with no purpose other than increasing the Script 1 counter



#37 justin

justin

    Adept

  • Members

Posted 15 December 2014 - 10:04 PM

one of the issues with the current incarnation of the script is that if Link picks up another beer while already drunk that one will never get used, and will be removed with the rest.

 

i'm not sure i understand the difference between having them removed at the time he becomes drunk or when he is done being drunk.  what's the purpose for this distinction?

 

 

going back to your original post in the topic.  you want Link to drink a beer every minute or so, and have it removed after he is done being drunk?

 

try this:

const TIME_TO_DRINK = 3600;  // set this to how often Link should drink
const DRUNK_TIME = 300;  // set this to how long Link should be drunk for per drink
const DRINK_ONE_AT_TIME = true; // each TIME_TO_DRINK Link drinks one drink, if he has one.  Set to false if drink all at once.
 
global script Slot2 {
   void run(){
      while(true) {
          Drunk_Script();
 
          Waitframe();
      }
   }
}
 
void Drunk_Script(){
    int counter = 0;
 
    while(true){
        if(counter==TIME_TO_DRINK && Game->Counter[CR_SCRIPT1]>0){
            if(DRINK_ONE_AT_TIME){
                 Link->Drunk += DRUNK_TIME;
                 Game->Counter[CR_SCRIPT1]--;
           }else{
                 Link->Drunk += DRUNK_TIME * Game->Counter[CR_SCRIPT1];
                 Game->Counter[CR_SCRIPT1] = 0;
           }
           counter = 0;
        }else{
            counter++;
        }
 
        if(Link->Drunk>0){
              Link->InputL = false;
              Link->InputR = false;
        }
 
        Waitframe();
    }
}

i have the beers removed when Link becomes drunk because otherwise it just gets too complicated and creates too many issues.  like removing unused beers gained while drunk.  


Edited by justin, 15 December 2014 - 10:07 PM.


#38 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 15 December 2014 - 10:13 PM

The idea was to just increase the Link->Drunk timer by 3600 every time Link picks up a "beer", then clear them all out when the timer reaches 0 (or 1, since that seems to be the only thing that makes it actually work right)



#39 justin

justin

    Adept

  • Members

Posted 15 December 2014 - 10:21 PM

oh that seems easier.

 

const int DRUNK_TIME = 3600;  // how long to make Link drunk for per beer.
 
item script Beer{
    void run (int num_beer){
        Game->Counter[CR_SCRIPT1] += num_beer;
        Link->Drunk += DRUNK_TIME * num_beer;
    }
}
 
global script Slot2 {
   void run(){
      while(true) {
          if(Link->Drunk == 0 && Game->Counter[CR_SCRIPT1] > 0){
             Game->Counter[CR_SCRIPT1] = 0;
         }
 
          Waitframe();
      }
   }
}

 

attach the item script Beer to the Pickup slot of your beer item.  D0 is the number of beers it represents.

set your constant to however long each beer should make Link drunk.



#40 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 15 December 2014 - 10:51 PM

That seemed to work, but yeah, really gonna have to change out the built-in drunk script for the confusion script. The random use of items is just stupid, I just wanted it to make it harder to control Link's movement.

 

On second thought, it's actually pretty funny and since you won't HAVE to get drunk to complete the game, it's just going to be there for certain hints and for the sake of being able to get drunk, maybe I'll just keep it as is. Could just disable items in all of the "Bars" by making them their own separate DMap, then Link will only be randomly attacking in places there are enemies. And I'll just remove potions, super bombs and bait from the game, entirely (don't think I'll need them much, anyways), so accidentally using one won't be a problem.


Edited by Lineas, 15 December 2014 - 11:28 PM.


#41 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 16 December 2014 - 09:53 AM

Confusion > Drunk



#42 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 16 December 2014 - 11:15 AM

Yeah, but I have 2 issues with it: it doesn't get progressively better as it counts down (although, it doesn't seem to get much less intense on the built-in drunk effect, either) and all it does is reverse the controls (although the built-in drunk effect seems to not actually ever override the movement for Link, it just turns him around and makes him use items that could potentially get in his way). If I'm gonna use a scripted drunk effect, I'd prefer it to have a chance (say, 10% for every 3600 frames) to randomly send Link in the wrong direction, so, one beer would occasionally mess with you, but 10 beers would make it literally impossible to move anywhere intentionally... But I have absolutely NO idea what I would have to do to the confusion script to make it work the way I want it to.

 

Also, there aren't going to be many counter-based items, other than life, magic, money, keys and booze. Most all of the weapons will use MP, rather than affecting a counter, for reasons that will be "explained" in the quest... but really, it's just cuz I was too lazy to figure out musical equivalents of bombs and arrows, and the idea of deadly songs that cause weird shit to go down (like explosions) was amusing to me, so, the usual complaint about Drunk state causing you to waste valuable consumable items isn't really valid, here. It does kill your MP, probably, though.



#43 justin

justin

    Adept

  • Members

Posted 16 December 2014 - 12:15 PM

Shouldn't be too hard to modify the confusion script for that. I'll see what I can do...

#44 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 16 December 2014 - 01:09 PM

Here's a random thought: What if I gave Link infinite MP while drunk? So, essentially, it would just turn you into a spinning, drunk, monster-annihilating berserker. Remember, this is mainly going to be made for laughs. Also, maybe I could add an ffc script of spinning stars to go around Link's head, to indicate drunkenness.



#45 justin

justin

    Adept

  • Members

Posted 16 December 2014 - 01:26 PM

i'll add that.  i'm just working on it now.  testing my first version.  




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users