Yanfly's SelfSwVar Plugin Script Compatibility

● ARCHIVED · READ-ONLY
Started by SmashArtist 8 posts View original ↗
  1. Hello!
    I was working on a new feature for my IGMC game entry that requires events to have self variables and switches so I used Yanfly's SelfSwVar plugin which allows for that. Earlier I had a short script:
    $gameParty.gainItem($dataItems[$gameVariables.value(22)], 1)

    This piece of code allows me to give the player an item based off of a variable.
    It worked fine before I added the Yanfly plugin. Is there anyway I can have this piece of code work with the plugin? It's not essential, but would be a gigantic time saver if I could have this issue fixed as since the project is for IGMC 2018, I have a short deadline to meet.

    Any help is welcome! Thank you!~ :kaohi:
  2. Don't use variable 22 as a self variable. That's the only thing I can say.
  3. What is the name you gave to variable 22?
    Where did you add the script to gain items? In an event? A common event? How is it called?
  4. The variable I labeled as "Self Var :: Item".
    The script is in the enemy event, it runs when the enemy has been defeated in battle.

    The reason I have the variable as a self variable is because each on map enemy will be able to hold a different item value based on whether you have lost to them before. Then if you beat them, the item is returned to you.
    I could always change this to all enemies hold the same item, but this is not what I have intended.
  5. As I said, don't use it as a self variable. It has a completely different structure compared to regular variables.Just set the variable's value to something before the gainItem code. Or you can always hardcode the value in the worst case.
  6. Map events exist on the map. Troop events exist in troops. When you call a battle from a map event, you don't have access to that map event in battle, so a self variable attached to an event has no meaning.

    In this case, you don't need to use a self variable at all. Just change the variable to whatever item you want for that event prior to calling battle. If you need to set it up as a self variable, then set the global variable to whatever the self variable is just before the call to battle.

    Something like this:
    Code:
    Control Variables [0025: Enemy Item] = Variable [0022: Self Var:: Item]
    Battle Processing

    and
    Code:
    $gameParty.gainItem($dataItems[$gameVariables.value(25)], 1)
  7. Welp, this was confusing. XD
    Clearly I'm out of practice when eventing. I hadn't touched RPG Maker in a long while.
    All I had to do was to temporarily store the self variable into a normal one and give the item based on the normal one.

    I'm sorry for having bothered you guys!
    Thanks a whole bunch for the help anyhow! :kaojoy:
  8. [closed]IgnoreMe[/closed]