ULX

Author Topic: Random gravity?  (Read 8779 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Random gravity?
« Reply #15 on: December 13, 2011, 08:42:28 PM »
Not sure if it was requested, but don't forget physics props... I personally don't see the point in having gravity shut off for players but having all props still effected by it..

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Random gravity?
« Reply #16 on: December 14, 2011, 05:52:07 AM »
I'll see what I can whip up for that then.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: Random gravity?
« Reply #17 on: December 14, 2011, 10:03:27 AM »
This is gonna be fun!
Thanks Aaron113 (and JamminR for your code verification stuffs)  ;D
My TTT server. Join the fun!

Offline sweetone

  • Jr. Member
  • **
  • Posts: 63
  • Karma: 2
Re: Random gravity?
« Reply #18 on: December 19, 2011, 08:09:42 PM »
Not sure if it was requested, but don't forget physics props... I personally don't see the point in having gravity shut off for players but having all props still effected by it..

:) yea it was requested!

Offline sweetone

  • Jr. Member
  • **
  • Posts: 63
  • Karma: 2
Re: Random gravity?
« Reply #19 on: December 23, 2011, 07:29:33 AM »
Sorry for double post but how is the progress? :)

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Random gravity?
« Reply #20 on: December 23, 2011, 09:31:06 AM »
I've been busy.  I'll try and fit some time in for it today or after Christmas.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: Random gravity?
« Reply #21 on: December 23, 2011, 09:34:09 AM »
That Christmas is getting all of us!
Such a busy time of year.
My TTT server. Join the fun!

Offline sweetone

  • Jr. Member
  • **
  • Posts: 63
  • Karma: 2
Re: Random gravity?
« Reply #22 on: January 05, 2012, 04:51:59 PM »
It isn't done, but is this something like what you guys had in mind?
Code: [Select]
------------------------------ Grav ------------------------------
function ulx.grav( calling_ply, gravity, seconds )
for k,v in pairs( player.GetAll() ) do
v:SetGravity( gravity )
end
timer.Simple( seconds, function()
for k,v in pairs( player.GetAll() ) do
v:SetGravity( 1 )
end
end )
ulx.fancyLogAdmin( calling_ply, "#A set gravity to #i for #i seconds", gravity, seconds )
end
local grav = ulx.command( CATEGORY_NAME, "ulx grav", ulx.grav, "!grav" )
grav:addParam{ type=ULib.cmds.NumArg }
grav:addParam{ type=ULib.cmds.NumArg }
grav:defaultAccess( ULib.ACCESS_ADMIN )
grav:help( "Randomizes gravity for everyone." )

hehe tryed it and yea it don't work yet. :) can't wait the final version of it.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Random gravity?
« Reply #23 on: January 05, 2012, 04:57:48 PM »
Ehh, I do not know of any way to set prop's gravity other then applying force to it or something in that area.  So if I finish this, it'll most likely just include player's gravity.

Offline sweetone

  • Jr. Member
  • **
  • Posts: 63
  • Karma: 2
Re: Random gravity?
« Reply #24 on: January 05, 2012, 06:00:24 PM »
Ehh, I do not know of any way to set prop's gravity other then applying force to it or something in that area.  So if I finish this, it'll most likely just include player's gravity.

:) can't you check how wire field generator - gravity works then? use same idea?

Code: [Select]
function ENT:Toogle_Prop_Gravity( prop , yes_no )

if ( !prop:IsValid() ) then return end

if ( self.ignore[ prop:EntIndex() ] == prop ) then return false; end

if ( !self:is_true(self.workonplayers) && prop:GetClass() == "player" ) then
return false;
end

if prop:GetMoveType() == MOVETYPE_NONE then return false; end
if prop:GetMoveType() == MOVETYPE_NOCLIP then return false; end //do this to prevent -uncliping-

if prop:GetClass() != "player" && !gamemode.Call("PhysgunPickup",self.pl,prop) then return false; end

if prop:GetMoveType() != MOVETYPE_VPHYSICS then
if yes_no == false then

if prop:IsNPC() || prop:IsPlayer() then
prop:SetMoveType(MOVETYPE_FLY);
prop:SetMoveCollide(MOVECOLLIDE_FLY_BOUNCE);
else
prop:SetGravity(0);
end

else

if prop:IsPlayer() then
prop:SetMoveType(MOVETYPE_WALK);
prop:SetMoveCollide(MOVECOLLIDE_DEFAULT);
elseif prop:IsNPC() then
prop:SetMoveType(MOVETYPE_STEP);
prop:SetMoveCollide(MOVECOLLIDE_DEFAULT);
else
prop:SetGravity(1);
end

end
end
« Last Edit: January 05, 2012, 06:04:35 PM by sweetone »

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Random gravity?
« Reply #25 on: January 05, 2012, 07:35:12 PM »
Ahh, thanks.  I'll see what I can do with that.

Offline sweetone

  • Jr. Member
  • **
  • Posts: 63
  • Karma: 2
Re: Random gravity?
« Reply #26 on: February 12, 2012, 07:48:13 AM »
:> what is the status of this?