[Mod Help] Morphing Creatures
Hi there folks,
I could really need some help here: I'm trying to get a creature morphing/transforming to another "evolved" form if it performs a certain attack or enters a certain phase. So basically, if the creature is weak, it performs an attack named "shapeshifter" or sth. like this (the name in the w2ent-file), but it doesn't transform. So I recreated a completely new model with identical vertices which should work as the target-model.
The problem is, now that I have two working models, how can I get them to morph from one to another by performing a certain action? I already tried to look at monsters that transform, like syrens or bruxae. And I noticed that they both share a class in the w2ent-files (CNewNpc or sth like this). So I tried to recreate this for my creatures w2ent-file. But recreating all this, by adding all the lines like morphsource, morphtarget etc. is very tedious. I mean, I did it, but if the creature is spawned... it has no body, just a floating head. Maybe there is another way, maybe via script, to achieve this.
I already asked erxv and skacikpl for help. Erxv provided me script. His message:
"there is a script.. CMorphedMeshManagerComponent but you would have to activate it manually.. or if its tied to an animation, then u could make a Entry in the animation that calls a function...
heres 2 console commands u can call to spawn the werewolf and then make it morph.. just change the entity template path to your werewolf, just to make sure the morph actually works
exec function spawn(){
var ent : CEntity;
var temp : CEntityTemplate;
var pos : Vector;
var rot : EulerAngles;
pos = thePlayer.GetWorldPosition() + VecConeRand(thePlayer.GetHeading(), 0 , 3, 3);
rot = thePlayer.GetWorldRotation();
rot.Yaw += 180;
temp = (CEntityTemplate)LoadResource("characters\npc_entities\monsters\gryphon_lvl1.w2ent", true);
ent = theGame.CreateEntity(temp, pos,rot);
ent.AddTag('morphingdude');
((CNewNPC)ent).SetTemporaryAttitudeGroup( 'friendly_to_player', AGP_Default );
}
exec function morph( morphRatio : float, blendTime : float){
var entity : CEntity;
var manager : CMorphedMeshManagerComponent;
entity = theGame.GetEntityByTag( 'morphingdude' );
manager = (CMorphedMeshManagerComponent) entity.GetComponentByClassName('CMorphedMeshManagerComponent');
manager.SetMorphBlend( morphRatio, blendTime );
}
But since I'm a complete noob concernig scripting and I never edited a script, I don't know where to put this. I mean, I can't even find the script erxv mentioned and I don't find the scripts for the mentioned monsters.
So this is it. Any help is appreciated
Hi there folks,
I could really need some help here: I'm trying to get a creature morphing/transforming to another "evolved" form if it performs a certain attack or enters a certain phase. So basically, if the creature is weak, it performs an attack named "shapeshifter" or sth. like this (the name in the w2ent-file), but it doesn't transform. So I recreated a completely new model with identical vertices which should work as the target-model.
The problem is, now that I have two working models, how can I get them to morph from one to another by performing a certain action? I already tried to look at monsters that transform, like syrens or bruxae. And I noticed that they both share a class in the w2ent-files (CNewNpc or sth like this). So I tried to recreate this for my creatures w2ent-file. But recreating all this, by adding all the lines like morphsource, morphtarget etc. is very tedious. I mean, I did it, but if the creature is spawned... it has no body, just a floating head. Maybe there is another way, maybe via script, to achieve this.
I already asked erxv and skacikpl for help. Erxv provided me script. His message:
"there is a script.. CMorphedMeshManagerComponent but you would have to activate it manually.. or if its tied to an animation, then u could make a Entry in the animation that calls a function...
heres 2 console commands u can call to spawn the werewolf and then make it morph.. just change the entity template path to your werewolf, just to make sure the morph actually works
exec function spawn(){
var ent : CEntity;
var temp : CEntityTemplate;
var pos : Vector;
var rot : EulerAngles;
pos = thePlayer.GetWorldPosition() + VecConeRand(thePlayer.GetHeading(), 0 , 3, 3);
rot = thePlayer.GetWorldRotation();
rot.Yaw += 180;
temp = (CEntityTemplate)LoadResource("characters\npc_entities\monsters\gryphon_lvl1.w2ent", true);
ent = theGame.CreateEntity(temp, pos,rot);
ent.AddTag('morphingdude');
((CNewNPC)ent).SetTemporaryAttitudeGroup( 'friendly_to_player', AGP_Default );
}
exec function morph( morphRatio : float, blendTime : float){
var entity : CEntity;
var manager : CMorphedMeshManagerComponent;
entity = theGame.GetEntityByTag( 'morphingdude' );
manager = (CMorphedMeshManagerComponent) entity.GetComponentByClassName('CMorphedMeshManagerComponent');
manager.SetMorphBlend( morphRatio, blendTime );
}
But since I'm a complete noob concernig scripting and I never edited a script, I don't know where to put this. I mean, I can't even find the script erxv mentioned and I don't find the scripts for the mentioned monsters.
So this is it. Any help is appreciated