D-gun delay option?

D-gun delay option?

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

D-gun delay option?

Post by TradeMark »

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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Script it yourself.
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Post by manored »

Since all commanders have the same speed, you could just follow the enemy until the time is over... no one will dgun the enemy if they pretend to live cause they know that will kill em too, so they will just run in the oposite direction.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

LuaRules/main.lua:

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
Alternate version (avoids AllowCommand() call-in slowdowns after 10 seconds)

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
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Or

Code: Select all

static-var TooSoon;
Create()
{
 TooSoon=1;
 sleep 10000;
 TooSoon=0;
}

AimWeaponX()
{
 <normal aiming stuff>
 return (!TooSoon);
}
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post by TradeMark »

KDR_11k wrote:Script it yourself.
:roll:
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Well, you're adding files to the mod already so why not decompile the armcom and corcom.cob files, drop those few lines in there, recompile and throw them into the scripts folder of your next map?
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post by TradeMark »

I thought there could be easier way.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

That's as easy a way as they come. Patching something hardcoded into the engine is much more complicated and will just annoy future modders who run into the limitations you leave them with that method.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

TradeMark wrote:
KDR_11k wrote:Script it yourself.
:roll:
It would be possible with about 5 more lines of bos ^_^
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

In fact I already wrote those lines in my post.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

But what happens if you go into FPS mode and fire?
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Post by manored »

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... :)
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

KDR_11k:
Good point :-)
Looks like direct control bypasses the normal command mechanism.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

kdr_11k's implementation would work fine guys, why are you giving him a hard time.

note: !applicatble to trepan
Ansuz
Posts: 1
Joined: 21 Feb 2007, 23:40

Post by Ansuz »

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... :)
However if one of the commanders is an AI this may be quite a different problem.... :?:
Post Reply

Return to “Feature Requests”