D-gun delay option?
Moderator: Moderators
D-gun delay option?
Would be nice for preventing instant dgun when spawning at same spots at FFA...
So i could limit dgunning from start of game for example 10 seconds.
So i could limit dgunning from start of game for example 10 seconds.
LuaRules/main.lua:
Alternate version (avoids AllowCommand() call-in slowdowns after 10 seconds)
Code: Select all
function AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpts)
if ((cmdID == CMD.DGUN) and (Spring.GetGameSeconds() < 10)) then
return false
end
return true
end
Code: Select all
function AllowCommand(unitID, unitDefID, teamID, cmdID, cmdParams, cmdOpts)
if (Spring.GetGameSeconds() >= 10) then
AllowCommand = nil
return true
end
return (cmdID ~= CMD.DGUN)
end
Or
Code: Select all
static-var TooSoon;
Create()
{
TooSoon=1;
sleep 10000;
TooSoon=0;
}
AimWeaponX()
{
<normal aiming stuff>
return (!TooSoon);
}
One advantage to the LuaRules approach is that you can
send the team an informative message should it try to dgun
before it is allowed. The dgun/attack icon will also not
appear in the command queue, as the command will have
been discarded.
Spring.SendMessageToTeam(teamID,
"Can not dgun for another " .. (10 - Spring.GetGameSeconds()) .. " seconds")
P.S. Note that the player information is not available in the
AllowCommand() call-in...
P.P.S. One disadvantage is that you will also be blocking
queued dgun commands that would have been executed
after the time limit was passed.
send the team an informative message should it try to dgun
before it is allowed. The dgun/attack icon will also not
appear in the command queue, as the command will have
been discarded.
Spring.SendMessageToTeam(teamID,
"Can not dgun for another " .. (10 - Spring.GetGameSeconds()) .. " seconds")
P.S. Note that the player information is not available in the
AllowCommand() call-in...
P.P.S. One disadvantage is that you will also be blocking
queued dgun commands that would have been executed
after the time limit was passed.
There are 3 things that would happen then 2 commanders born next to each other...
Both wanna die: and they kill each other...
One wanna die: and he chases the other until the boom...
None wanna die: and they run in oposite directions just like em do right now...
Conclusion: This wouldnt really be usefull... :)
Both wanna die: and they kill each other...
One wanna die: and he chases the other until the boom...
None wanna die: and they run in oposite directions just like em do right now...
Conclusion: This wouldnt really be usefull... :)
However if one of the commanders is an AI this may be quite a different problem....manored wrote:There are 3 things that would happen then 2 commanders born next to each other...
Both wanna die: and they kill each other...
One wanna die: and he chases the other until the boom...
None wanna die: and they run in oposite directions just like em do right now...
Conclusion: This wouldnt really be usefull... :)
