PDA

View Full Version : Making Link Invisible



Joe123
10-22-2007, 05:33 AM
Now, if you read this Gleeok I know you already told me how to do it via LTM, but that's really quite akward because I have lots of tiles infront of my Link tiles, I'm using LTM quite extensively already, and there's not much space on my tilesheet anywhere.

I've also moved to here from PureZC because scripting seems rather dormant there :P

So how can I make Link invisible then?

Gleeok
10-22-2007, 05:41 AM
You know you could move the Link sprites from page 1 to say...240 right?

..also check your PMs. :p

Joe123
10-22-2007, 05:52 AM
But then I cant use page 240 though. And with DoR, it's looking like I'm gonna need it. I spose I could just clear out all of the dungeon tiles though.

Can I move it to page 257 though, say?
Will that just make Link blank or dyuthink it'll crash the system or something?

Gleeok
10-22-2007, 06:00 AM
Your using all 251 tile pages?!:eek: Wow...Hey i've been adding crap to DoR too but there's plenty of free space in there. I deleted the unnecesarry animation tile pages because...well, ffc's make them obsolete.

... :think: Damn, that's nuts. I've got about 100 free pages in that tileset once I deleted the unneeded stuff...I don't know what to tell you. Where are you gonna stick the tiles for large ffc's and bosses then?

Joe123
10-22-2007, 06:05 AM
I'm not using all the pages as of yet, but I'm on 216 I think and still going strong.
And I really don't know about my large bosses :( I couldn't live without them...
However, seeing as I have little use for the dungeon tiles, I could just parse them all and make them into nice big custom bosses :)
I'm just messy really, I stick things down, copy them around all over the shop, test them where they are, then don't want to move them incase they break something >_<

Did you get my pm at pure?

EDIT: Actually, I did just find about 8 sheets of rubbish, bits of lttp mountains and crap. I could clear those if I run out of space.

C-Dawg
10-22-2007, 11:56 AM
Oh, for pete's sake. You only need 40 tiles, two rows, tops, to make Link invisible. Unless you're using a ton of other offsets, I guess.

ShadowMancer
10-22-2007, 03:42 PM
What we need is access to the screen flags, but that may or may not happen anytime soon (or at all, screen flags *may* be initiated at the time Link enters the screen insted of checked frame by frame. But I don't really know because obviously I never seen the source code of ZC :p )
Lacking that yea the best way is to use LTMs. :shrug:

Joe123
10-23-2007, 07:20 AM
Oh, for pete's sake. You only need 40 tiles, two rows, tops, to make Link invisible. Unless you're using a ton of other offsets, I guess.

I am I'm afraid. I have 3 tilesheets of Link tiles.

ShadowMancer
10-23-2007, 08:53 PM
I am I'm afraid. I have 3 tilesheets of Link tiles. Yeesh! That must get really complex :eek:

What are all those Links for?? Showing different armors/weapons or something more sinister? :mischief: Is he a shapeshifter or something???

Even useing drawing functions or FFC's to cover up Link would be overly complex.. Looks like yer stuck :(

Gleeok
10-23-2007, 11:56 PM
I am I'm afraid. I have 3 tilesheets of Link tiles.

Well you wanted Link with 5 types of shields, rolling Link, invisible Link, charging Link, climbing Link, and now you've got to pay the price. ;)

Might I suggest freeing up about one tile page per LTM script. Basically you need to treat them as you would if statements as you would in a script. Or another solution would be to add these to the scripts themselves. Sort of like:

000
001
010
011
100
101
110
111

You see a pattern there?

Joe123
10-24-2007, 05:28 AM
Why are you posting binary at me :confused:
I'm afraid I don't understand that at all.

I have Link with no shield, wooden, big and mirror, then I have climbing tiles for each. Each set of Links takes up three rows, plus I have a labelling row before each row of Links. Thus 3 sheets. I think I might be able to squeeze in an extra sheet for invisible Link though, especially if I remove the label rows.

Gleeok
10-24-2007, 06:45 AM
Well what I was getting at was you could alter your invisibility script for one, to check Link's current equipment before assigning a Link tile mod to him. (Although it'd still be easier to free up more tilepages...jeez, that's ridiculous...)

..I'm assuming it's an invisibility cloak or something.

Joe123
10-24-2007, 07:49 AM
No no, I want to play an animation via drawtile when you play the whistle. The script doesn't seem to do anything at the moment though...

ShadowMancer
10-24-2007, 07:26 PM
I want to play an animation via drawtile when you play the whistle. The script doesn't seem to do anything at the moment You should post the script, another pair (or better yet many pairs) of eyes often help see the *kicks self* type mistakes that we all make when looking at something too closely and for too long.

C-Dawg
10-24-2007, 08:37 PM
You should post the script, another pair (or better yet many pairs) of eyes often help see the *kicks self* type mistakes that we all make when looking at something too closely and for too long.

I've typed: " state_counter == 3;" when I meant "state_counter = 3" waaaay to many times. Hard to find, won't generate an error message, royally fucks up the code.

Joe123
10-25-2007, 08:04 AM
Dyu know what possibly the best thing ever for mistakes like that is?

The 'Replace' tool on notepad.

It seriously saved me about 2 hours writing that snow combo script.


item script whistle{
void run(){
int timer = 20;
int tile = 54793;
int cset = 6;
while(timer > 0){
timer--;
Screen->DrawTile(3, Link->X, Link->Y, tile, 1, 1, cset, 1, 0, 0, 0, 3, true, 128);
}
}
}

Anyway, that's what I have so far for the whistle script. I haven't made Link invisible or put in the animation on the drawtile function yet, but what I have there doesn't seem to want to do anything at all...

I think I might be putting it on the item wrong though, I'm not very familliar with item scripts.

ShadowMancer
10-25-2007, 09:15 PM
Your problem is that item scripts only execute for one frame.. well a couple of problems actually. The script you have (even if it was an FFC or Global script) has no waitframe so it goes through and draws what you want until the timer reaches 0 then *poof* disapears at the next call of Waitframe. Drawing functions only draw for each frame they are called then the screen is refreshed.. sooo you probley want to have the item script set a global varible to 'true' then do the animation (put a waitframe in the while loop) and just set the global var back to 'false' at the end of the loop.


Also, if you only want Link invisible durring the animation, just draw something on say Layer 6 above him, and freeze movement by setting all the input keys to false until the animation is over, but if that is not what you want then just ignore this :)

beefster09
10-25-2007, 09:27 PM
You don't need LTMs if link is invisible for a whole screen. Use one of the settings that was in V1.92- Invisible Link in the screen flags menu.

Joe123
10-26-2007, 04:45 AM
Ahhh, thankyou ShadowMancer.
I knew Waitframe(); didn't work for item scripts, so I thought - I know, I'll have a while loop which loops for 20 frame via the timer, but obviously that doesn't work. I'll have a go at adding into the global script then. Thankyou.

EDIT: oh, but of course that doesn't make it wait a frame though, because there's no waitframe. It just loops 20 times. >_<

EDIT:

while(usewhistle == 1){
Game->PlaySound(33);
Link->Item[invis] = true;
Screen->ComboT[ComboAt(0,0)] = thisType;
if(timer > 10){Screen->DrawTile(2, Link->X, Link->Y, tile, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 20 && timer <= 10){Screen->DrawTile(2, Link->X, Link->Y, tile+1, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 30 && timer <= 20){Screen->DrawTile(2, Link->X, Link->Y, tile+2, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer > 40 && timer <= 30){Screen->DrawTile(2, Link->X, Link->Y, tile+3, 1, 1, 6, 1, 0, 0, 0, 0, true, 128);}
if(timer == 40){usewhistle = 0; Link->Item[invis] = false; Screen->ComboT[ComboAt(0,0)] = thisType;}
timer++;
Waitframe();
}

So now I have this while loop added into my global script, and

item script whistle_animation{
void run(){
usewhistle = 1;
}
}
this as the item script.

I have the whistle's sound effect set to 0, because if you don't the script doesn't activate till after it's played.

However what happens at the moment is:
when you play the whistle the first time, Link dissapears for a frame, then the first tile only of the animation appears, the sound effect plays, then Link becomes visible again.

then when you play it the second time, Link becomes permanently invisible, no sound effect plays, and you get the first tile of the drawtile animation stuck on Link enabling you to walk around as a graphic of Link playing the ocarina. Oh dear...

ShadowMancer
10-26-2007, 10:52 AM
timer > 20 && timer <= 10 ??? Can timer be greater then 20 And less then 10 at the same time.. Common mistakes check all your logic, seems like the script should work with the proper logic.
Also, make sure you set timer back to 0 before running the loop again. (this is why Link stays invisibal, timer is already greater then 40 so: if(timer == 40){usewhistle = 0; Link->Item[invis] = false; never gets called)

Joe123
10-26-2007, 12:52 PM
Ah, I thought it'd just be something stupid >_<

I really need to just check my scripts more thoroughly rather than pestering people for help, I didn't ask for help on the snow script and it works fine. Ah well. Thanks anyway :)

Is there any easy way I can make the screen's monsters freeze, and the whirlwind not appear till after the tune's been played? Or am I not going to be able to do this?

ShadowMancer
10-26-2007, 03:00 PM
Well makeing the enemies freeze will take recording each enemies X and Y then writeing those values back to each enemy, also you may want to set their weapon to 0 then set it back to its original setting once the freeze is over, without arrays this takes quite a bit of code to pull off but is possible. As for the whirlwind, I don't think we have any ZScript control over that just yet.


I didn't ask for help on the snow script and it works fine
Sorry about that, did not mean to step on your toes or nothing, I just have a way of seeing how to make things more efficient and like to share that info if I can :redface:

Joe123
10-26-2007, 07:31 PM
Can you help me freeze enemies then?
And I might just disable whirlwinds, because I only need them for one BS overworld, they won't work in the other areas.

And I wasn't saying you were stepping on my toes at all.
You and Gleeok have seriously helped me a lot here, I would know a lot less about Zscript if you hadn't. I was just saying I ask for help too much.

ShadowMancer
10-26-2007, 08:35 PM
Freezeing Enemies:

make some global vars;
int ene1X ; int ene1Y ; int ene1W ; int ene2X ; int ene2Y ; int ene2W ;
etc... you will probley want to account for at least 10 enemies
you can never tell how many enemies you will need to keep track of with summors, spliters, and the posibility of script-created enemies. but you will have to find a suitable number for your quest.

Add a global var to check wether the freeze is active:
bool eneFrozen = false;

make a function that will be called when you use the whistle;
make sure you do eneFrozen = true; before calling this function

void eneFreeze (){
//record all enemies X / Y cords and weapon
npc ene1 = Screen->LoadNPC(1);
npc ene2 = Screen->LoadNPC(2);
//etc.
ene1X = ene1->X;
ene1Y = ene1->Y;
ene1W = ene1->Weapon;
ene2X = ene2->X;
ene2Y = ene2->Y;
ene2W = ene2->Weapon;
//etc.
While(eneFrozen == True){
ene1->X = ene1X;
ene1->Y = ene1Y;
ene1->Weapon = 0;
ene2->X = ene2X;
ene2->Y = ene2Y;
ene2->Weapon = 0;
//etc.
Waitframe();
}
//once eneFrozen == False again (at the end of your animation)
//restore the enemies' weapons
ene1->Weapon = ene1W;
ene2->Weapon = ene2W;
//etc.
}

Thats pretty much all there is to it, just with alot more varibles :tongue:

Don't be worried about asking alot of questions, I'm always glad to help ppl learn more, it also helps me by makeing me solve problems I otherwise would not have thought of, so I learn as well :cool:

Gleeok
10-26-2007, 08:43 PM
Cool SM...there's just a bug with walker/shooters that will glitch when given (none) as a weapon type. You'll need to use ene1->Halt = 0; also. (They don't fire when halt rate is 0.)

...I should really report that bug. I just haven't tested it at all yet..

ShadowMancer
10-26-2007, 09:01 PM
They don't fire when halt rate is 0
This is good to know, I did not realize that.
does a halt rate of 0 also stop them from animateing? because even if you stick enemies to the spot by changeing their X/Y they will appear to be walking in place, and while this is good exercise it looks kind of dumb :p


there's just a bug with walker/shooters that will glitch when given (none) as a weapon type
This I also did not know, thanks again.

Gleeok
10-26-2007, 09:45 PM
Here's something neat too:

Set an enemy data to
halt 16
AI 256
misc types-Octorock (misc1 -1)
weapon - flame2
set to be invisibe...

.....and.....
























...NOW CENTER IT AT THIS->X AND THIS->Y AND GIVE IT 999 HP AND MAKE IT FLY AROUND THE SCREEN!!!!!!!!!!!


...Oh, and how's that weapon script thingy coming along?....nudge, nudge..

ShadowMancer
10-26-2007, 10:29 PM
Oh, and how's that weapon script thingy coming along?....nudge, nudge..
Oh, geez I stopped working on that awhile ago, although since I did just make a couple of simple of FFC weapons I may just pick up the reins on it again, especially since someone has shown interest in it again. I'm thinking of mabye takeing a different appraoch, as my original idea seemed pretty complex and overwhelming. I just got that burn->next thing done, just need to ajust the script to use a global instead of a function because of the bug I reported.. so mabye I'll write up a little flame thrower as an added bonus :)



Here's something neat too:

Set an enemy data to
halt 16
AI 256
misc types-Octorock (misc1 -1)
weapon - flame2
set to be invisibe...
...NOW CENTER IT AT THIS->X AND THIS->Y AND GIVE IT 999 HP AND MAKE IT FLY AROUND THE SCREEN!!!!!!!!!!!

I think that would be just abit more difficult then even an 8-Headed Gleeok to defeat :D
I am makeing you head of 'evil creations' dept. with a window office and a raise...

Gleeok
10-27-2007, 05:39 AM
This is good to know, I did not realize that.
does a halt rate of 0 also stop them from animateing? because even if you stick enemies to the spot by changeing their X/Y they will appear to be walking in place, and while this is good exercise it looks kind of dumb :p


A halt rate of 0 means they don't stop and fire. They just keep walking...and....walking...and wal......


Also if you set step speed to 0 they wont fire either. They said after 2.5 it'll get looked at.

Joe123
10-27-2007, 06:02 AM
Ugh, do you know what we need?
We need a 'Screen Freeze Scripts Still Activate' combo. A lot. And it needs to let drawtile functions still carry on going. I don't get why people use them so little, they're great.

Also, WHYYYYY does the 'Messages freeze all action' quest rule make drawtile functions dissapear? I almost cried when I found that out. Is it a bug or is it intentional?

ShadowMancer
10-27-2007, 11:50 AM
'Messages freeze all action' quest rule make drawtile functions dissapear
Do you mean draw functions don't display durring a message or at all if you have that rule? IF its only on messages its probley because freezeing all action would require to stop advanceing frames on everthing except the message, which means the screen gets refreshed (thus eraseing anything drawn) for the message to be displayed, but no action takes place (thus no scripts running). I suppose the devs could fix this but I don't think it will happen until after 2.5.

Joe123
10-27-2007, 04:10 PM
Well, I'll have a try at playing with the screen freeze combo type then.
And dyureckon it would be possible to get something done about that? Maybe a quest rule or whatever? Because it's so restrictive. I like DrawTile lots and lots.

Gleeok
10-28-2007, 12:19 AM
Why not just uncheck that quest rule then? :shrug:

Joe123
10-28-2007, 06:26 AM
I can't if I want to use the NPC and Sign scripts.