Main
Projects
Art
Music
Scripting
LiveJournal
Forum
Links
Zelda Scroll
by Fyrewulff

Zelda Attack, Zelda Scroll -- what's next? Anyway, to use this one, partition your map into 18 x 12 areas which will be your screens. At the edge of each one, put the NPC designated by the "scrollnpc" variable (this defaults to 0) facing the direction of the screen it should scroll to when the player steps on it.
It's a little complicated, I know. Assign the script to the "scrollnpc" NPC and put the NPC where you want the screen to scroll, and just put the same NPC for the other side of the "door."


script, zelda scroll, begin
	suspend player # don't let the player screw this up!

	variable (scrollnpc) # for changing the NPC used

	scrollnpc := 0    # scroll npc is NPC 0, change to suit needs
	if(herodirection(me) == up, or, herodirection(me) == down)
		then, begin
			pancamera(herodirection(me),12,10) # pan camera 12 tiles up or down!
		end

	if(herodirection(me) == left, or, herodirection(me) == right)
		then, begin
			pancamera(herodirection(me),18,10) # pan camera 19 right or left!
		end


	variable (tempx) # Magical NPC Locator Variables (tm)
	variable (tempy)
	
	tempx := herox(me) # MNL Variables are set to the hero's current position
	tempy := heroy(me)

	
	# these IFs set the "npc locator" variables one ahead of the hero
      # so it doesn't "find" the npc the hero is standing on
	
	if(herodirection(me) == up) then ( tempy := tempy -- 1 )
	if(herodirection(me) == down) then ( tempy := tempy + 1 )
	if(herodirection(me) == left) then ( tempx := tempx -- 1 )
	if(herodirection(me) == right) then ( tempx := tempx + 1 )


	while(npcatspot(tempx,tempy) == false) # time to search for that NPC
		do, begin
			# Yes, I used the same ifs again.
			# Re-usable code: Hey, it worked for Windows! (tm)
			
                if(herodirection(me) == up) then ( tempy := tempy -- 1 )
            	if(herodirection(me) == down) then ( tempy := tempy + 1 )
            	if(herodirection(me) == left) then ( tempx := tempx -- 1 )
            	if(herodirection(me) == right) then ( tempx := tempx + 1 )
		end

	variable (npctodelete)
	npctodelete := npcatspot(tempx,tempy)

	destroynpc(npctodelete) #destroys NPC ahead of Dogero
	

	# I could have even used the above IFs -again- here, but for
	# some reason it looks better this way.
	# The below code walks Dogero (or the hero) in the direction needed,
	# and then walks them one more step in that direction so I
	# can re-create the NPC in it's old spot
	
	if(herodirection(me) == up, or, herodirection(me) == down)
		then, begin
			walkherotoy(me,tempy)
			waitforhero
			if(herodirection(me) == up) then ( walkhero(me,up,1) , waitforhero)
			if(herodirection(me) == down) then ( walkhero(me,down,1) , waitforhero)
	
		end

	if(herodirection(me) == left, or, herodirection(me) == right)
		then, begin
			walkherotox(me,tempx)
			waitforhero
			if(herodirection(me) == left) then ( walkhero(me,left,1) , waitforhero)
			if(herodirection(me) == right) then ( walkhero(me,right,1) , waitforhero)
	
		end

	walknpc


	createnpc(scrollnpc,tempx,tempy)  # re-creates deleted NPC

	resumeplayer #returns control of game to player after all of this scripting! Phew.

end # end of script

Site layout (c)2000 Jennifer Raby. Used by permission.