Search

Search found 13 matches

by super_g
21 Mar 2012, 01:27
Forum: Engine
Topic: Loading a Widget from a different Widget or Gadget
Replies: 4
Views: 983

Re: Loading a Widget from a different Widget or Gadget

I found an easy was to enable or disable widgets using the following Spring Commands:

Spring.SendCommands({"luaui enablewidget <widgetName>"})
Spring.SendCommands({"luaui disablewidget <widgetName>"})
by super_g
19 Mar 2012, 04:23
Forum: AI
Topic: How to use the GiveOrderToUnit with the CMD.STOP
Replies: 0
Views: 1134

How to use the GiveOrderToUnit with the CMD.STOP

I am trying to get a unit to stop. I can get the unit to move, attack and other commands using the GiveOrderToUnit function. When I try: Spring.GiveOrderToUnit(currentUnitID, CMD.STOP,{},{}) I get the following error message: Unsafe attempt to change game state If anyone knows why the stop command w...
by super_g
19 Mar 2012, 04:15
Forum: Engine
Topic: Loading a Widget from a different Widget or Gadget
Replies: 4
Views: 983

Loading a Widget from a different Widget or Gadget

Is there a Spring command that will load/initialize a widget?

I am looking for the something like the widgetHandler:RemoveWidget(), but with the flexibility to add and initialize any widget (by name or id), once a gadget detects a specific event.

Thanks
by super_g
12 Feb 2012, 03:51
Forum: Lua Scripts
Topic: Gadget Unsynced functions
Replies: 4
Views: 797

Gadget Unsynced functions

my gadget unsyced code does not seem to run at all. I have tried many different functions in the unsynced portion, such as: function gadget:Update() function gadget:Initialize() I can not even get the below posted example to run the unsynced portion. if (gadgetHandler:IsSyncedCode()) then --SYNCED C...
by super_g
10 Feb 2012, 23:25
Forum: Lua Scripts
Topic: Call a function from a Widget in a Gadget
Replies: 2
Views: 982

Re: Call a function from a Widget in a Gadget

That worked perfectly! Right now to pass information from the Widget to the Gadget I am using messages. I feel that this is not the best way to do this. Can you register any function form anywhere as global? I am considering moving more of the functionality into gadgets, where possible. With respect...
by super_g
10 Feb 2012, 22:22
Forum: Lua Scripts
Topic: Call a function from a Widget in a Gadget
Replies: 2
Views: 982

Call a function from a Widget in a Gadget

I have a Gadget doing some calculations and I want to call a function that is contained in a Widget. The Gadget has both syced and unsyced components. How can I do this?
by super_g
10 Feb 2012, 14:52
Forum: Lua Scripts
Topic: Change a unit's attributes during game
Replies: 13
Views: 3199

Re: Change a unit's attributes during game

No, it is a ground unit as far as I know. The unit walks along the ground anyway.
by super_g
10 Feb 2012, 05:53
Forum: Lua Scripts
Topic: Change a unit's attributes during game
Replies: 13
Views: 3199

Re: Change a unit's attributes during game

Thank you for your help. I am getting a "[string "LuaRules/Gadgets/modifyunitattributes.lua"]:107: Unit does not have a compatible MoveType" error in the gadget when I try to call: Spring.MoveCtrl.SetGroundMoveTypeData(id, "maxSpeed", 0.01) Is moveType need to be declar...
by super_g
09 Feb 2012, 22:09
Forum: Lua Scripts
Topic: Change a unit's attributes during game
Replies: 13
Views: 3199

Re: Change a unit's attributes during game

Is there a way to make a gadget that modifies unit's attributes and then call the function from a widget? I have been trying to call a function from a gadget using the following include in my widget. VFS.Include("LuaRules\Gadgets\modifyUnitAttributes.lua",nil) I have tried a couple variant...
by super_g
08 Feb 2012, 21:38
Forum: Lua Scripts
Topic: Change a unit's attributes during game
Replies: 13
Views: 3199

Re: Change a unit's attributes during game

This is exactly what I need. I tried the following just to test it. I can get the movement values, but an error occurs when the set is called. The error states "attempted to index field 'MoveCtrl' (a nil value)" for id,unitDef in ipairs(Spring.GetSelectedUnits()) do local mt = Spring.GetUn...
by super_g
08 Feb 2012, 20:16
Forum: Lua Scripts
Topic: Change a unit's attributes during game
Replies: 13
Views: 3199

Change a unit's attributes during game

Is there any way to change a unit's canMove attribute while the game is running? I can get the value of a unit's canMove through the unitDef, but I can not seem to be able to set it to a new value. local movement = UnitDefs[unitID]["canMove"] I am looking for a way to toggle a unit's abili...
by super_g
16 Jan 2012, 16:29
Forum: Lua Scripts
Topic: User Interface - Display unit portrait using a custom camera
Replies: 14
Views: 2135

Re: User Interface - Display unit portrait using a custom camera

I am attempting to display a portrait of the currently selected units in a widget. I would to use a camera in front of the selected unit and display the resulting image from the camera on the user interface. This would allow me to reuse passive animations and not have to create portrait images. If ...
by super_g
12 Jan 2012, 04:20
Forum: Lua Scripts
Topic: User Interface - Display unit portrait using a custom camera
Replies: 14
Views: 2135

User Interface - Display unit portrait using a custom camera

I am attempting to display a portrait of the currently selected units in a widget. I would to use a camera in front of the selected unit and display the resulting image from the camera on the user interface. This would allow me to reuse passive animations and not have to create portrait images. If a...

Go to advanced search