User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21

Thread: *PORTAL* script

  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    *PORTAL* script

    Ahahaha!!! At long last I believe I have a non-buggy Portal script! (and yet I promise nothing...) Well, I was gonna make a ridiculously hard Portal demo and make someone beat it to get the password...but then I remembered I don't really like making lots and lots of puzzles. Oh well, whatever, I'll leave the puzzles to you guys. Here it is:


    *EDIT* I've edited this to contain all three versions of PORTAL_item. Read below for what each do differently.

    EDIT#2 - Here they are at last, at long last. And now i'll be taking a short break from scripting. :brainfried emoticon!!!:

    EDIT #3 friggin billion....now you can't get stuck in a wall or warp shooters yada yada enjoy.

    Portal item version 3 will recall the portals so you can fire them again
    ^^*RECOMMENDED*^^

    . and portal item 2 will keep one of them active if there are two open portals or let you fire both again or vice-versa, But it's a bit tricky to use. Of coarse practice makes perfect.

    (It's fixed now)Here is the Final version:
    Code:
    //D0 Cset of first portal
    //D1 Cset of second portal
    //D2 speed of portal gun
    
    item script PORTAL_item_ver2{
    
    	void run(int cset, int cset2, int speed){
    
    		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
    		ffc portal2 = Screen->LoadFFC(28);  // and here
    
    
    
    
    			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 = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					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 = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}
    				}
    				else{    // if both portals are already set fire portal 1 again
    
    					if((portal1->Data > portal_data+3) && (portal1->Data <= portal_data+7)&&
    					(portal2->Data > portal_data+3) && (portal2->Data <= portal_data+7)){  
    
    				Game->PlaySound(11);
    
    				if(Link->Dir == 0) {
    					portal1->X = Link->X; 
    					portal1->Y = Link->Y - 16;
    					portal1->Vy = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					portal1->Vy = 0;
    					portal1->Data = portal_data+3;
    					portal1->CSet = cset;
    				}
    			}
    			else{  // if not then fire portal 2 once more
    
    				if((portal2->Data >= portal_data+4) && (portal2->Data <= portal_data+7)){ 
    
    					Game->PlaySound(11);
    			
    					if(Link->Dir == 0) {
    						portal2->X = Link->X; 
    						portal2->Y = Link->Y - 16;
    						portal2->Vy = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}	
    				}
    			}	
    		}} // end of else statements
    	}
    }
    
    item script PORTAL_item_ver3{
    
    	void run(int cset, int cset2, int speed){
    
    		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
    		ffc portal2 = Screen->LoadFFC(28);  // and here
    
    
    
    
    			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 = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					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 = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}
    				}
    				else{
    				
    					portal2->Data = 1;
    					portal2->X = 0; 
    					portal2->Y = 0;
    					portal1->Data = 1;
    					portal1->X = 0; 
    					portal1->Y = 0;
    		
    			}	
    		}
    	}
    }
    
    
    //===================GLOBAL VARIABLES=====================
    	int portal_warp_delay = 0;
    	int enemy_portal_warp_delay = 0;
    
    	int portal_data = 160;	// change this to be the first of 8 block combos for graphics
    
    //make a block of 8 combos, the first 4 being gun projectile up, down, left, right in that order
    //then make the next 4 the same used for open portal animation(no combo cycling)
    //========================================================
    
    //D0 - this ffc number
    //D1 - other ffc number
    // Ex: Set ffc 28 D0 to 28 and D1 to 29 then set ffc 29 D0 to 29 and D1 to 28. easy, huh?
    
    ffc script PORTAL_FFC_ver4{ //   BUGFIXED VERSION
    
    	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_set = 0;
    
    		int portal_position = 0;
    
    		bool portal_open = false;
    
    		int enemy_number = 0;
    		npc enemy;
    
    		this_ffc->Data = 1;this->Y = 0; this->X = 0;
    
    		while(true){
    
    			if(this_ffc->X < 14 || this_ffc->X > 226 || this_ffc->Y < 14 || this_ffc->Y > 146 ||
     				Link->X < 0 || Link->X > 240 || Link->Y < 0 || Link->Y > 160){
    				this_ffc->Data = 1; this->Y = 0; this->X = 0; portal_open = false;}
    			if(this_ffc->Data <= portal_data+3){ portal_open = false;}
    
    			if(portal_warp_delay > 0){ portal_warp_delay--;}
    			if(enemy_portal_warp_delay > 0){ enemy_portal_warp_delay--;}
    
    			if( (this->Data >= portal_data) && (this->Data <=portal_data+3) ){
    
    				if( (this_ffc->Vx < 0) && (Screen->ComboS[ComboAt(this_ffc->X-1, this_ffc->Y+8)] != 0) 
    					&& (Screen->ComboT[ComboAt(this_ffc->X-1, this_ffc->Y+8)] != 3)){ portal_open = true;}
    				
    				if( (this_ffc->Vx > 0) && (Screen->ComboS[ComboAt(this_ffc->X+16, this_ffc->Y+8)] != 0) 
    					&& (Screen->ComboT[ComboAt(this_ffc->X+16, this_ffc->Y+8)] != 3)){ portal_open = true;}
    
    				if( (this_ffc->Vy < 0) && (Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y-1)] != 0) 
    					&& (Screen->ComboT[ComboAt(this_ffc->X+8, this_ffc->Y-1)] != 3)){ portal_open = true;}
    
    				if( (this_ffc->Vy > 0) && (Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y+16)] != 0) 
    					&& (Screen->ComboT[ComboAt(this_ffc->X+8, this_ffc->Y+16)] != 3)){ portal_open = true;}
    				
    			}
    			if(portal_open){
    	
    				if(Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y+8)] == 15){ portal_open = false;}
    				else{ 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 + 8)&&(Link->X >= this_ffc->X -8)&&
    							(Link->Y <= this_ffc->Y + 8)&&(Link->Y >= this_ffc->Y -8) ){
    
    							portal_warp_delay = 60;
    							Link->X = other_ffc->X;
    							Link->Y = other_ffc->Y;
    							Game->PlaySound(36);
    						}
    					}
    					if(enemy_portal_warp_delay == 0){
    
    						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->Tile==0) ){
    							
    								enemy->X = other_ffc->X; enemy->Y = other_ffc->Y; 
    								Game->PlaySound(35);enemy_portal_warp_delay = 80;
    							}	
    							enemy_number--;
    						}
    					}
    				}
    			}
    		Waitframe();
    		}
    	}
    }
    It's currently set up to use ffc's 28 and 29. These are changable only once, before you compile it. Everything else is noted, just read.


    Oh, one more thing. This will warp enemies too, as well as being able to cross over water combos. Want to make some nasty puzzles? I suggest using water...alot. Any non-walkable combo you don't want to open a portal near in fact. And believe it or not it would be quite easy to make 3 or 4 portals using this code. Only a few things would need to be tweaked. I might still do that just for fun. ...or maybe not.

    Oops, I threw something together anyways. :) If you have any problems getting it to work, just download this: PORTAL_DEMO-635( use 635 or 655 to play this.NOTE* THIS DEMO DOES NOT HAVE THE BUGFIXED SCRIPT.

    ...I swear if I have to edit this again i'm gonna go crazy...(crosses fingers and logs off)


    Have fun.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    Octorok Master_of_Power's Avatar
    Join Date
    May 2001
    Age
    35
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,196
    Level
    15
    vBActivity - Bars
    Lv. Percent
    47.07%

    Re: *PORTAL* script

    how does it work? When I shoot it, it fails to open... anywhere...

    One thing I'd like to see is reflection as part of it.
    Keeping something big a secret, in case it doesn't work out I can understand.
    But he deliberatly drops little hints just to drive us mad.

  3. #3
    Wizrobe
    Join Date
    Dec 2006
    Age
    29
    Posts
    3,693
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    8,935
    Level
    28
    vBActivity - Bars
    Lv. Percent
    42.96%

    Re: *PORTAL* script

    Neat, but what does it do?
    Quote Originally Posted by rock_nog View Post
    Well of course eveything's closed for Easter - don't you know of the great Easter tradition of people barricading themselves up to protect themselves from the return of Zombie Christ?


  4. #4
    Octorok Master_of_Power's Avatar
    Join Date
    May 2001
    Age
    35
    Posts
    496
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    2,196
    Level
    15
    vBActivity - Bars
    Lv. Percent
    47.07%

    Re: *PORTAL* script

    It opens up a portal which allows you to transverse from one side of the screen to the other past obsticles... somehow.
    Keeping something big a secret, in case it doesn't work out I can understand.
    But he deliberatly drops little hints just to drive us mad.

  5. #5
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    Re: *PORTAL* script

    Uuh...I knew I should of included a .qst file with this already set up. Alright what tileset you using? Probably DoR, right, yeah, I'll throw one together along with some example puzzles.


    ...I think i'll add that ability to recall poorly placed portals too...
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  6. #6
    Keese
    Join Date
    Mar 2007
    Age
    30
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    832
    Level
    10
    vBActivity - Bars
    Lv. Percent
    9.39%

    Re: *PORTAL* script

    I'm getting this:
    Pass 1: Parsing
    Pass 2: Preprocessing
    Pass 3: Building symbol tables
    tmp, line 139: Error S10: Function ComboAt is undeclared.
    tmp, line 140: Error S10: Function ComboAt is undeclared.
    tmp, line 142: Error S10: Function ComboAt is undeclared.
    tmp, line 143: Error S10: Function ComboAt is undeclared.
    tmp, line 145: Error S10: Function ComboAt is undeclared.
    tmp, line 146: Error S10: Function ComboAt is undeclared.
    tmp, line 148: Error S10: Function ComboAt is undeclared.
    tmp, line 149: Error S10: Function ComboAt is undeclared.

    I'll make the script demo for you. Expect it... when I'm done.

  7. #7
    &&
    ZC Developer
    Joe123's Avatar
    Join Date
    Sep 2006
    Age
    32
    Posts
    3,061
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    7,303
    Level
    26
    vBActivity - Bars
    Lv. Percent
    8.73%

    Re: *PORTAL* script

    If you're getting ComboAt is undeclared, your std.zh is either wrong, or you don't have ' import "std.zh" ' at the beginning of your script document.

    ComboAt is a utility routine declared in std.zh, which turns (x,y) coordinates on a screen into a single number that can be read by some Screen->Combo?[]; commands, so if you've told zscript to import std.zh it should work fine.

  8. #8
    Keese
    Join Date
    Mar 2007
    Age
    30
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    832
    Level
    10
    vBActivity - Bars
    Lv. Percent
    9.39%

    Re: *PORTAL* script

    I see my problem. Thanks.
    EDIT: My demo design requires that the portals are deleted after firing the gun a second time. Could you make it so, Gleeok?

  9. #9
    On top of the world ShadowTiger's Avatar
    Join Date
    Jun 2002
    Location
    Southeastern New York
    Posts
    12,231
    Mentioned
    31 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    29,579
    Level
    46
    vBActivity - Bars
    Lv. Percent
    60.35%
    Achievements It's over 9000!

    Re: *PORTAL* script

    I.e. Perhaps if there are portals on the screen, hitting either L or R would clear them?

    The Portal Flash is a wonderful way to get in touch with your Portal side. Try even a few levels. You'll see why it's so great.

  10. #10
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,959
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.2%

    Re: *PORTAL* script

    OK, I see now.

    Here's two more item scripts for portal:



    This one keeps portal 2 active while you re-shoot portal 1, then re-shoots portal 2 if portal 1 hasn't opened yet.

    Code:
    item script PORTAL_item_ver2{
    
    	void run(int cset, int cset2, int speed){
    
    		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
    		ffc portal2 = Screen->LoadFFC(28);  // and here
    
    
    
    
    			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 = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					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 = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}
    				}
    				else{    // if both portals are already set fire portal 1 again
    
    					if((portal1->Data > portal_data+3) && (portal1->Data <= portal_data+7)&&
    					(portal2->Data > portal_data+3) && (portal2->Data <= portal_data+7)){  
    
    				Game->PlaySound(11);
    
    				if(Link->Dir == 0) {
    					portal1->X = Link->X; 
    					portal1->Y = Link->Y - 16;
    					portal1->Vy = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					portal1->Vy = 0;
    					portal1->Data = portal_data+3;
    					portal1->CSet = cset;
    				}
    			}
    			else{  // if not then fire portal 2 once more
    
    				if((portal2->Data >= portal_data+4) && (portal2->Data <= portal_data+7)){ 
    
    					Game->PlaySound(11);
    			
    					if(Link->Dir == 0) {
    						portal2->X = Link->X; 
    						portal2->Y = Link->Y - 16;
    						portal2->Vy = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}	
    				}
    			}	
    		}} // end of else statements
    	}
    }



    And this one resets them so you can fire them both again:

    Code:
    item script PORTAL_item_ver3{
    
    	void run(int cset, int cset2, int speed){
    
    		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
    		ffc portal2 = Screen->LoadFFC(28);  // and here
    
    
    
    
    			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 = -speed;
    					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 = speed;
    					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 = -speed;
    					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 = speed;
    					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 = -speed;
    						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 = speed;
    						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 = -speed;
    						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 = speed;
    						portal2->Vy = 0;
    						portal2->Data = portal_data+3;
    						portal2->CSet = cset2;
    					}
    				}
    				else{
    				
    					portal2->Data = 1;
    					portal2->X = 0; 
    					portal2->Y = 0;
    					portal1->Data = 1;
    					portal1->X = 0; 
    					portal1->Y = 0;
    		
    			}	
    		}
    	}
    }
    FFC unchanged, so you'll still need that as well. These are untested but they should work fine.


    I'll make the script demo for you. Expect it... when I'm done.
    You got it.

    *NOTE*Also I left in some extra cool stuff, for enemy based puzzles.
    Here's one: Fire the first portal then fire the second directly at an enemy. Pretty nifty, eh?



    Quote Originally Posted by Russdawn
    Neat, but what does it do?
    Well, it makes scrambled eggs! :p
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social