Data Realms Fan Forums
http://45.55.195.193/

Custom Pie Menu Options
http://45.55.195.193/viewtopic.php?f=73&t=45283
Page 1 of 1

Author:  Izak12 [ Sun May 12, 2013 4:04 pm ]
Post subject:  Custom Pie Menu Options

I need create custom pie menus via lua,

can someone show me an example for pie menus that launch abilities (like weapons or enhanced movement, etc)

Author:  Bad Boy [ Sun May 12, 2013 10:16 pm ]
Post subject:  Re: Custom Pie Menu Options

It's really simple. Just look at the coalition grenade launcher or one of the many other things that uses pie buttons and follow along.
That said, here's a brief runthrough:

To the ini, add (with correct tabbing):
Code:
   AddPieSlice = Slice
      Description = *Name of Pie Slice*
      Direction = 1
      Icon = Icon
         PresetName = *Name of Pie Slice Icon (probably unimportant)*
         FrameCount = *# Of Frames*
         BitmapFile = ContentFile
            FilePath = *Filepath here*
      ScriptPath = *Scriptpath here*
      FunctionName = *Name_of_Lua_Function_to_Call*


And then you make a lua script with the specified filepath and do things from there. Generally people use the pie button to change the sharpness and have a main script on whatever's being affected that does different things based on sharpness. E.g. for a button that'll toggle back and forth between two modes:
Code:
function Name_of_Lua_Function_to_Call(self)
   if self.Sharpness == 0 then
      self.Sharpness = 1;
   elseif self.Sharpness == 1 then
      self.Sparness = 0;
   end
end
--The main script for the object is below
function Create(self)
...
end
function Update(self)
   if self.Sharpness == 0 then
      ...
   elseif self.Sharpness == 1 then
      ...
   end
end

Author:  Izak12 [ Mon May 13, 2013 5:56 am ]
Post subject:  Re: Custom Pie Menu Options

how do I create a second type of consumable somethingBar
i need my function, that when the sharpness is set to X, the ability is activated as long as there are a value in the somethingBar. The something bar will be used or decrease by X amount from the over all Y value every somethingsomething miliseconds, so im trying to make it so multiple pie menus will launch different abilities each taking from this over all somethingBar and that whenever this bar reaches empty value all abilities toggle off regardless. The bar should slowly recharge over time too.

If possible Id like it to work with pie menus but im not against using items that require this bar to have energy too or hidden button commands so I dont overload the actor with pie menu slices.

also misc question, how do I create a script that changes the jump script/jetpack script of the actor and switches back when its toggled off?

Author:  Bad Boy [ Mon May 13, 2013 2:21 pm ]
Post subject:  Re: Custom Pie Menu Options

A bar is really just a number with a nice graphical representation. For how to implement the bar, take a look at a mod that uses one (e.g UNSC shields or flamethrower) and work off of that, since I can't remember the exact code. It's pretty straightforward though.

Outside of that, the rest is trivial. Using the pie buttons to change sharpness it would be something like (I'll also include a cheap and easy way of increasing jump height):
Code:
function Create(self)
   self.Energy = 100;
end
function Update(self)
   --Make bar particle and change its frame based on energy. Find examples of this.
   if self.Energy > 0 then
      if self.Sharpness == 1 then
         ...
         self.Energy = self.Energy - #;
      elseif self.Sharpness == 2 then
         --Eg. for more jumping. I assume this is running from an actor, otherwise you'll have to find the parent first.
         if self:GetController():IsState(Controller.BODY_JUMPSTART, true) then
            self.Vel.Y = self.Vel.Y - #;
            --Can also be done by adding forces. Check the wiki for the specific function names.
            self.Energy = self.Energy - #;
         end
      end --Or other sharpness checks and actions
   end
end

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