Jump to content

Is it possible to use a script to change a mesh during gameplay?


jimmyThePipe

Recommended Posts

Specifically to change how a piece or armor looks if certain conditions are met. So when the user equips this piece of armor the script starts running and depending on the conditions it would show one mesh or another mesh. (Not related, but is it possible to change a texture the same way? So an armor could look beat up or shiny depending on how damaged it is?)

 

I can't find this on Google or the Wikis but I thought I'd ask anyways.

Link to comment
Share on other sites

I would imagine that it would be possible using a swapping script like the one in Adonnay's Classical Weaponry. You would need an object for each condition of the armor. So, say you have 3 armor conditions, we'll call them "undamanged," "worn," and "broken."

 

For each armor, you would then need three separate meshes to represent each condition, say "(armorname)_undamaged.nif," "(armorname)_worn.nif," and "(armorname)_broken.nif." Note that the naming convention is entirely up to you, but some form of unity among them will help keep everything nice and organized. Even if the mesh itself is the same, you will need three so you can attach the different textures one to each mesh.

 

Then in the construction set, you write the script to have it change items depending on the condition of the armor. I don't know how to have it detect that though, so that's as far as I'm able help you with it. Once you figure that out, you then attach the script to the armor you want to use it. Make sure you don't forget to attach that script to each armor object using it though, otherwise it will only change from the one you attached it to.

Link to comment
Share on other sites

Well, when it comes to games, everything is possible with scripting, anything.

 

Although some things may require longer scripts, and I don't really know if it's worth it, hours of work, just to make a piece of armor look a little more beat up after a few hours of gameplay.

Link to comment
Share on other sites

Well, when it comes to games, everything is possible with scripting, anything.

 

Although some things may require longer scripts, and I don't really know if it's worth it, hours of work, just to make a piece of armor look a little more beat up after a few hours of gameplay.

 

 

This could be the case for a lot of mod ideas. But in this case, the scripting mostly already exists. It just needs some modification to work the way the OP wants it to. Here's the script I used for my Dragon Broadswords mod, adapted from Adonnay's Classical Weaponry:

 

scn ARGHippoWeaponSwapEffect

ref weaponFrom
ref weaponTo
short wasEquipped
short s1hPenalty

begin ScriptEffectStart

set weaponFrom to 0
set weaponTo to 0
set wasEquipped to 0

; determine weapons to swap
; Swap Swords 1h -> 2h
if (player.GetEquipped ARGWeapDragonKeepers)
set weaponFrom to ARGWeapDragonKeepers
set weaponTo to ARGWeapDragonKeepers2H
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonLord)
set weaponFrom to ARGWeapDragonLord
set weaponTo to ARGWeapDragonLord2H
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonsBane)
set weaponFrom to ARGWeapDragonsBane
set weaponTo to ARGWeapDragonsBane2H
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonTemplate)
set weaponFrom to ARGWeapDragonTemplate
set weaponTo to ARGWeapDragonTemplate2H
set wasEquipped to 1
set s1hPenalty to 0

; Swap Swords 2h -> 1h
elseif (player.GetEquipped ARGWeapDragonKeepers2H)
set weaponFrom to ARGWeapDragonKeepers2H
set weaponTo to ARGWeapDragonKeepers
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonLord2H)
set weaponFrom to ARGWeapDragonLord2H
set weaponTo to ARGWeapDragonLord
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonsBane2H)
set weaponFrom to ARGWeapDragonsBane2H
set weaponTo to ARGWeapDragonsBane
set wasEquipped to 1
set s1hPenalty to 0
elseif (player.GetEquipped ARGWeapDragonTemplate2H)
set weaponFrom to ARGWeapDragonTemplate2H
set weaponTo to ARGWeapDragonTemplate
set wasEquipped to 1
set s1hPenalty to 0
endif


; handle the 2h weapon swap 
if (wasEquipped == 1)

; unequip weaponFrom
player.UnequipItem weaponFrom

; remove weaponFrom from inventory
player.RemoveItem weaponFrom 1

; add the weaponTo to inventory
player.AddItem weaponTo 1

; equip weaponTo
player.EquipItem weaponTo

if ( s1hPenalty > 0 ) && ( player.getAV Strength < 80 ) 
	message "You are not strong enough to wield this weapon effectively with only one hand!", 3
endif

endif

end

 

 

So what would need to be done is change the references to use the ones from the OP's mod (obviously) and change the script so it is activated when the game determines that the item's health is below a certain value (which I don't know how to do). Some other minor changes may need to also be made, but for the most part, I would think that this idea is entirely feasible without a ton more effort put into it (at least from the scripting side. Coming up with all the textures/meshes could be another matter altogether).

 

Edit: Just thought I should throw in to completely disregard the everything in that script regarding "s1hPenalty" since that would have absolutely nothing to do with the functions you're looking for.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...