This is the solution of a previous question asked in the scripting forum. The solution used SDK modification, so I thought it might be useful to post it in this forum as well. The basic idea is, to change the player's skin while a map is running - a feature which for me turned out much more complicated as I thought.
I added a new variable in player.h:
after 'const idDeclSkin * powerUpSkin;' I added:
const idDeclSkin * headSkin;
set it to NULL in player.cpp:
after 'powerUpSkin = NULL;' I added:
headSkin = NULL;
In player.cpp, I changed two occurences of
headRenderEnt->customSkin = NULL;
into
headRenderEnt->customSkin = headSkin;
I added code to select the skin:
Code:
if(skinselected=="default") {
skin = declManager->FindSkin("skins/characters/player/d3xp_sp");
SetSkin( skin );
renderEntity.shaderParms[6] = 0.0f;
headSkin =declManager->FindSkin("skins/characters/player/normalhead");
headRenderEnt = head.GetEntity()->GetRenderEntity();
headRenderEnt->customSkin = headSkin;
}
if(skinselected=="ninja") {
skin = declManager->FindSkin( "skins/characters/player/ninja" );
SetSkin( skin );
renderEntity.shaderParms[6] = 0.0f;
headSkin = declManager->FindSkin( "skins/characters/player/ninjahead" );
headRenderEnt = head.GetEntity()->GetRenderEntity();
headRenderEnt->customSkin = headSkin;
}
Specifically, I added this code into a script event, which I then control from the map script and voila, the skin can be changed dynamically while the map is running.
Before that I tried various alternative routes including the use of shaderparms - all without success. Changing the playerskin was easy but in order to change the headskin as well, it was important to disable the default reset of the head's skin (due to the possibility that an influence might act on the skin). I think that monsters do not have this default reset and might be easier to cope with.