Menu
 

Modding Rundown: PY Scripts

Started by Teancum, April 19, 2007, 06:04PM

Previous topic - Next topic
October 29, 2021, 11:57AM #60 Last Edit: October 29, 2021, 12:11PM by BaconWizard17
A new one I found in XML2's exe:

X = isCharacterUnlocked("name")

Use to tell if a character has been unlocked or not. == 1 if they are, == 0 if they aren't. Also returns 0 if the character is not on the roster at all.

I feel like I am missing something.
been working on a script to give statboost using
permanentStatBoost('name','stat')

Based on intial post it indicates that leaving name empty it will give boost to all heros as shown in below quote,

QuotepermanentStatBoost('name','stat')
Raises a hero stat (skill, body, focus...) For Example: permanentStatBoost('_HERO1_','skill') Gives whoever is in the first character slot 1 new skill point.  If name is empty, applies to all

But does not seem to work when leaving name as an empty string '' , nor null, None, omiting the variable and just passing in stat, tried ' ' single space string, and still no boost to stats to characters
Starting to think its not a thing in MUA, but just wanted to ask about this to make sure I am not overlooking something or misunderstanding something.

Thanks for any clarity anyone can provide in relation to this,  :warbird: Stay Awesome

Quote from: CCali on December 03, 2021, 09:12PM
I feel like I am missing something.
been working on a script to give statboost using
permanentStatBoost('name','stat')

Based on intial post it indicates that leaving name empty it will give boost to all heros as shown in below quote,

But does not seem to work when leaving name as an empty string '' , nor null, None, omiting the variable and just passing in stat, tried ' ' single space string, and still no boost to stats to characters
Starting to think its not a thing in MUA, but just wanted to ask about this to make sure I am not overlooking something or misunderstanding something.

Thanks for any clarity anyone can provide in relation to this,  :warbird: Stay Awesome

Have you tried using _HERO1_? That will apply it to the first hero on your team. If that doesn't work, then the 'stat' portion may be incorrect. Which script are you putting this in?

Sorry, missed reply and question earlier,

Quote from: BaconWizard17 on December 05, 2021, 10:23AM
Have you tried using _HERO1_? That will apply it to the first hero on your team. If that doesn't work, then the 'stat' portion may be incorrect. Which script are you putting this in?

If I use
permanentStatBoost('_HERO1_','skill')
it works as as expected based on the description given, gives 1 skill point to first hero,

but when reading back to op, it says
Raises a hero stat (skill, body, focus...) For Example: permanentStatBoost('_HERO1_','skill') Gives whoever is in the first character slot 1 new skill point.  If name is empty, applies to all

This is the part I was trying to get to work, if name is empty applies to all.

it does not seem this part is true for MUA, seems like you have to specify a HERO, or the owner or activator to get the boost.
but I could be missing something, or this statement is only true in maybe XML1 and/or 2 but not MUA.

in mua if I tried
permanentStatBoost('','skill')   leaving name empty string as the op suggest, I expected either team to get it or all my unlocked heroes. but neither happened
nor did it work with focus or the other stats
also tried permanentStatBoost('skill') and permanentStatBoost(null,'skill') and permanentStatBoost(None,'skill')
but no version of leave name empty seemed to work, also tried with focus stat in each case to see if was issue with skill boost part or something.

So I was intially trying to figured out if I missed something. I did find away to get same effect I wanted for the mod by giving all characters 3000 xp at beginning of a new game, since to fit in all the talents in the herostats I removed the auto give of everyone's first power (tey were taking up 50 of the entries and I wanted to give several heroes some base talents). This gets the same effect of +1 skill point. But some characters auto spend gives the point to boost instead of first power.

Even though I found a work around would be nice to know for certain, if that line of leave name empty to apply to all works in mua and if so what was I misunderstanding. Or leaving name empty does not work in mua, thats fine. could even be a mistake in the original post. Only been doing this stuff for like 2 weeks now, so there is much to learn.

Stay Awesome :warbird:

It may not actually work for the whole team then, and you'll have to do one line for each character, i.e.
permanentStatBoost('_HERO1_','skill')
permanentStatBoost('_HERO2_','skill')
permanentStatBoost('_HERO3_','skill')
permanentStatBoost('_HERO4_','skill')

That works too, and looking at using it with something else I am doing.

But I was so focused on it because I wanted +1 skill points for all playable heroes,
and description sounded like my ticket to what I wanted but in end for that just made all
playable heroes start at level 2. It works but feels a little hacky and not exactly what I
wanted. So was seeing if anyone had more info on it.
But looks like something I will just have to live without and do things the way I found,
even if not perfect

Stay Awesome :warbird:

Updated table for XML2 script commands:

Quote
Script Command            Params            Values / Examples            Description




unlockCharacter 1: (str) wolverine, ironman Adds a hero to the playable roster permanently.
lockCharacter 1: (str) scarletwitch Removes a hero from the roster.
setAvailable 2: (str, bool) (profex, 1) Toggles selection visibility at Extraction Points.
isAvailable 1: (str) wolverine Returns 1 if hero is unlocked, 0 if not.
unlockCostume 2: (str, str|int) (storm, ultimate) Unlocks a specific skin for a specific hero.
lockCostume 2: (str, str|int) (cyclops, 1) Relocks a specific skin for a specific hero.
setSkin 2: (str, str|int) (colossus, 0) Instantly changes an active hero's 3D skin.
getSkin 1: (str) wolverine Returns the name/index of current skin.
unlockAllCostumes 0 - Global cheat: Unlocks every skin for every hero.
setLevel 2: (str, int) (nightcrawler, 99) Sets character level; updates CStats.
getLevel 1: (str) bishop Returns the hero's current level.
addExperience 2: (str, int) (rogue, 5000) Grants a specific amount of XP.
addCharacterStat 2: (str, int) (magneto, 10) Adds unspent stat points (Body, Focus, etc).
resetStats 1: (str) cyclops Refunds all spent stat points to the pool.
unlockPower 2: (str, str) (storm, lightning) Forces a power to unlock regardless of level.
giveTechbits 1: (int) 100000 Modifies global techbit currency.
giveItem 2: (str, int) (nano_bandage, 10) Adds equipment/consumables to inventory.
dropItem 1: (str) health_pack Forces the player to drop an item.
setCheat 2: (str, bool) (godmode, 1) Toggles flags in the CCheats bitfield.
spawn 2: (str, str) (boss_apoc, mkr_1) Spawns an entity at a map locator.
despawn 1: (str) npc_guard_01 Removes an entity from the active pool.
kill 1: (str) player1 Sets target health to zero.
revive 1: (str) player2 Resurrects a fallen hero.
playAnim 2: (str, str) (beast, roar) Forces an entity to play an animation sequence.
stopAnim 1: (str) wolverine Interrupts current animation.
applyStatEffect 2: (str, str) (frozen, enemy_01) Manually applies a buff/debuff effect.
removeStatEffect 2: (str, str) (stun, player1) Clears a specific status effect.
completeMission 1: (str) m_act1_main Marks a mission ID as complete.
setObjective 2: (str, int) (obj_1, 1) Sets objective state (0: Hidden, 1: Active, 2: Done).
loadMap 1: (str) act1_sanctuary Teleports party to a new map file.
saveGame 1: (int) 1 Triggers a save to the specified slot.
loadGame 1: (int) 1 Loads the specified save slot.
startConversation 2: (str, str) (convo_beast, p1) Triggers a specific dialogue interaction.
stopConversation 0 - Ends active dialogue immediately.
playMovie 1: (str) cin_intro Plays a BIK cinematic file.
playMusic 1: (str) mus_combat_01 Changes the background music track.
stopMusic 0 - Fades out current music.
playSound 1: (str) snd_explosion Plays a specific sound effect.
shakeCamera 2: (float, float) (1.5, 0.5) Triggers camera shake (Intensity, Duration).
setCameraTarget 1: (str) boss_entity Forces camera to track a specific object.
releaseCamera 0 - Returns camera control to the player.
setWeather 1: (str) snow_heavy Changes map environmental effects.
ent_getproperty 2: (str, str) (p1, health) Returns value of a C++ member variable.
ent_setproperty 3: (str, str, val) (p1, speed, 2.0) Directly writes to a C++ member variable.
exec 1: (str) myscript.py Executes an external script file.
eval 1: (str) print("hello") Evaluates a string as a script command.
print 1: (str) Debug Active Outputs text to the engine console/log.
setGlobal 2: (str, val) (g_difficulty, 2) Sets a global script variable.
getGlobal 1: (str) g_story_pos Retrieves a global script variable.
wait 1: (float) 2.5 Pauses script execution (in seconds).
pauseGame 1: (bool) 1 Toggles the game's pause state.
enableInput 1: (bool) 0 Disables/Enables player controller input.
fadeToBlack 1: (float) 1.0 Fades the screen out over time.
fadeFromBlack 1: (float) 1.0 Fades the screen in over time.
setTimer 2: (str, int) (bomb_timer, 60) Starts an on-screen countdown.
stopTimer 1: (str) bomb_timer Removes an active countdown.
forceTeamChange 1: (str) wolverine Forces the player to switch to this hero.
lockTeam 1: (bool) 1 Prevents the player from changing heroes.
setAIState 2: (str, str) (p2, aggressive) Changes follower AI behavior.
teleport 2: (str, str) (p1, exit_marker) Moves an entity to a locator instantly.
setLightGroup 2: (str, int) (p1, 5) Changes lighting group for a character.
setCollision 2: (str, bool) (wall_01, 0) Toggles physics collision for an object.
damage 2: (str, int) (enemy_01, 50) Applies direct damage to an entity.
heal 2: (str, int) (p1, 100) Restores health to an entity.
invincible 2: (str, bool) (p1, 1) Toggles invulnerability for a target.
setGravity 1: (float) -9.8 Modifies map-wide gravity.
setGameSpeed 1: (float) 0.5 Slows down or speeds up engine time.
showHUD 1: (bool) 0 Toggles the entire user interface.
messageBox 1: (str) Unlock Alert! Displays a pop-up text box.
quitGame 0 - Exits the application.
setResolution 2: (int, int) (1920, 1080) Changes the engine's render resolution.
toggleConsole 0 - Opens the internal engine debug terminal.

All Marvel: Ultimate Alliance commands

Quote
Command Parameters Data Types Example Usage Description
runscriptscriptPath String runscript("scripts/mission.py") Executes an external Python script file.
addSimulatorScorepoints Int addSimulatorScore(500) Increments the current Simulator challenge score.
getComicMissionVillainNone N/A v = getComicMissionVillain() Returns the string name of the mission's boss.
getComicMissionHeroNone N/A h = getComicMissionHero() Returns the required hero for the Comic Mission.
setComicMissionHeroPlayerplayerID Int setComicMissionHeroPlayer(1) Assigns the required hero to a specific player slot.
setSkinactor, skinID String, String setSkin("ironman", "0201") Swaps an actor's visual model/texture set.
spawnactor, node String, String spawn("Mephisto", "t_boss_01") Spawns an entity at a map trigger node.
spawnEffectfx, node String, String spawnEffect("fx_portal", "t_node") Plays a specific FX at the designated node.
spawnInventoryItemitem, node String, String spawnInventoryItem("xp_token", "t_1") Drops a physical item at the map location.
getZoneVarvarName String v = getZoneVar("door_state") Retrieves a variable local to the current zone.
setZoneVarvarName, val String, Mixed setZoneVar("is_active", 1) Sets a variable local to the current zone.
getGameVarvarName String v = getGameVar("gv_hero_count") Retrieves a global persistent variable.
setGameVarvarName, val String, Mixed setGameVar("gv_unlocked", 1) Sets a global persistent variable.
setInvulnerableactor, bool String, Bool setInvulnerable("hero1", true) Toggles damage immunity for the actor.
setInvisibleactor, bool String, Bool setInvisible("hero1", true) Makes an actor invisible to NPCs and players.
setNoClipactor, bool String, Bool setNoClip("hero1", true) Disables physical collision for the actor.
setNoGravityactor, bool String, Bool setNoGravity("hero1", true) Prevents gravity from affecting the actor.
setAIActiveactor, bool String, Bool setAIActive("boss", false) Enables or disables the AI for a specific NPC.
unlockCharacterheroID String unlockCharacter("SilverSurfer") Adds a hero to the character select screen.
lockCharacterheroID, bool String, Bool lockCharacter("Blade", true) Removes or locks a character from selection.
setTeamLevellevel Int setTeamLevel(99) Overrides the player's team level.
addXtremePipamount Int addXtremePip(1) Grants a portion of the Xtreme power meter.
playAnimactor, anim String, String playAnim("hero", "ea_idle") Forces the actor to play a specific animation.
setAnimSpeedactor, val String, Float setAnimSpeed("hero", 2.0) Multiplies animation playback speed.
setScaleactor, val String, Float setScale("hero", 1.5) Resizes the actor's model scale.
setAlphaactor, val String, Float setAlpha("hero", 0.5) Sets the transparency of the actor model.
lockControlsbool Bool lockControls(true) Disables all player controller inputs.
setHudVisiblebool Bool setHudVisible(false) Toggles the visibility of the UI/HUD.
showHealthBaractor, bool String, Bool showHealthBar("boss", true) Displays the boss health bar UI.
killEntityactor String killEntity("minion_01") Removes an entity from the world immediately.
addBoltonact, item, bone String, String, String addBolton("hero", "sword", "hand_r") Attaches a model piece to an actor's bone.
setGoalactor, node String, String setGoal("npc", "t_destination") Sets an AI navigation destination.
actionFigureRewardfigureID String actionFigureReward("fig_thor") Grants the player a collectible action figure.
checkpointSaveNone N/A checkpointSave() Forces a checkpoint save to the profile.
setMusicOverridetrack String setMusicOverride("boss_fight") Forces a specific audio track to play.
setUnderWaterbool Bool setUnderWater(true) Enables water physics/visuals for the zone.
pauseNone N/A pause() Pauses the internal game clock/logic.
resumeNone N/A resume() Resumes the internal game clock/logic.
getHeroNameactor String name = getHeroName("hero1") Returns the string display name of a hero.
setHealthactor, val String, Int setHealth("hero1", 100) Sets the health points for an actor.
getHealthMaxactor String hp = getHealthMax("hero1") Returns the maximum health of an actor.
setAggressionactor, val String, Int setAggression("npc", 100) Adjusts the NPC's AI aggression level.
setAnglesactor, x, y, z Str, Float x3 setAngles("hero1", 0, 90, 0) Sets the rotation angles of an actor.
setOriginactor, x, y, z Str, Float x3 setOrigin("hero1", 10, 0, 50) Sets the XYZ position of an actor.
setVelocityactor, x, y, z Str, Float x3 setVelocity("hero1", 50, 0, 0) Applies a velocity vector to an actor.
showMoviesbool Bool showMovies(true) Enables playback of cinematic files.
setSpecialModemodeID Int setSpecialMode(1) Sets internal engine state (debug/special).