Loading...
  OR  Zero-K Name:    Password:   

Post edit history

Need some LUA Widget scripting help

To display differences between versions, select one or more edits in the list using checkboxes and click "diff selected"
Post edit history
Date Editor Before After
1/15/2019 9:11:38 PMPLrankZenfur before revert after revert
1/15/2019 9:06:55 PMPLrankZenfur before revert after revert
Before After
1 Being more specific about your points: 1 Being more specific about your points:
2 \n 2 \n
3 1. To get anything to do whatever you want you need to get to run your code at some point. For that you need to use some [url=https://springrts.com/wiki/Lua:Callins]callin[/url]. In your case it probably would be game state to run every frame - probably does not need to run that often so check if the number_of_frame modulo 5 = 0 to do it every 5th frame. 3 1. To get anything to do whatever you want you need to get to run your code at some point. For that you need to use some [url=https://springrts.com/wiki/Lua:Callins]callin[/url]. In your case it probably would be game state to run every frame - probably does not need to run that often so check if the number_of_frame modulo 5 = 0 to do it every 5th frame.
4 \n 4 \n
5 To find any newton at all you'd want to use unit created and unit destroyed callins and check if the unit that was created was a newton - then save it on some list of units that your main loop updates. 5 To find any newton at all you'd want to use unit created and unit destroyed callins and check if the unit that was created was a newton - then save it on some list of units that your main loop updates.
6 \n 6 \n
7 2. When game gets to run your code you can for example [url=https://springrts. com/wiki/Lua_UnsyncedRead]look for enemy units in some radius[/url] 7 2. When game gets to run your code you can for example [url=https://springrts. com/wiki/Lua_SyncedRead#GetUnits]look for enemy units in some radius[/url]. Synced commands are reserved for Gadgets ( widgets with more privileges) - but many of them work on widget side with filtered/altered results. Like you will get only the units you can detect. Unsynced reads [url=https://springrts. com/wiki/Lua_UnsyncedRead]can be found here[/url].
8 3. With that call of get units you get list of unit ids that can be used. With that ID you can ask anything about the unit as long as it is in line of sight (Radar dots have different unit IDs I guess, not sure.) - [url=https://springrts.com/wiki/Lua_UnitDefs]including it's name and weight[/url]. 8 3. With that call of get units you get list of unit ids that can be used. With that ID you can ask anything about the unit as long as it is in line of sight (Radar dots have different unit IDs I guess, not sure.) - [url=https://springrts.com/wiki/Lua_UnitDefs]including it's name and weight[/url].
9 4. You probably also want to control the unit also known as sending [url=https://springrts.com/wiki/Lua_CMDs]commands[/url] to a unit. I believe the code for toggling pull and push would be "ONOFF 85" command. 9 4. You probably also want to control the unit also known as sending [url=https://springrts.com/wiki/Lua_CMDs]commands[/url] to a unit. I believe the code for toggling pull and push would be "ONOFF 85" command.