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



Reply to topic  [ 3 posts ] 
 Quick lua question. 
Author Message
User avatar

Joined: Sun Sep 17, 2017 11:17 pm
Posts: 35
Reply with quote
Post Quick lua question.
Is it possible to add a pie menu option that adds a specific weapon to the actor's inventory when pressed, I've been trying to do this for a little while with no success.

Thanks in advance.


Wed Nov 15, 2017 5:59 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Quick lua question.
This is possible, yes.

Coalition.rte/Actors/Blast Runner/

has an example of a pie menu button on an actor. You can edit the BlastRunner.ini to make the actor usable in-game by changing Buyable = 0 to 1, if you want to play around with it.

The code that adds the pie menu button to the actor -

Code:
   AddPieSlice = Slice
      Description = Detonate
      Direction = 2
      Icon = Icon
         PresetName = Blast Runner Detonate
         FrameCount = 2
         BitmapFile = ContentFile
            FilePath = Coalition.rte/Devices/Sprites/PieIcons/IconDetonate.bmp
      ScriptPath = Coalition.rte/Actors/Blast Runner/BlastRunnerPie.lua
      FunctionName = BlastRunnerDetonateCall


If you want to add an item to an actor's inventory, have something like this in your lua script:

Code:
      local item = CreateHDFirearm("Heavy Digger");
      actor:AddInventoryItem(item);


Thu Nov 16, 2017 1:35 am
Profile
User avatar

Joined: Sun Sep 17, 2017 11:17 pm
Posts: 35
Reply with quote
Post Re: Quick lua question.
Wow, thanks. That helped a ton! Also just introduced me to these adorable little suicide bots, I love them!


Thu Nov 16, 2017 2:18 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.051s | 15 Queries | GZIP : Off ]