I just copy/pasted my entire global script... since that's the only thing I have in my global
also, it IS on slot 2 I just called it slot1 because I spaced.
Posted 15 December 2014 - 08:26 PM
I just copy/pasted my entire global script... since that's the only thing I have in my global
also, it IS on slot 2 I just called it slot1 because I spaced.
Posted 15 December 2014 - 08:26 PM
I edited my post with a possible solution.
Posted 15 December 2014 - 08:34 PM
Oh,yeah, the while(true) loop was definitely missing.... But... now that I added it, it freezes the game at startup. This is what I've got:
global script Slot2{ //Drunk script void run(){ while(true) if (Game->Counter[CR_SCRIPT1] > 0 ){ Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600; Game->Counter[CR_SCRIPT1] = 0; } if(Link->Drunk>0){ Link->InputL = false; Link->InputR = false; } Waitframe(); } }
Posted 15 December 2014 - 08:43 PM
loops don't work that way.
while(true) { code to be looped Waitframe(); //most important part }
Posted 15 December 2014 - 08:48 PM
Oh, right... I forgot the curly braces. Now it loads, and the drunk effect works, but now the counter just stays at 0. Do I need to move the counter reset to outside of the loop?
Edited by Lineas, 15 December 2014 - 08:48 PM.
Posted 15 December 2014 - 08:55 PM
This is logically what is happening...
SCRIPTCOUNTER1 > 0
DO STUFF
SET SCRIPTCOUNTER 0
When do you want to reset the counter?
Posted 15 December 2014 - 08:56 PM
After the drunk effect finishes counting down
Posted 15 December 2014 - 08:58 PM
if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0;
Posted 15 December 2014 - 09:05 PM
//Drunk script void run(){ while(true) { if (Game->Counter[CR_SCRIPT1] > 0 ){ Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600; if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0; } if(Link->Drunk>0){ Link->InputL = false; Link->InputR = false; } Waitframe(); } } }
And now it's not counting down. Either that, or it's never reaching 0 because the items are still in my inventory, so it's continually resetting the timer to max.
Edited by Lineas, 15 December 2014 - 09:06 PM.
Posted 15 December 2014 - 09:06 PM
Are you making the items consumable?
Yup just checked and it's setting it to max. Hmm... Trickier then it looks.
Not sure how to get around that, let me think for a moment.
Edited by Freya, 15 December 2014 - 09:09 PM.
Posted 15 December 2014 - 09:11 PM
No, that's why I need to be able to reset the counter, or figure out how to make the game auto-consume one every minute.
EDIT: Lol, why is it everything I want to do is always trickier than it looks. Oh,well, at least this quest will be fairly light on scripts beyond this and the one for a right handed sword
Edited by Lineas, 15 December 2014 - 09:16 PM.
Posted 15 December 2014 - 09:13 PM
//Drunk script void run(){ while(true) { if (Game->Counter[CR_SCRIPT1] > 0 ){ Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600; //BINGO THIS AINT EVEN RUNNING // if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0; } if(Link->Drunk>0){ Link->InputL = false; Link->InputR = false; } else if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0; //Let's put it here instead Waitframe(); } } }
Posted 15 December 2014 - 09:23 PM
Still no reset, my guess is it's still keeping the timer at max.
Posted 15 December 2014 - 09:28 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 if(Link->Drunk==0) Game->Counter[CR_SCRIPT1] = 0; //Let's put it here instead Waitframe(); } } }
Can he drunk any other way before this initiailizes, if not that should work hopefully.
Posted 15 December 2014 - 09:31 PM
So, I changed Link->Drunk = Game->Counter[CR_SCRIPT1] * 3600; to Link->Drunk == Game->Counter[CR_SCRIPT1] * 3600; and I think it worked, sorta. It seems that now it's resetting the counter as soon as I pick up the item, causing Link to only be drunk for 1 frame (this is just conjecture, because Link turned on his own upon picking the item up, but then was not drunk)
0 members, 1 guests, 0 anonymous users