Data Realms Fan Forums
http://45.55.195.193/

How would I use key commands? Stopping an actor gibbing.
http://45.55.195.193/viewtopic.php?f=73&t=20462
Page 1 of 2

Author:  Dylanhutch [ Tue Dec 07, 2010 1:15 pm ]
Post subject:  How would I use key commands? Stopping an actor gibbing.

I want to make a script that makes the actor have AngularVel 5. How would I make a key press cause a Lua command?
And what was the pastebin thing, with all the key presses in numeric form?

I want the key to be 'Left Control'


Thanks in advance!

Author:  trystanr [ Tue Dec 07, 2010 1:30 pm ]
Post subject:  Re: How would I use key commands?

.

Author:  Lizardheim [ Tue Dec 07, 2010 1:33 pm ]
Post subject:  Re: How would I use key commands?

If you don't KNOW the stuff, simply don't even try to answer.
Code:
   A - 1      S - 19      Numpad 0 - 37      ins  - 76
   B - 2      T - 20      Numpad 1 - 38      del  - 77
   C - 3      U - 21      Numpad 2 - 39      home - 78
   D - 4      V - 22      Numpad 3 - 40      end  - 79
   E - 5      W - 23      Numpad 4 - 41      page up - 80
   F - 6      X - 24      Numpad 5 - 42      page down - 81
   G - 7      Y - 25      Numpad 6 - 43      left arrow - 82
   H - 8      Z - 26      Numpad 7 - 44      right arrow - 83
   I - 9      0 - 27      Numpad 8 - 45      up arrow - 84
   J - 10      1 - 28      Numpad 9 - 46      down arrow - 85
   K - 11      2 - 29      - - 61         numpad / - 86
   L - 12      3 - 30      = - 62         numpad * - 87
   M - 13      4 - 31      { - 65         numpad - - 88
   N - 14      5 - 32      } - 66         numpad + - 89
   O - 15      6 - 33      " - 69         numpad . - 90
   P - 16      7 - 34      \ - 70         ;  - 105
   Q - 17      8 - 35      , - 72
   R - 18      9 - 36      . - 73

Courtesy of Darlos.
And yeah, I know left control isn't there.

Author:  Dylanhutch [ Tue Dec 07, 2010 1:37 pm ]
Post subject:  Re: How would I use key commands?

Thanks lizard, Though I still don't know how to trigger it with the key values.

Author:  Lizardheim [ Tue Dec 07, 2010 1:39 pm ]
Post subject:  Re: How would I use key commands?

UInputMan:KeyHeld(#)

Author:  Dylanhutch [ Tue Dec 07, 2010 1:43 pm ]
Post subject:  Re: How would I use key commands?

Thanks a lot Lizard!


....



Ran into a bit of a problem, I need his health to stay the same and disallow gibbing.
probably impossible to do though.


EDIT

I guess you could make the GibImpulselimit Reeeeaaaally high then change it back later.

Author:  Roast Veg [ Tue Dec 07, 2010 5:48 pm ]
Post subject:  Re: How would I use key commands?

Untrue.
Code:
if self.ToDelete == true then
   local respawn = CreateAHuman(self.PresetName)
   respawn.Pos = self.Pos
   respawn.Vel = self.Vel
   respawn.RotAngle = self.RotAngle
   MovableMan:AddParticle(respawn)
end

Author:  Dylanhutch [ Wed Dec 08, 2010 1:38 am ]
Post subject:  Re: How would I use key commands?

It's if it gibs though, so that would only work if something killed it by deleting said actor.

Author:  Roast Veg [ Wed Dec 08, 2010 6:36 pm ]
Post subject:  Re: How would I use key commands?

No it counts gibbing, too.

As far as I'm aware, it covers all kinds of death.

Author:  Dylanhutch [ Thu Dec 09, 2010 12:57 am ]
Post subject:  Re: How would I use key commands?

Oh, didn't work here.

What about:
Code:
function Destroy(self)
if UInputMan:KeyHeld(6) then
local respawn = CreateAHuman(self.PresetName)
respawn.Pos = self.Pos
MovableMan:AddParticle(respawn)
end
end


It Worked!

All I need now is a snippet to change the actor's team!......



I still think it would be a lot cleaner to just change the GibImpuseLimit

Code:
function Uptate(self)
if UInputMan:KeyPressed(6) then
   self.AngularVel = -8
   self.GibImpulseLimit = 18000
   end
else
   GibImpulseLimit = 2000
   end
   
   


Anything wrong here?

Author:  Lizardheim [ Thu Dec 09, 2010 9:35 am ]
Post subject:  Re: How would I use key commands?

You specify the team when you spawn the actor.

Author:  Dylanhutch [ Thu Dec 09, 2010 12:40 pm ]
Post subject:  Re: How would I use key commands?

I would much rather set the gib impulse, I tried but failed. Here's the code:

Code:
   if UInputMan:KeyHeld(6) then
   self.AngularVel = -8
   self.GibImpulseLimit = 18000
   end
   if UInputMan:KeyReleased(6) then
   self.GibImpulseLimit = 3000
   end
   if UInputMan:KeyHeld(18) then
   self.AngularVel = 8
   self.GibImpulseLimit = 18000
   end
   if UInputMan:KeyReleased(18) then
   self.GibImpulseLimit = 3000
end

Author:  Roast Veg [ Thu Dec 09, 2010 5:51 pm ]
Post subject:  Re: How would I use key commands?

You can't set GibImpulse in Lua.

Author:  Dylanhutch [ Fri Dec 10, 2010 12:43 am ]
Post subject:  Re: How would I use key commands?

Oh, crap.

Is there any other way to make it not gib? At all?


AHAH!!!!!!!!!

I HAVE IT!!!!
It is my ♥♥♥♥♥ now, yeah!!!! WOOO!!!!!

Actor switch!
Code:
function Update(self)
   if UInputMan:KeyHeld(6) then
   self.AngularVel = -8
   ToDelete = true
   local respawn = CreateAHuman(Parkour Runner2)
   MovableMan:AddParticle(respawn)
   end
end


Yes, I am making a parkour mod
I stopped working on it but in the last week I have started again.

Author:  Roast Veg [ Fri Dec 10, 2010 5:43 pm ]
Post subject:  Re: How would I use key commands? Stopping an actor gibbing.

Oh good, I kinda liked that.

Page 1 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/