View unanswered posts | View active topics It is currently Wed Dec 25, 2024 5:34 pm



Reply to topic  [ 4 posts ] 
 Custom Pie Menu Options 
Author Message

Joined: Fri Dec 14, 2012 5:44 am
Posts: 201
Reply with quote
Post 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)


Sun May 12, 2013 4:04 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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


Sun May 12, 2013 10:16 pm
Profile

Joined: Fri Dec 14, 2012 5:44 am
Posts: 201
Reply with quote
Post 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?


Mon May 13, 2013 5:56 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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


Mon May 13, 2013 2:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.045s | 13 Queries | GZIP : Off ]