View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0002503 | Spring engine | Unit Scripting | public | 2011-06-29 17:55 | 2011-11-26 16:09 | ||||
Reporter | user744 | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Product Version | 0.82.7+git | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0002503: (master) unit scripts does not work on startunits, works on units created later | ||||||||
Description | game: spring tanks RC5.2 map: any of those: http://springrts.com/wiki/Spring_Tanks#The_Maps If you start via spring.exe or the SP menu, you will notice no units scripts seem to be loaded. units do not turn their wheels, aim or fire. if you do /cheat /give tptaktak then this unit will work. If you selfdestruct a unit and wait for a replacement to spawn, this unit will also work. after /luar rules reload, all units will work. The start units are created in gadgets\tp_startbase_spawn.lua Now thinking about it, it might be because I create the units on function gadget:Initialize() instead of function gadget:GameStart() ? I do this so that you can already see the units even if the game is not yet started. (ie other players are still loading) That works in current. | ||||||||
Additional Information | infolog http://pastebin.com/DYRFV7Pf http://www.abload.de/img/unitscriptauxh.jpg 1+2 units created by gadgets\tp_startbase_spawn.lua - do not work (notice the extra parts on the "ice cone" thing are not hidden and the tank has no tracks) 3+4 the same unit types created with /cheat /give - works 5 unit spawned by tp_gamelogic.lua after game was running for some time - works | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
||||||
|
![]() |
|
2011-06-30 02:16 |
can somebody please change the title to say master or 0.83? Tested a bit and it seems that using UnitCreate in function gadget:Initialize() indeed results in a unit without working unit script. |
Kloot (developer) 2011-06-30 13:10 Last edited: 2011-06-30 13:13 |
The Lua unit-script gadgets are themselves loaded from unit_script.lua::gadget:Initialize, which possibly runs BEFORE your spawn-gadget's Initialize ==> your units won't work because they do not exist yet at that point. [f=0000000] Loading gadget: Lua unit script framework <unit_script.lua> ... [f=0000000] Loading unit script: scripts/tplegocar.lua ... [f=0000000] Loaded gadget: Lua unit script framework <unit_script.lua> [f=0000000] Loaded gadget: Spring Tanks | Start Point Remover Gadget <init_start_point_remover_gadget.lua> [f=0000000] Loaded gadget: base spawner <tp_startbase_spawn.lua> |
2011-07-01 01:55 |
in my spawn gadget i changed layer = 0, to layer = 9000, which fixed it. |
FLOZi (reporter) 2011-07-01 18:21 |
Unit script gadget is also layer 0 (they are loaded alphabetically within layers) so layer 1 is sufficient ;) |
Kloot (developer) 2011-07-01 22:03 |
goodgood |
2011-07-02 05:57 |
the example gadget https://github.com/spring/spring/blob/master/cont/base/springcontent/LuaGadgets/Gadgets/game_spawn.lua is layer=0, too. It probally still works because it uses function gadget:GameStart() but maybe it should still be changed to something "higher" that unit_script, ie layer=1 |
Kloot (developer) 2011-11-26 16:09 |
as before: change the layer in which your gadget(s) live(s) to a number > 0, there is not much else we can do |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2011-06-29 17:55 |
|
New Issue | |
2011-06-29 17:55 |
|
Graphics Card | => unknown |
2011-06-30 02:16 |
|
Note Added: 0006830 | |
2011-06-30 02:21 | abma | Summary | unit scripts does not work on startunits, works on units created later => (master) unit scripts does not work on startunits, works on units created later |
2011-06-30 13:10 | Kloot | Note Added: 0006831 | |
2011-06-30 13:11 | Kloot | Note Edited: 0006831 | |
2011-06-30 13:13 | Kloot | Note Edited: 0006831 | |
2011-07-01 01:55 |
|
Note Added: 0006835 | |
2011-07-01 18:21 | FLOZi | Note Added: 0006838 | |
2011-07-01 22:03 | Kloot | Note Added: 0006840 | |
2011-07-01 22:03 | Kloot | Status | new => resolved |
2011-07-01 22:03 | Kloot | Resolution | open => no change required |
2011-07-01 22:03 | Kloot | Assigned To | => Kloot |
2011-07-02 05:57 |
|
Note Added: 0006845 | |
2011-07-02 05:57 |
|
Status | resolved => assigned |
2011-07-02 05:57 |
|
Resolution | no change required => reopened |
2011-11-25 17:38 | abma | Relationship added | related to 0002769 |
2011-11-26 16:09 | Kloot | Note Added: 0007713 | |
2011-11-26 16:09 | Kloot | Status | assigned => closed |
2011-11-26 16:09 | Kloot | Resolution | reopened => no change required |