When I played Spring1944, I found it ridiculous that I have to move the towed guns and catch the right moment to set their direction. I tried to write a widget that makes it easier, but didn't find any way to turn the unit.
Sorry, if I am wrong about that, I asked also on #lua in the lobby, and got the answer that I cannot turn my units in unsynced code.
And this is my first post.
Turn unit command for lua
Moderator: Moderators
Re: Turn unit command for lua
They're right, it's difficult, if not impossible, to do it with a Widget. You'd need to write a Gadget for this (and submit it to the S'44 guys, or make a mutator), Widgets aren't allowed to do things like that. See http://spring.clan-sy.com/wiki/Lua_MoveCtrl for details about how to go about that.
-
- Posts: 7
- Joined: 28 Feb 2009, 01:49
Re: Turn unit command for lua
Thank you Argh. It would have been my second widget, and gadgets and mutators are too scary for me yet.
Why I think a turn command would be appropriate:
We can give any order to our units in widgets: attack, move etc. and I thought that turning our units suits well into this list.(CMD.TURN) And something that makes it easier to set the direction of towed guns belongs to UI, what should be made by widgets. I understand if there are more important things, just wanted to point this out and show, that it may be useful, and seems more logical to give turn as an order to units. As it can be done in present lua, a turn order is even less important.
Why I think a turn command would be appropriate:
We can give any order to our units in widgets: attack, move etc. and I thought that turning our units suits well into this list.(CMD.TURN) And something that makes it easier to set the direction of towed guns belongs to UI, what should be made by widgets. I understand if there are more important things, just wanted to point this out and show, that it may be useful, and seems more logical to give turn as an order to units. As it can be done in present lua, a turn order is even less important.
Re: Turn unit command for lua
While there's no way to take control of the physics of the unit and make it move in unsynced code, I'm sure a widget could give the gun/whatever such an order that it ends up facing that direction.
Basically something that took an order and compared it to the current unit heading, issued a move order right next to the unit until the new heading was the center of the firearc, and then gave it a stop command - that should be widget-able.
For what its worth, if you write a reliable widget for easily giving turn commands, I will totally stick it in the next S44 release.
Basically something that took an order and compared it to the current unit heading, issued a move order right next to the unit until the new heading was the center of the firearc, and then gave it a stop command - that should be widget-able.
For what its worth, if you write a reliable widget for easily giving turn commands, I will totally stick it in the next S44 release.
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Turn unit command for lua
Welcome to the forums!
If nobody gets to it by then, I'll try my hand at writing a widget to do this (then move on to more drastic means if this proves infeasible). Unfortunately several real life issues are conspiring to keep me from this--expect nothing before March 20th at the very earliest.
If nobody gets to it by then, I'll try my hand at writing a widget to do this (then move on to more drastic means if this proves infeasible). Unfortunately several real life issues are conspiring to keep me from this--expect nothing before March 20th at the very earliest.
Re: Turn unit command for lua
if we can get turn rate and current direction
give it a move command toward direction
then stop the command with some math like waiting this long:
frames_to_wait = abs(current_direction - final_direction) / turn_rate
or something like that.
give it a move command toward direction
then stop the command with some math like waiting this long:
frames_to_wait = abs(current_direction - final_direction) / turn_rate
or something like that.
Re: Turn unit command for lua
I think a lua->cob call and then some set HEADING; in the unit script might work better (of course unit scripts will have to be adjusted to support this). Spring pathfinder is known for producing strange paths sometimes, I'm not sure giving a very close move order will always result in the unit just turning there and not wandering in some random direction.
Re: Turn unit command for lua
well, the unit turns before it moves if the path is in the direction of the point?
Re: Turn unit command for lua
I might investigate this when I get to the point of trying to make C.R.A.I.G. deploy artillery.