Hero Invisibilty

Started by Stevespear46, October 31, 2023, 05:59:20 PM

Previous topic - Next topic
Hey everyone,

I've looked through the forums and also though the APIs and I'm having trouble with completing a mechanic. I would like to complete the cane of byrna and magic cape. So I've implemented the the items and have been setting the Here entity visibility to false. Unfortunately this also removes the shadow and the player has no idea where the here is. Has anyone implemented this mechanic yet? I thought maybe I could set the sprites alpha to something low and have a mostly transparent Hero. I don't see APIs for that either. Anyone have some ideas?

I was able to get the effect I want with the script below. I created a new tunic dat with sprits that are semi transparent. also had to add a check to my tunic item so if you changed variants while invisible the spirits would update to the new transparent color. I though about going with a new sprite set altogether like a blacked out ninja set or something... maybe in the future.




   local game = item:get_game()
   local map = item:get_map()
   local hero = map:get_hero()

   local tunic_level = game:get_ability("tunic")

    local isInvisible =  game:get_value("hero_invisible")
    if isInvisible == true then
        game:set_value("hero_invisible", false)
        hero:set_tunic_sprite_id("hero/tunic" .. tunic_level)
    else
        game:set_value("hero_invisible", true)
        hero:set_tunic_sprite_id("hero/item/invisibility/tunic" .. tunic_level)
    end

November 07, 2023, 10:54:16 PM #2 Last Edit: November 07, 2023, 11:06:09 PM by PeterB
Yes that is what I would have suggested, i.e. creating a new hero animation in each tunic variant so when using the cape item so you just see a shadow.

You could change the hero's tunic animation to just show an outline and shadow and change it back once a timer ran out if it was powered by magic for example.