PDA

View Full Version : Portal



XdragonSB
11-02-2007, 05:32 PM
Heres the main topic:
http://www.purezc.com/forums/index.php?showtopic=32382&pid=448567&st=0&#entry448567

Anyway, check the main topic first.
I'm currently awaiting the script....... but I was wondering if anyone could help.


Soo...
anyone knows how to script this out?

Gleeok
11-02-2007, 06:35 PM
Well I think Portal in zc is a great idea. // idea's on how to script are inserted here...


Yeah, I could script this for you.



...having more people spending time scripting the same thing while you sit back and wait is a brilliant idea and should turn out for the best. [/sarcasm]
The fact that I have about 165 lines of code already written for this at this point and am trying to construct a routine to check for walkable combos is irrelevent. Of course the portal Link warp function (enemy is slightly buggy atm) I coded already works, but that doesn't matter because you can just have someone else script it for you.


-Gleeok out

XdragonSB
11-02-2007, 06:51 PM
oh sorry gleeok
I thought you werent on, and I really am impatient today.
So I posted this.

Anyway, I decided to work on something while waiting.
Well thanks a whole bunch gleeok! (If you finish the script)


:|
I'm still trying to figure out how some of the new features of ZC work....
....
They aren't working. :(

(ehh I knew it was a bad idea to make this :( )

Gleeok
11-02-2007, 10:42 PM
Oh Alright, I'll forgive you this time. I can get grumpy you know. :p

Of coarse you know there will be multiple portal items, not just one...right? ;)


EDIT:
Alright, here's where some feedback is required:


With solidity; How would you like this handled?
Because there's no way to differentiate between blocks, walls, statues, non-walkable, or just decor in general considering not only that every tileset is set up differently but also what might be walkable. It's alot of data it is. I could probably use some help on this part. For example it could check if hit's a "no flying enemies" type solid combo or something then change to an open portal. But then you'd have to change every single wall and mountain combo to that. Not very usefull. What I have done with item 1 is set it so the player set's the portal with a second button push, which makes it MUCH easier and more accurate, not to mention add's the element of timing, which makes it that much more neat-o being interactive with skill and would add some interesting puzzles never befor seen by just thinking outside the box. I'm going to go ahead with that, as it can alway's be revised.

Comments please.

XdragonSB
11-03-2007, 12:27 AM
I think it'll be alright to make it "no flying enemy". (by hitting it opens a portal)
Cause, I need some walls which you can't make the portal open at all.

So, I don't really mind changing every single tile, because when I make a quest using portals....... everything's custom O.o

Gleeok
11-03-2007, 05:09 PM
Alright: PORTAL ITEM 2_ver0.1

Bugs: -Enemy portal transference...er whatever is buggy for some reason. -The projectile velocity part will only randomly work...is_walkable is to blame somehow...-It's not setup to carry over as of yet...-you can still get into walls(at least you can get out now) ...I'm still working on it.

Awsome news: The Link warping portal part works great. :)





import "std.zh"

//D0-cset of portal1
//D1-cset of portal2

item script PORTAL_item{

void run(int cset, int cset2){

int portal_data = 10;

ffc portal1 = Screen->LoadFFC(29);
ffc portal2 = Screen->LoadFFC(28);




if(!((portal1->Data >= portal_data) && (portal1->Data <= portal_data+7))){

Game->PlaySound(11);

if(Link->Dir == 0) {
portal1->X = Link->X;
portal1->Y = Link->Y - 16;
portal1->Vy = -2;
portal1->Vx = 0;
portal1->Data = portal_data;
portal1->CSet = cset;
}
if(Link->Dir == 1) {
portal1->X = Link->X;
portal1->Y = Link->Y + 16;
portal1->Vy = 2;
portal1->Vx = 0;
portal1->Data = portal_data+1;
portal1->CSet = cset;
}
if(Link->Dir == 2) {
portal1->X = Link->X - 16;
portal1->Y = Link->Y;
portal1->Vx = -2;
portal1->Vy = 0;
portal1->Data = portal_data+2;
portal1->CSet = cset;
}
if(Link->Dir == 3) {
portal1->X = Link->X + 16;
portal1->Y = Link->Y;
portal1->Vx = 2;
portal1->Vy = 0;
portal1->Data = portal_data+3;
portal1->CSet = cset;
}
}
else{
if(!((portal2->Data >= portal_data) && (portal2->Data <= portal_data+7))){

Game->PlaySound(11);

if(Link->Dir == 0) {
portal2->X = Link->X;
portal2->Y = Link->Y - 16;
portal2->Vy = -2;
portal2->Vx = 0;
portal2->Data = portal_data;
portal2->CSet = cset2;
}
if(Link->Dir == 1) {
portal2->X = Link->X;
portal2->Y = Link->Y + 16;
portal2->Vy = 2;
portal2->Vx = 0;
portal2->Data = portal_data+1;
portal2->CSet = cset2;
}
if(Link->Dir == 2) {
portal2->X = Link->X - 16;
portal2->Y = Link->Y;
portal2->Vx = -2;
portal2->Vy = 0;
portal2->Data = portal_data+2;
portal2->CSet = cset2;
}
if(Link->Dir == 3) {
portal2->X = Link->X + 16;
portal2->Y = Link->Y;
portal2->Vx = 2;
portal2->Vy = 0;
portal2->Data = portal_data+3;
portal2->CSet = cset2;

}
}
}
}
}


int portal_warp_delay = 0;


//---------for FFC 29-----------------
//==========D0 - THE FFC SLOT THIS SCRIPT IS IN (29!!!!!!!!....currently)
//==========D1 - "ffc slot of "OTHER ffc script(28!!!!!!!!!!!!!!!!!)
// -----REVERSE FOR FFC 28! ie: D0 - 28 D1 -29......Sorry for the angry looking notes :O

ffc script PORTAL_ffc{

void run(int this_ffc_number, int other_ffc_number){

ffc this_ffc = Screen->LoadFFC(this_ffc_number);
ffc other_ffc = Screen->LoadFFC(other_ffc_number);

int portal_data = 10;
int portal_set = 0;

int portal_position = 0;

bool portal_open = false;

int enemy_number = 0;
npc enemy;

while(true){

if(portal_warp_delay > 0){ portal_warp_delay--;}

if( (this->Data >= portal_data) && (this->Data <=portal_data+3) ){


if( (this_ffc->Vx < 0) && ((!is_walkable(this_ffc->X - 8, this_ffc->Y))) ){ portal_open = true;}

if( (this_ffc->Vx > 0) && ((!is_walkable(this_ffc->X + 8, this_ffc->Y))) ){ portal_open = true;}

if( (this_ffc->Vy < 0) && ((!is_walkable(this_ffc->X, this_ffc->Y - 8))) ){ portal_open = true;}

if( (this_ffc->Vy > 0) && ((!is_walkable(this_ffc->X, this_ffc->Y + 8))) ){ portal_open = true;}
}
if(portal_open){ this_ffc->Data = portal_data+4; this_ffc->Vx = 0; this_ffc->Vy = 0;}

if(portal_set == 0){



if(other_ffc->Data >= portal_data + 4){

if(portal_warp_delay == 0){

if ( (Link->X <= this_ffc->X + 10)&&(Link->X >= this_ffc->X -10)&&
(Link->Y <= this_ffc->Y + 10)&&(Link->Y >= this_ffc->Y -10) ){

portal_warp_delay = 60;
Link->X = other_ffc->X;
Link->Y = other_ffc->Y;
Game->PlaySound(11);
}

enemy_number = Screen->NumNPCs();

while(enemy_number > 0){

enemy = Screen->LoadNPC(enemy_number);
if ( (this_ffc->X - 10 < enemy->X) && (this_ffc->X + 10 > enemy->X) &&
(this_ffc->Y - 10 < enemy->Y) && (this_ffc->Y + 10 > enemy->Y) ){

enemy->X = other_ffc->X; enemy->Y = other_ffc->Y;
}
enemy_number--;
}
}
}
}
Waitframe();
}
}

bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}


set screen ffc's to 28 and 29 (it does not really carry over yet)

see this part:
int portal_data = 10;
that's what combo +7 to use as a projectile. If you use combo 1200-1207 change this to
int portal_data = 1200; on Both scripts.



To fellow scripters: What the heck is wrong with the code for enemy warp and projectile hitting an unwalkable combo and opening a warp?

EDIT: Ah, Ive fixed the enemy warping part but ComboS and ComboT completely elude me...:uhoh:



...?

XdragonSB
11-03-2007, 05:46 PM
Wait I"m confused.
It's not really working I mean...

I set it as BAIT (item class)

And I shot it, and shot it again, nothing really happened.

And, screen FFC? I'm confused about that.

Gleeok
11-03-2007, 08:43 PM
In ZQ go to Freeform Combos, enter the arguments D0 and D1 in the arguments tab, then set to a non zero combo(something translucent) and enter the script number in the little box marked script. Do this for ffc's 29 and 28 as per previous post. There should be a tutorial in beta discussion also. If you are still having problems then ask away.

As for the script you'll see it is possible to have Portal in ZC. ;) I'll get it in a workable state where you set the portals manually (ie, push the B button), but right now I just gotta wait untill some help arrives. Patience is Virtue.

XdragonSB
11-03-2007, 11:59 PM
???
How do you set D0 and D1?
I mean, what numbers do I put for them??

And I don't get that "non zero combo"

Gleeok
11-04-2007, 05:37 PM
Did you figure these out? You've seen the other post, right? I'm still working on ComboS, ComboT, and walkability masks. Just use the other one temporarily...and Send Bugs!

XdragonSB
11-04-2007, 05:52 PM
Ohh I see...

But uhh...
I was wondering what I'm suppose to do with the second part of the script.

EDIT:
Do you combine it with the first script?

Anyway

The shot won't hit the wall, it just goes through it.