elBukkit / MagicPlugin

A Bukkit plugin for spells, wands and other magic
http://mine.elmakers.com
MIT License
246 stars 148 forks source link

Disguise as Source or Target in Disguise Action #1083

Open NightScythe1 opened 2 years ago

NightScythe1 commented 2 years ago

Looking to make a spell that will disguise a player/caster as their target. Currently this is possible using the Command action and typing:

          - class: Command
          command: disguiseplayer @p @t
          console: true

however, this means normal magic parameters such as Undo cannot apply to it, and players may get stuck in disguise if the spell cancels. It also means it cannot be used on players as you'd need a different command-

          - class: Command
          command: disguiseplayer @p player @t
          console: true

So i wanted to ask if a little integration fix with Libsdisguises was possible, to allow 'target' as an option for the 'type:' in the Magic 'Disguise' action. Thanks for reading!

NathanWolf commented 2 years ago

Try disguise_target: target - I think that should do what you want, though I don't have a working example of it.

NightScythe1 commented 2 years ago

ah awesome, thanks! i'll give it a test as soon as i'm home

NightScythe1 commented 2 years ago

doesn't seem to be working unfortunately- My spell is set to use a selector to find the target & then changecontext to disguise the caster. I may have formatted it wrong? here's the spell- (it currently allows you to select a target, and then messages the caster 'TEST', but does not disguise them)

disguise_self:
    name: Disguise Self
    actions:
      cast:
      - class: EntitySelect
        actions:
          - class: ChangeContext
            target_self: true
            actions:
              - class: Message
                message: TEST
              - class: Disguise
                disguise_target: target
    parameters:
        disguise_target: target
        range: 48
        target_type: LivingEntity
        target: other
NathanWolf commented 2 years ago

Hm- I'm guessing it's because of the ChangeContext, disguise_target: target is going to want to disguise it as itself ...

Try swap_source_and_target: true instead of target_self: true, then in Disguise try disguise_target: self

.. but now that I'm looking at it, Disguise action doesn't even support disguise_target, that appears to only be for ModifyEntity and SpawnEntity. Arg. I can see if I can add support for that to Disguise, I'll leave this open as a TODO.

NathanWolf commented 2 years ago

It also appears that disguise_target is actually very limited, and only works to set the disguise to a player skip.

Is that good enough for what you're trying to do?

NightScythe1 commented 2 years ago

Ah alright, thanks! As for the second question i'm not sure what you mean sorry haha, the spell i'm making is designed to select a nearby entity, mob, or player, and then disguises the caster as them using the disguise action if that makes sense? for example they cast it, select 'NightScythe1' if that player is nearby, and are disguised as that player, or they can select 'Cow' from the selector, and they become a Cow.

NathanWolf commented 2 years ago

Well currently the "disguise_target" feature only works on players, so it's made to copy a player's skin. I did update it to work with the Disguise action, but I think I need to do so more work to make it work with mobs as well.

NightScythe1 commented 2 years ago

Ahh okay, well working for players is pretty good to start with, thanks! does it work under the Disguise action or another liek ModifyEntity?

NathanWolf commented 2 years ago

It should now work consistently in all 3 actions (SpawnEntity, ModifyEntity and Disguise)

I'm going to leave this ticket open to remind me to make it work with mobs as well.

NightScythe1 commented 2 years ago

Ah that's great, thank you!!