Page 1 of 1

Hat code

PostPosted: Tue Jan 01, 13 7:11 pm
by atrey65789
So I am coding something for a hat.. when you frob the dacoration, you wear it on your head.. however, the code that I developed doesn't work.


[code]function Frob(Actor Frobber, Inventory frobWith)
{

dxp = DeusExPlayer(Frobber);

loc.Z = dxp.collisionHeight+ 4.0; // can adjust its height to any meshes head.
SetLocation(dxp.Location + loc);
SetRotation(dxp.Rotation);
SetCollision(False,false,false);
SetBase(dxp);

}



function tick(float deltatime)
{
super.tick(Deltatime);

if (dxp != None)
{
loc.Z = dxp.collisionHeight+ 4.0; // can adjust its height to any meshes head.
SetLocation(dxp.Location + loc);
SetRotation(dxp.Rotation);
SetCollision(False,false,false);
}
else
{
SetCollision(True,True,True);
SetPhysics(Phys_Falling);
SetBase(None);
}

} [/code]

PostPosted: Wed Jan 02, 13 11:39 pm
by ~DJ~
How about adding..
Code: Select all
Super.Frob(Frobber, frobWith);

at the end of the Frob() function?

EDIT: or maybe.. this..
Code: Select all
function Frob(Actor Frobber, Inventory frobWith)
{
dxp = DeusExPlayer(Frobber);

   if(dxp!=None)
   {
      loc.Z = dxp.collisionHeight+ 4.0; // can adjust its height to any meshes head.
      SetLocation(dxp.Location + loc);
      SetRotation(dxp.Rotation);
      SetCollision(False,false,false);
      SetBase(dxp);
   }
Super.Frob(Frobber, frobWith);
}

PostPosted: Thu Jan 03, 13 12:43 am
by atrey65789
Have already... doesn't seem to be working... hmm... strange.

PostPosted: Thu Jan 03, 13 1:47 am
by ~DJ~
err.. maybe this? XD
Code: Select all
function Frob(Actor Frobber, Inventory frobWith)
{
   if(DeusExPlayer(Frobber)!=None)
   {
      loc.Z = DeusExPlayer(Frobber).collisionHeight+ 4.0; // can adjust its height to any meshes head.
      SetLocation(DeusExPlayer(Frobber).Location + loc);
      SetRotation(DeusExPlayer(Frobber).Rotation);
      SetCollision(False,false,false);
      SetBase(DeusExPlayer(Frobber));
   }
Super.Frob(Frobber, frobWith);
}

PostPosted: Thu Jan 03, 13 2:23 am
by atrey65789
HAHA I will give it a try

PostPosted: Thu Jan 03, 13 3:40 am
by Poor
Look at PutCarriedDecorationInHand() in DeusExPlayer. It doesn't need to be updated in Tick.

PostPosted: Thu Jan 03, 13 3:47 am
by atrey65789
Ok will do

PostPosted: Thu Jan 03, 13 4:47 am
by ~DJ~
Oh, and perhaps try doing that too.
Code: Select all
function Frob(Actor Frobber, Inventory frobWith)
{
   if(DeusExPlayer(Frobber)!=None)
   {
      loc.Z = DeusExPlayer(Frobber).collisionHeight+ 4.0; // can adjust its height to any meshes head.
      SetOwner(DeusExPlayer(Frobber));
      SetLocation(DeusExPlayer(Frobber).Location + loc);
      SetRotation(DeusExPlayer(Frobber).Rotation);
      SetCollision(False,false,false);
      SetBase(DeusExPlayer(Frobber));
      SetPhysics(PHYS_Trailer);
   }
Super.Frob(Frobber, frobWith);
}

(untested)

I don't know why I was telling you to call the Super anyway.. like that would do any good, but oh well..
alternatively you can look into Deadalus08's Parachute mod, it attaches the chute' in your back.. just some adjustments and volla..
I'd give you my code for the Reinmutt I created.. (attached Horns to the Mutt) but I currently don't have it and besides it was very buggy.. so yeah.. good luck! :oops:

PostPosted: Sat Jan 05, 13 2:09 am
by atrey65789
Hahaha I will try this.