1 |
[quote]Indents were optimised out by forum.
|
1 |
[quote]Indents were optimised out by forum.
|
2 |
[/quote]
|
2 |
[/quote]
|
3 |
\n
|
3 |
\n
|
4 |
{{{
|
4 |
{{{
|
5 |
local function TurnOn(newtonid)
|
5 |
local function TurnOn(newtonid)
|
6 |
local states = Spring.GetUnitStates(newtonid)
|
6 |
local states = Spring.GetUnitStates(newtonid)
|
7 |
if states["active"] == false then
|
7 |
if states["active"] == false then
|
8 |
Spring.GiveOrderToUnit(newtonid,35666,{1},0)
|
8 |
Spring.GiveOrderToUnit(newtonid,35666,{1},0)
|
9 |
end
|
9 |
end
|
10 |
end
|
10 |
end
|
11 |
\n
|
11 |
\n
|
12 |
local function TurnOff(newtonid)
|
12 |
local function TurnOff(newtonid)
|
13 |
local states = Spring.GetUnitStates(newtonid)
|
13 |
local states = Spring.GetUnitStates(newtonid)
|
14 |
if states["active"] == true then
|
14 |
if states["active"] == true then
|
15 |
Spring.Echo("Set state to active")
|
15 |
Spring.Echo("Set state to active")
|
16 |
--Spring.GiveOrderToUnit(newtonid,CMD.ONOFF,{0},0) -- does not work
|
16 |
--Spring.GiveOrderToUnit(newtonid,CMD.ONOFF,{0},0) -- does not work
|
17 |
Spring.GiveOrderToUnit(newtonid,35666,{0},0)
|
17 |
Spring.GiveOrderToUnit(newtonid,35666,{0},0)
|
18 |
end
|
18 |
end
|
19 |
end
|
19 |
end
|
20 |
}}}
|
20 |
}}}
|
21 |
\n
|
21 |
\n
|
22 |
FTFY
|
22 |
FTFY
|
23 |
\n
|
23 |
\n
|
24 |
\n
|
24 |
\n
|
25 |
[quote]
--Spring.
GiveOrderToUnit(
newtonid,
CMD.
ONOFF,
{
0}
,
0)
--
does
not
work[/quote]
|
25 |
[quote]{
{
{
--Spring.
GiveOrderToUnit(
newtonid,
CMD.
ONOFF,
{
0}
,
0)
--
does
not
work}
}
}
[/quote]
|
26 |
This probably requires an include for the CMD table to be present.
|
26 |
This probably requires an include for the CMD table to be present.
|