Need help with custom fragments

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
miguel
UNATCO
Posts: 160
Joined: Tue Oct 12, 2010 10:35 pm
Location: Acheron LV-426 Hadley's Hope

Need help with custom fragments

Post by miguel »

The models, texture and class to import are done. Compiled and 0 errors 0 warnings. Made a class below FleshFragment that have on its defaut propieties:
Drawtype=DT_Mesh
Mesh=(The name of 1 of the models)
Compiled, no errors or warnings. Then created a scripted pawn that spawns those fragments. In the editor, when i place it on the map, it shows my model but in game it spawns normal fragments.YAAAAAARRRRRGGGG
Also tried whit a class below DeusExFragmets and now it doen't displays the models but i know the fragments are there because of the blood drops and and splats it spawns.
What is goin on?
Morpheus
X-51
Posts: 967
Joined: Thu Jan 27, 2005 9:56 am
Location: A planet near mars

Re: Need help with custom fragments

Post by Morpheus »

Have not coded in a while but have you tried copying the FleshFragment code and replacing the meshes with yours, and then compiling it with UCC? For this you will have to put this in a UC file and import it to your U file with UCC for this to work.

//=============================================================================
// FleshFragment.
//=============================================================================
class MyFleshFragment expands DeusExFragment;

auto state Flying
{
function BeginState()
{
Super.BeginState();

Velocity = VRand() * 300;
DrawScale = FRand() + 1.5;
}
}

function Tick(float deltaTime)
{
Super.Tick(deltaTime);

if (!IsInState('Dying'))
if (FRand() < 0.5)
Spawn(class'BloodDrop',,, Location);
}

defaultproperties
{
Fragments(0)=LodMesh'MyMesh1'
Fragments(1)=LodMesh'MyMesh2'
Fragments(2)=LodMesh'MyMesh3'
Fragments(3)=LodMesh'MyMesh4'
numFragmentTypes=4
elasticity=0.400000
ImpactSound=Sound'DeusExSounds.Generic.FleshHit1'
MiscSound=Sound'DeusExSounds.Generic.FleshHit2'
Mesh=LodMesh'MyFragmentMesh'
CollisionRadius=2.000000
CollisionHeight=2.000000
Mass=5.000000
Buoyancy=5.500000
bVisionImportant=True
}
You can remove Fragments 1,2 and 3 if you only have one fragment mesh, or you can add fragments (4), (5) etc... if you have more meshes you want to use, just replace the MyMesh1 with whatever your mesh is, same with Mesh=LodMesh'MyFragmentMesh'

Fragments(0)=LodMesh'MyMesh1'
Fragments(1)=LodMesh'MyMesh2'
Fragments(2)=LodMesh'MyMesh3'
Fragments(3)=LodMesh'MyMesh4'

Try that see if it works. Oh, does the mesh display ok on editor (Mesh viewer)? If it doesn't show up properly and all you get is a scrunched up mess, you may need to convert it with Tacks Unr2DE to get the mesh to work on DeusEx as Unreal meshes are slightly different than Deus Ex ones and don't display properly on Deus Ex and need converted.
My nature videos: http://www.youtube.com/user/DynamixWarePro
My whistle/flute videos (and some other videos): http://www.youtube.com/user/DXMorpheus
Darma
UNATCO
Posts: 151
Joined: Wed Apr 15, 2009 2:20 pm

Re: Need help with custom fragments

Post by Darma »

Add alot of log(string); function where you edit something and then look at the log. That can help alot
DDL
Traditional Evil Scientist
Traditional Evil Scientist
Posts: 3791
Joined: Mon Oct 17, 2005 10:03 am

Re: Need help with custom fragments

Post by DDL »

Morpheus hit the nail on the head. Fragments randomise between their fragments() list (the actual mesh= thing is ignored entirely)

So add

numfragmentTypes(1)
fragments(0)=lodmesh'yourmeshhere'

to defprops. :)
miguel
UNATCO
Posts: 160
Joined: Tue Oct 12, 2010 10:35 pm
Location: Acheron LV-426 Hadley's Hope

Re: Need help with custom fragments

Post by miguel »

Thanks to all of you but it did not worked for some reason. The Models are on the editor and mesh viewer. I think i'm doing something wrong.
The original idea was to change the texture of the flesh fragments. Tried whit the defprops but not worked.


The models are normal fragments extracted with a Tack's tool and imported with unr2de and they have a green texture.

//=============================================================================
// AlienFleshFragment.
//=============================================================================
class AlienFleshFragment expands Object
abstract;

#exec MESH IMPORT MESH=AlienFleshFragment1 ANIVFILE=Models\AlienFleshFragment1_a.3d DATAFILE=Models\AlienFleshFragment1_d.3d ZEROTEX=1
#exec MESHMAP SCALE MESHMAP=AlienFleshFragment1 X=0.01390625 Y=0.01390625 Z=0.01390625
#exec MESH SEQUENCE MESH=AlienFleshFragment1 SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=AlienFleshFragment1 SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESH IMPORT MESH=AlienFleshFragment2 ANIVFILE=Models\AlienFleshFragment2_a.3d DATAFILE=Models\AlienFleshFragment2_d.3d ZEROTEX=1
#exec MESHMAP SCALE MESHMAP=AlienFleshFragment2 X=0.01390625 Y=0.01390625 Z=0.01390625
#exec MESH SEQUENCE MESH=AlienFleshFragment2 SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=AlienFleshFragment2 SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESH IMPORT MESH=AlienFleshFragment3 ANIVFILE=Models\AlienFleshFragment3_a.3d DATAFILE=Models\AlienFleshFragment3_d.3d ZEROTEX=1
#exec MESHMAP SCALE MESHMAP=AlienFleshFragment3 X=0.01390625 Y=0.00390625 Z=0.01390625
#exec MESH SEQUENCE MESH=AlienFleshFragment3 SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=AlienFleshFragment3 SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec MESH IMPORT MESH=AlienFleshFragment4 ANIVFILE=Models\AlienFleshFragment4_a.3d DATAFILE=Models\AlienFleshFragment4_d.3d ZEROTEX=1
#exec MESHMAP SCALE MESHMAP=AlienFleshFragment4 X=0.01390625 Y=0.01390625 Z=0.01390625
#exec MESH SEQUENCE MESH=AlienFleshFragment4 SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=AlienFleshFragment4 SEQ=Still STARTFRAME=0 NUMFRAMES=1

#exec TEXTURE IMPORT NAME=AlienFleshFragmentTex FILE=Textures\AlienFleshFragmentTex.pcx GROUP="Skins"
#exec MESHMAP SETTEXTURE MESHMAP=AlienFleshFragment1 NUM=0 TEXTURE=AlienFleshFragmentTex
#exec MESHMAP SETTEXTURE MESHMAP=AlienFleshFragment2 NUM=0 TEXTURE=AlienFleshFragmentTex
#exec MESHMAP SETTEXTURE MESHMAP=AlienFleshFragment3 NUM=0 TEXTURE=AlienFleshFragmentTex
#exec MESHMAP SETTEXTURE MESHMAP=AlienFleshFragment4 NUM=0 TEXTURE=AlienFleshFragmentTex

defaultproperties
{
}





In the fragment class i added those lines that Morpheus told me to write. It Spawns green blood spurts tath looks great but it doesn't display the fragments

//=============================================================================
// AlienFragment.
//=============================================================================
class AlienFragment Extends DeusExFragment;

auto state Flying
{
function BeginState()
{
Super.BeginState();

Velocity = VRand() * 300;
DrawScale = FRand() + 1.5;
}
}

function Tick(float deltaTime)
{
Super.Tick(deltaTime);

if (!IsInState('Dying'))
if (FRand() < 0.5)
Spawn(class'MyBloodSpurt',,, Location);
}


defaultproperties
{
fragments(o)=lodmesh'AlienFleshFragmet1'
fragments(1)=lodmesh'AlienFleshFragmet2'
fragments(2)=lodmesh'AlienFleshFragmet3'
fragments(3)=lodmesh'AlienFleshFragmet4'
numfragmentTypes=(4)
elasticity=0.400000
ImpactSound=Sound'DeusExSounds.Generic.FleshHit1'
MiscSound=Sound'DeusExSounds.Generic.FleshHit2'
Mesh=LodMesh'AlienFleshFragment1'
CollisionRadius=2.000000
CollisionHeight=2.000000
Mass=5.000000
Buoyancy=5.500000
bVisionImportant=True
}




The pawn explodes to damage the player if he is near. I just deleted the explosion and sound

//=============================================================================
// Drone.
//=============================================================================
class Drone expands Karkian;

// ----------------------------------------------------------------------
// SpawnCarcass()
//
// Blow up instead of spawning a carcass
// ----------------------------------------------------------------------

function Carcass SpawnCarcass()
{
if (bStunned)
return Super.SpawnCarcass();

Explode();

return None;
}

function Explode()
{
local ScorchMark s;
local int i;
local float explosionDamage;
local float explosionRadius;

explosionDamage = 50;
explosionRadius = 256;


// spawn a mark
s = spawn(class'ScorchMark', Base,, Location-vect(0,0,1)*CollisionHeight, Rotation+rot(16384,0,0));
if (s != None)
{
s.DrawScale = FClamp(explosionDamage/30, 0.1, 3.0);
s.ReattachDecal();
}

// spawn some rocks and flesh fragments
for (i=0; i<explosionDamage/6; i++)
{
if (FRand() < 0.3)
spawn(class'Rockchip',,,Location);
else
spawn(class'AlienFragment',,,Location);
}

HurtRadius(explosionDamage, explosionRadius, 'Exploded', explosionDamage*50, Location);
}


defaultproperties
{
Mesh=LodMesh'ModPackage.Xenomorph'
}
Morpheus
X-51
Posts: 967
Joined: Thu Jan 27, 2005 9:56 am
Location: A planet near mars

Re: Need help with custom fragments

Post by Morpheus »

Hmm, have you imported the textures you use on your fragment mesh? You won't see a mesh if the texture isn't there for it...

Or, your drone class is subclassed of Karian, maybe thats the issue, its still seeing the original flesh fragment code and causing a conflict between the flesh fragment and yours? When you subclass something, it still uses the coding of the parent class, changing it in your subclass doesn't always work unless you make a new class and subclass it from the same class of the parent you subclassed from. Ok that sounds complicated, laymans terms:

1) You subclassed Karkian for your Drone. The drone still uses Karkian code as a class always uses its parent code as a base. Trying to replace the code if the Karkian to spawn new flesh fragments in your Drone may not work because the flesh fragments are already coded into the Karkian. Maybe you should try and Subclass your Drone from Animal and copy all the karkian code and change what you want to change in it for your Drone, see if that works?
My nature videos: http://www.youtube.com/user/DynamixWarePro
My whistle/flute videos (and some other videos): http://www.youtube.com/user/DXMorpheus
miguel
UNATCO
Posts: 160
Joined: Tue Oct 12, 2010 10:35 pm
Location: Acheron LV-426 Hadley's Hope

Re: Need help with custom fragments

Post by miguel »

Thanks a lot. The problem was solved.
There was no need to create another sub class, it was just that i was missing something in the code that you posted.
Post Reply