Scripts:Large sprites

From OHRRPGCE-Wiki
Jump to: navigation, search
Difficulty Easy
Skills Should know how to compile and import scripts
An understanding as to how to create autorun scripts

Currently walkabout sprites are limited to 20×20 pixels. If you want nice large walkabouts like in Final Fantasy VI then sadly, there is no built-in way to do so. Fortunately though, it's still possible with some very simple scripting.

The effect can be done using the walktall script created by James Paige as shown in walktall.rpg (see the downloads section at the bottom of the page). In action, it looks like this:

Walktall demo.gif

Now, while it may look complicated, the scripts needed are actually very short and simple.

# Walktall.hss
#
# This example script shows how to make tall walkabouts in the OHRRPGCE by replacing hero
# and NPC walkabout slices with hero battle sprites. (If you are reading this in the
# future, there might already be a built-in way to to tall walkabouts with no scripting.)
#
# To make the heroes and NPCs overlap each other correctly you should set
# "Walkabout Layering: Together" in the general map data editor (this is the
# default for new maps)

plotscript, map autorun, begin

embiggen heroes
embiggen NPCs

end

script, embiggen heroes, begin

variable(hero, sl)
for(hero, 0, 3) do(

if(hero by rank(hero) >= 0) then(

# hero exists
sl := get hero slice(hero)
embiggen walkabout slice(sl)

)

)

end

script, embiggen NPcs, begin

variable(npc, sl) for(npc, -1, -300, -1) do(

if(get NPC id(npc) >= 0) then(

# this NPC exists
sl := get NPC slice(npc)
embiggen walkabout slice(sl)

)

)

end

script, embiggen walkabout slice, sl, begin

variable(pic sl, pic num) if(sl) then(

pic sl := lookup slice(sl:walkabout sprite component, sl)
pic num := get sprite set number(pic sl)
replace hero sprite(pic sl, pic num)

)

end


The only script in this case that needs customizing is map autorun. If you already have a script that automatically runs whenever your map loads, then you just need to include embiggen heroes and embiggen NPCs in your autorun script. In a nutshell, what the scripts do is to cycle through the different heroes and NPCs on a map and then replace their sprites with corresponding hero sprites.

In addition, the provided map autorun script needs to be set as the On-close script in your main menu, as using the Team or Order menus will cause the hero sprites to be reverted.

What this means is that walkabout sprite 00 will be replaced by hero sprite 00. When creating sprites, it is thus necessary to have walkabout sprites numbered and created in the same order as hero sprites. For example:

Walktall0000.png

and

Walktall0001.png


Obviously, using the hero sprites as walkabout sprites will conflict with the hero sprites used in battle. There are various workarounds for this. One solution is to import your battle sprites first (e.g. sprite 0 to 8 will be battle sprites, the rest after that are large walkabout sprites) and only use the following as the larger sprites. There are certainly other ways to go about the problem, but this is perhaps the easiest.

Embiggening single NPCs[edit]

If you only want to embiggen certain NPCs on the map rather than all of them (which requires drawing all walkabouts as hero battle sprites), you can use these adapted scripts. They need to be edited to specify which NPCs should be embiggened.

You only need to set map autorun as the map autorun script on maps with at least one NPC to be embiggened. But because you should also set map autorun as the on-close script for you main menu, it's necessary to also check the map number in it.

plotscript, map autorun, begin
  # (EXAMPLE)
  if (current map == 5) then (   ### Change this
    embiggen NPC(42)  ### Change to correct NPC ID number
  )
  if (current map == 6) then (   ### Change this
    embiggen NPC(23)  ### Change to correct NPC ID number
    embiggen NPC(24)  ### Change to correct NPC ID number
  )
  # Add more embiggen NPC calls as desired
end

# Embiggens all copies of a certain NPC ID on the map
script, embiggen NPC, npc ID, begin
  variable(num, npc, sl)
  for (num, 0, npc copy count(npc ID) -- 1) do (
    npc := npc reference(npc ID, num)
    sl := get NPC slice(npc)
    embiggen walkabout slice(sl)
  )
end

script, embiggen walkabout slice, sl, begin
  variable(pic sl, pic num)
  if(sl) then(
    pic sl := lookup slice(sl:walkabout sprite component, sl)
    pic num := get sprite set number(pic sl)   # You can override the spriteset number if desired
    replace hero sprite(pic sl, pic num)
  )
end

You can add embiggen heroes (along with a call from map autorun) from the original version of the scripts if you want to embiggen the heroes too.

Extensions[edit]

These scripts can also be combined with Scripts:Three-frame walking; see that article for details.

All in all, that's about it. Have fun with your larger sprites!


Downloads[edit]

Walk Tall - 32x40 Hero and NPC walkabout sprite demo