Author Topic: More than 6 costumes, changeable at any point.  (Read 435 times)

Offline thetommyboy2002

  • Moderator
  • Invincible Member
  • ******
  • Posts: 1308
  • Likes: 13
More than 6 costumes, changeable at any point.
« on: September 18, 2018, 12:12pm »
If like me you want to be able to choose from dozens of costumes, rather than a paltry 6 the following may be for you.
I posted on this back in June but ran into some problems with it so I removed all my posts on it.
But I've had it in my game for more than 3 months without it seeming to cause any major problems so here it is.

It takes a bit of time and effort to set up, and you need to know how to mod a bit to get it to work.

If it breaks your game and burns down your town, I take no responsibility for that, and by reading this you enter into a legally binding contract whereby you agree that.

First, the golden rule:
Back Up Everything before you start.
Seriously.
Back up your Actors folder, your Scripts folder, and your Data folder.
Go on, go do that now. I'll wait here.

All done backing up? Splendid, let's commence.

What is this?
It's a method for overcoming the games 6 costume limit that uses scripts called by a new power.
It means that you can have 10, or 20, or maybe even 50 costumes for a single character.
And you can change to any of those costumes at any point within the game (well, any point where you can use powers, so not in team select screens).
And, provided you started out using one of the first 4 costumes that have the working boosts attached to them, when you swap to a new costume using the costume-change power, you keep the boosts.
So if you liked a particular costume but never used it because the boosts weren't right for you, now you can.

The Mod, for Mod it is, has 5 distinct parts for every character, so it takes a little work to set it up.
For the purposes of this demo, I'm going to use Wonder Man, but the same applies for any character, you just change the names and actor numbers.

Part One: setting up Actors.
Find the actor numbers the character uses, in Wondy's case my mod for him uses 8011, 8012, 8013 etc. etc.
Gather your stock of costume.igb files for the character, and rename them to use the existing convention, but go past 8016 to 8017, 8018, 8019, 8020, using as many numbers as you have costumes.
Copy all these into your Actors folder.

Part Two: the first Script file.
For Wonder Man, I call this first file "wondyskin.py".
If it were for Thor, I'd call it "thorskin.py", for Hulk I'd use "hulkskin.py".
I stick with all lowercase, because it's easier to remember for me.
And the script is:
Code: [Select]
wondy_skin = getZoneVar("wondys")

if wondy_skin == 1
     setZoneVar("wondys", 2 )
else
     setZoneVar("wondys", 1 )
endif

if wondy_skin == 2
     setZoneVar("wondys", 3 )
endif

if wondy_skin == 3
     setZoneVar("wondys", 4 )
endif

if wondy_skin == 4
     setZoneVar("wondys", 5 )
endif

if wondy_skin == 5
     setZoneVar("wondys", 6 )
endif

if wondy_skin == 6
     setZoneVar("wondys", 7 )
endif

if wondy_skin == 7
     setZoneVar("wondys", 8 )
endif

if wondy_skin == 8
     setZoneVar("wondys", 9 )
endif

if wondy_skin == 9
     setZoneVar("wondys", 10 )
endif

if wondy_skin == 10
     setZoneVar("wondys", 11 )
endif

if wondy_skin == 11
     setZoneVar("wondys", 12 )
endif

if wondy_skin == 12
     setZoneVar("wondys", 13 )
endif

if wondy_skin == 13
     setZoneVar("wondys", 14 )
endif

if wondy_skin == 14
     setZoneVar("wondys", 15 )
endif

if wondy_skin == 15
     setZoneVar("wondys", 1 )
endif

What does this do?
It sets a zone variable, and depending on the costume set in the other script file, increments that variable by one every time the power is used, then after 15 uses, loops back round to 1.
It doesn't need to go up to 15, if you only have 8 costumes then just go up to 8.
It can also go above 15 just by adding in more lines with higher numbers, as long as the last one sets the zone variable back to 1.
To use with a different character, edit the script and use find/replace to replace the word "wondys" with "thors" or hulks", and then replace the word "wondy_skin" with "thor_skin" or "hulk_skin".
All instances need to be replaced within the file.
Then save it as "hulkskin" or "thorskin" or "richardmillhousenixonskin".
This and the next script both need to be saved in the "scripts" folder.

Part Three: The Second Script.

The second script for Wonder Man is called "setskinwondy.py".
Again, for another character call it "setskinhulk.py" or "setskinmadonna.py" etc.
This is what it contains:

Code: [Select]
wondy_skin = getZoneVar("wondys")
if wondy_skin == 1
     setSkin("Wonderman", "8011")
elif wondy_skin == 2
     setSkin("Wonderman", "8012")
elif wondy_skin == 3
     setSkin("Wonderman", "8013")
elif wondy_skin == 4
     setSkin("Wonderman", "8014")
elif wondy_skin == 5
     setSkin("Wonderman", "8015")
elif wondy_skin == 6
     setSkin("Wonderman", "8016")
elif wondy_skin == 7
     setSkin("Wonderman", "8017")
elif wondy_skin == 8
     setSkin("Wonderman", "8018")
elif wondy_skin == 9
     setSkin("Wonderman", "8019")
elif wondy_skin == 10
     setSkin("Wonderman", "8020")
elif wondy_skin == 11
     setSkin("Wonderman", "8021")
elif wondy_skin == 12
     setSkin("Wonderman", "8022")
elif wondy_skin == 13
     setSkin("Wonderman", "8023")
elif wondy_skin == 14
     setSkin("Wonderman", "8024")

else
     setSkin("Wonderman", "8011")

endif
This script gets the "wondys" zone variable from the other script, and depending on its value uses the "setSkin" command to change the skin (costume) of Wonder Man.
If the "wondys" variable is higher than 14, it sets the skin back to 8011, the very first skin.
When I set up all my Actors in step one, I remembered which was the last one, and that is the last one called in this script.
If the script calls an actor that doesn't exist, like 8025, the game WILL CRASH. So pay attention to your numbers here.
Again, if I only had 8 costumes, I would edit out the later numbers leaving it to loop round to 8011 afer 8018 was called.
To set this script up for a different character, rename it, then find/replace "wondy_skin" with "thor_skin" or "mariecurie_skin".
Then find/replace "Wonderman" and replace with "Thor" or "BigBird" or whater the name of the character is in your Herostat.
Lastly, replace all the 8011, 8012 etc. number with the correct numbers for the actors for your character.
Then save your new script in the "scripts" folder.

Part Four: create the new power.

If you are unfamiliar with editing powers and talents I urge you to read some tutorials.
First decompile your "ps_wonderman.engb" to create a "ps_wonderman.xml" file.
Read through the file till you find the last power, for Wondy it was power9, so our new power will be power10.
Whatever the number of the last power, add one for this new power.
Open this in a text editor and at the end after the final power, insert the following:
Code: [Select]

   FightMove {
   aireusetime = 15 ;
   aitype = buffself ;
   animenum = ea_menu_goodbye ;
   icon = 5 ;
   is_power = true ;
   lockangles = true ;
   name = power10 ;
   priority = 5 ;
      require {
      cat = skill ;
      item = wonder_p10 ;
      level = 1 ;
      }

      trigger {
      name = runscript ;
      script = scripts/setskinwondy.py ;
      time = 1.0 ;
      }

      trigger {
      name = runscript ;
      script = scripts/wondyskin.py ;
      time = 0.2 ;
      }

      chain {
      action = idle ;
      result = idle ;
      }

   }

Save the xml and recompile back into the engb.

Now find the talent file, and decompile "wonderman.engb" to get "wonderman.xml".
Read through till the last power, which should be the same number we found in the powerstyle we just edited.
After the final power, edit in the following:

Code: [Select]

   talent {
   descname = Outfit Change ;
   description = Change Outfit. ;
   descshort = Boost ;
   icon = 5 ;
   icon_texture = textures/ui/wonder_icons.png ;
   name = wonder_p10 ;
   power = power10 ;
      talentvalues {
         talentvalue {
         level = 1 ;
         name = wonder_p10_req ;
         value = 1 ;
         }

      }

   }

Save the xml, and compile it back ito an engb.
3 things of note here:
We can call the power whatever we choose, I chose to call it "Change Outfit".
We can select whatever animation we want to play when the power is triggered, I chose menu_select because it's distinctive.
We can choose whatever icon we want for the power, I chose 10 because I'm lazy and don't care if another power also uses it.
Why play an animation at all?
You could dispense with it, but I prefer to have a second or two to view the costume I've changed to.
If it changed instantly you may find you flick through too quickly, and need to cycle round to the one you want.
I also happen to think it looks cool.


Part Five: Edit Herostat.

Alright, we are almost there.
Decompile and edit your "herostat.engb" to produce "herostat.xml".
Find the entry for Wonder Man (or whomever it is you are altering).
Within the entry, below the first couple of talent entries, edit in:

Code: [Select]

      talent {
      level = 1 ;
      name = wonder_p10 ;
      }

This makes sure the power is available from level one.
Recompile the herostat.

You should now be able to run the game and should see the power as whatever icon you set.
The first time you trigger it, nothing will happen, but after that, it should set a new skin every time you use it.

Edit: If you change levels, your skin will revert to whatever skin you chose in team-select screen, and you'll have to re-use the change-outfit power again to load up your favourite skin on the new level.
There MAY be an issue where if you use the power on several characters, the last one can't access all costumes.
This was why I held off on release, but ended up not caring, and released anyway.

And I hope this video works, showing it in action:
https://youtu.be/DhHApNlxKZY
« Last Edit: September 19, 2018, 01:14am by thetommyboy2002 »

Offline BaconWizard17

  • Invincible Member
  • ******
  • Posts: 1174
  • Likes: 45
  • Sometimes you just gotta go for it, ya know?
Re: More than 6 costumes, changeable at any point.
« Reply #1 on: September 18, 2018, 01:05pm »
Interesting. Is it executed like a boost of sorts?

Offline thetommyboy2002

  • Moderator
  • Invincible Member
  • ******
  • Posts: 1308
  • Likes: 13
Re: More than 6 costumes, changeable at any point.
« Reply #2 on: September 18, 2018, 01:12pm »
Interesting. Is it executed like a boost of sorts?
Not really.
You use the power, the skin changes. You can keep playing with the new skin, or use the power again and again till you get the skin you want.

Oh, and if you change levels, you go back to the original skin selected on team select, and have to use the power again to get back to the skin you want.

Offline BaconWizard17

  • Invincible Member
  • ******
  • Posts: 1174
  • Likes: 45
  • Sometimes you just gotta go for it, ya know?
Re: More than 6 costumes, changeable at any point.
« Reply #3 on: September 18, 2018, 01:50pm »
That’s pretty neat though. Good job! There’s no reason this wouldn’t work in XML2, right?

Offline thetommyboy2002

  • Moderator
  • Invincible Member
  • ******
  • Posts: 1308
  • Likes: 13
Re: More than 6 costumes, changeable at any point.
« Reply #4 on: September 18, 2018, 01:54pm »
That’s pretty neat though. Good job! There’s no reason this wouldn’t work in XML2, right?

In theory it should.
I've never tried setSkin in XML2 though, or calling scripts.
But the 2 games are generally similar enough that I think it probably would work.

Offline Julio Cabral

  • Marvel Modder
  • Incredible Member
  • *****
  • Posts: 975
  • Likes: 132
Re: More than 6 costumes, changeable at any point.
« Reply #5 on: September 18, 2018, 01:57pm »
Thanks! I think we can even trigger the script with Outsider's block+smash code. This way no power should be affected.

Offline BaconWizard17

  • Invincible Member
  • ******
  • Posts: 1174
  • Likes: 45
  • Sometimes you just gotta go for it, ya know?
Re: More than 6 costumes, changeable at any point.
« Reply #6 on: September 18, 2018, 02:39pm »
In theory it should.
I've never tried setSkin in XML2 though, or calling scripts.
But the 2 games are generally similar enough that I think it probably would work.

Actually, I don't know if it will, since XML2 doesn't use skin filters in the herostat (for things like hiding skin segments or boltons) or talents/powerstyles (for things like shapeshifting boosts). However, since it's in a script, it may work.

Offline thetommyboy2002

  • Moderator
  • Invincible Member
  • ******
  • Posts: 1308
  • Likes: 13
Re: More than 6 costumes, changeable at any point.
« Reply #7 on: September 19, 2018, 01:06am »
Thanks! I think we can even trigger the script with Outsider's block+smash code. This way no power should be affected.
I think that there was a reason I didn't try that, but I cannot remember now why not.
It may have been that I always found the block+smash a bit unreliable to trigger, or that I couldn't figure out how to add in my mod to it.
Certainly it might make the process easier if it could be done that way.

Offline Canino

  • Fantastic Member
  • ****
  • Posts: 314
  • Likes: 27
Re: More than 6 costumes, changeable at any point.
« Reply #8 on: September 19, 2018, 06:06am »
Wow!!! That's really interesting. I'll sure try it.

"It doesn't matter what you do, but how you do it."