Page 1 of 1

[Solved @ Mr. X] Need a hand with UScript

PostPosted: Mon Sep 12, 05 6:17 pm
by Magus
Since this is a modding forum, I better ask for a bit of help :P

I want to make a switch. Not just an ordinary switch, though. I want this switch to check the player's inventory for a certain item. And I only want it to work when it finds that item.

So, could anyone here possibly write such a piece of code for me?

PostPosted: Mon Sep 12, 05 6:41 pm
by Gishank
err well u could ask Sondor(AW)L)

PostPosted: Mon Sep 12, 05 7:41 pm
by Alex
Code: Select all
//=============================================================================
// Switch1.
//=============================================================================
class Switch1 extends DeusExDecoration;

var bool bOn;

function Frob(Actor Frobber, Inventory frobWith)
{
      local Inventory Inv;
      local DeusExPlayer Player;
      Player = DeusExPlayer(Frobber);
            foreach AllActors(class'Inventory', Inv)
            {
                  if (Inv.Owner == Player){
                  if (Inv.IsA('ItemClassHere')) {
   Super.Frob(Frobber, frobWith);
}
}
}

   if (bOn)
   {
      PlaySound(sound'Switch4ClickOff');
      PlayAnim('Off');
   }
   else
   {
      PlaySound(sound'Switch4ClickOn');
      PlayAnim('On');
   }

   bOn = !bOn;
}

defaultproperties
{
     bInvincible=True
     ItemName="Switch"
     bPushable=False
     Physics=PHYS_None
     Mesh=LodMesh'DeusExDeco.Switch1'
     CollisionRadius=2.630000
     CollisionHeight=2.970000
     Mass=10.000000
     Buoyancy=12.000000
}


Don't know if its 100% correctly.

PostPosted: Wed Sep 14, 05 6:43 pm
by Magus
Thanks man, I'll give it a test.

PostPosted: Wed Sep 14, 05 6:52 pm
by Dae
*shakes Alex's hand*

PostPosted: Wed Sep 14, 05 7:13 pm
by Alex
=)

PostPosted: Wed Sep 14, 05 8:03 pm
by Magus
I would frown at you, Mr. X, but that piece of code works like a charm, so I'm not going to :)

PostPosted: Wed Sep 14, 05 8:39 pm
by clyzm
Magu[Z] wrote:I would frown at you, Mr. X, but that piece of code works like a charm, so I'm not going to :)


Dude.

Double posting is allowed for admins. IIRC.

So stfu with frowns. And since you got your code, locked :]