Jump to content

Photo

Horizontal Guardian FFC Script


  • Please log in to reply
2 replies to this topic

#1 NoeL

NoeL

    Legend

  • Members
  • Real Name:Jerram

Posted 15 June 2007 - 11:53 PM

Heya, I was just playing around, figuring out ZASM stuff, and made this little dude.

It can be used as a smart-trap, or a guard or something, the details are in the script.

Save the following to a txt file, import it as an ASM FFC script, assign it to a freeform combo, fill in the required arguments, and you're good to go.

CODE
; Horizontal Guardian FFC Script v1.0
; by NoeL
; copyright 16/6/07
; All rights reserved
;
; You may use and edit this script as you see fit, but may NOT redistribute
; it edited or otherwise without crediting me, NoeL, as creator.
;
;***********************************************************************
;     ~ABOUT THE SCRIPT~
;  This script will create a horizontal moving combo with customisable
; left and right speed and animation, that always seeks to block Link's
; path. The script does not test for collisions with solid combos,
; so the X co-ordinates of the left pixels of the Guardians first and
; last WALKABLE tiles (i.e. the ground it will walk on) must be entered
; into fields d0 and d1 respectively. Lastly, since the combo's movement
; is based on speed rather than position, faster speeds can cause the
; Guardian to "shiver" when near - but not exactly on - Link's X
; co-ordinate.
;
;***********************************************************************
;     ~VARIABLES~
; (variables d0-d2 and d4-d5 must be entered manually into the FFC's
;  arguments tab. For correct animation, make sure the guardian combos
;  are set sequentially in the combo table as: stationary; left; right,
;  and d2 is set to the combo number of the stationary-animation combo.)
;
;*d0 = x co-ord. of guardians leftmost movability
;*d1 = x co-ord. of guardians rightmost movability (- combo width)
;*d2 = combo number for stationary animation (d2 + 1 = left animation,)
;        d2 + 2 = right animation)
;*d3 = determines where the combo needs to move. 0 = stationary,
;        1 = needs to move left, 2 = needs to move right
;*d4 = speed of combo moving left (requires a negative number)
;*d5 = speed of combo moving right (requires a positive number)
;          [NOTE: Entering a positive number for d4 and]
;          [     a negative number for d5 will result  ]
;          [     in the combo avoiding Link.           ]
;
;***********************************************************************
;     ~CODE~
;
;       INITIALISE VARIABLES
;
S SETV d3,0;                 sets movement type to stationary
SETR data,d2;               sets animation to stationary
SETV xd,0;                  stops ffc
;
;       DETERMINE NEXT ACTION
;
COMPARER x,linkx;           compares Link's x position
   GOTOTRUE E;               if Link and Guardian are inline, end frame
   SETV d3,1      
   GOTOMORE MOVE;            exit to movements                
   SETV d3,2      
;    
;       MOVE GUARDIAN
;
MOVE COMPAREV d3,1          
   GOTOFALSE R
COMPARER x,d0;              checks to see if at left bounds (d0)
   GOTOLESS E;               end
SETR xd,d4;                 sets speed to -  
ADDV data,1;                sets animation to left                
GOTO E;    
R COMPARER x,d1;             checks to see if at right bounds (d1)
   GOTOMORE E;               end                                  
SETR xd d5;                 sets speed to +    
ADDV data,2;                sets animation to right        
;
;       END SCRIPT
;  
E WAITFRAME
GOTO S


Oh wait... reading the warning... are we not allowed to post scripts? Would that be encouraging people to go unstable?

Edited by NoeL, 16 June 2007 - 12:02 AM.


#2 Evile

Evile

    Dolphinslayer

  • Members

Posted 16 June 2007 - 12:00 AM

I'm almost certain that your alowd to post code. This is the scripting forun isn't it? icon_razz.gif

#3 NoeL

NoeL

    Legend

  • Members
  • Real Name:Jerram

Posted 16 June 2007 - 12:02 AM

Yeah, just looking at this though,
QUOTE
If the first warning in the forum description wasn't enough, here we go again.

Scripting is a beta feature! As such, the betas that it is featured in can be unstable! This forum is meant to allow people to be introduced to scripting for future use... not to encourage them to upgrade to unstable betas.

You have been warned... again.


Anyway, Nathaniel gave me the go-ahead, so I'm posting.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users