PDA

View Full Version : My Push Block Script



sps999
02-25-2009, 08:57 AM
Okay, so I wan't to make an FFC that works as a push block, and that follows side-view properties. I am new to scripting and need some help. I'm starting basic, and will in this example think of it as only pushing the block right, for now.

So, I want to know how I have a variable that determines if link is touching (perhaps 1 pixel away) the block, and it'll move 1 pixel to the left. After looking at a bunch of variables and tutorials, I am still confused on how to do this. All that I have is:


CODE

import "std.zh"

ffc script PushBlock
{
Link -> float X = -1
this -> X += 1;
}



And don't know what to do to make it go right. If anyone could help it would be appreciated.

CaRmAgE
02-25-2009, 10:44 AM
Okay, so I wan't to make an FFC that works as a push block, and that follows side-view properties.

Your FFC script does not have to be on the push block in question since it has access to all objects. You would then only have to script the side-view properties of your push-block. Unfortunately, I haven't looked too deeply into Zscript to provide actual code. Joe or pkmnfrk will probably be of more help, though.


CODE

import "std.zh"

ffc script PushBlock
{
void run() {
Link -> float X = -1
this -> X += 1;
}
}

You need the function in bold for every script you make. Otherwise, your script won't run.

Joe123
02-25-2009, 11:04 AM
When you're using a variable or function from zscript.txt that's a member of an object such as 'Link', you needn't declare it as it's already been declared.
So just 'Link->X' will suffice.

Gleeok
02-25-2009, 01:49 PM
Yeah, just stick to basic c syntax and you shouldn't run into any problems. Also note that 'float' and 'int' in ZScript are exactly the same.


import "std.zh"

ffc script PushBlock
{
Link ->X = -1 // X already exists! Link.X doesn't need to be re declared...wont work anyway. Note that you probably want "->X-=1"?
this ->X += 1;
}

A pushblock script isn't the easiest script when you're new to ZScript either.

sps999
02-25-2009, 05:15 PM
hmm... let's say this, I want to know if there is a variable for the FFC to tell that link is touching to block, if I know that, I'll at least be at a start. Until then, I'll try out some simpler scripts. Also, I would like to know if there is a variable or something that let's the FFC know if a tile is solid, that it won't go on it.

Joe123
02-25-2009, 06:09 PM
There isn't a variable for that, you have to work that out using the ffc's coordinates and link's coordinates.

Screen->ComboS[] will tell you about the solidity of a tile, but if you wait for the next build we'll have a much better method for doing so.

lucas92
02-26-2009, 09:21 PM
A little off-topic, but are we going to have an option to set the ffc solid in the next builds? It's always kind of buggy scripting solidity on ffcs. :S