Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Turret and GT not shooting
Turret and GT not shooting [message #469012] Sun, 10 June 2012 19:58 Go to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
the turret and GT models wont fire

theyll only fire when someone is nearly in it

i thought it was my scripts first but then every defence should have the problem or am i wrong?
header file


cpp file



this is my defence AI
it targets both vtol and ground
and is power independant

ive made it using several ai scripts from TT

edit : fixed the spoiler things Smile


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Wed, 13 June 2012 15:04]

Report message to a moderator

Re: Turret and GT not shooting [message #469030 is a reply to message #469012] Mon, 11 June 2012 00:49 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
For reference, dp88_AI_Turret also supports targeting VTOL and ground and is optionally power independent (it also supports target priorities, such that you can instruct it to prefer shooting infantry instead of vehicles if there are any nearby, or to try and finish off badly damaged targets before healthy ones).

For reference;





Anyway, it sounds to me like your sight range might be too small in your LE preset. The sight range variable determines how far away the defence can 'see' enemies and thus shoot at them.
  • Attachment: ai turret.jpg
    (Size: 400.51KB, Downloaded 268 times)


http://steamsignature.com/card/1/76561197975867233.png
Re: Turret and GT not shooting [message #469039 is a reply to message #469012] Mon, 11 June 2012 05:49 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
yea it hought that to at first but i already doubled it

and it was set at 100 first

the strange thing is that its only those 2 :s

the agt and obelisk work just fine

even the tailgun does (wich makes it even worse as gt is a tailgun)


Owner of kambot TT server

kambot.freeforums.org
Re: Turret and GT not shooting [message #469041 is a reply to message #469012] Mon, 11 June 2012 06:07 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Try using different combinations of the 'Aim 2d', 'Sight down muzzle' and other such options to see what works best, I don't have access to my LE here to see how I usually set mine up but playing around with those usually helps.

http://steamsignature.com/card/1/76561197975867233.png
Re: Turret and GT not shooting [message #469048 is a reply to message #469012] Mon, 11 June 2012 08:39 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
no difference

i tried another script

i tired to use m00_base_Defence and that one worked

but jfw_base_defence didnt :s

edit :

Found it

if (!Commands->Is_Object_Visible(WeaponObj, EnemyObj)) return false;


apparantly turret and gt cant really "see"

EDIT 2 :

my guns wont stop shooting anymore :s

they just keep firing against the wall until the target is totally out of range

WeaponObj->As_SmartGameObj()->Is_Obj_Visible(EnemyObj->As_PhysicalGameObj())

thats the check i use now (it works for the turret and gt)


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Wed, 13 June 2012 09:41]

Report message to a moderator

Re: Turret and GT not shooting [message #469244 is a reply to message #469030] Wed, 13 June 2012 14:57 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
danpaul88 wrote on Mon, 11 June 2012 03:49

For reference, dp88_AI_Turret also supports targeting VTOL and ground and is optionally power independent (it also supports target priorities, such that you can instruct it to prefer shooting infantry instead of vehicles if there are any nearby, or to try and finish off badly damaged targets before healthy ones).

For reference;





Anyway, it sounds to me like your sight range might be too small in your LE preset. The sight range variable determines how far away the defence can 'see' enemies and thus shoot at them.


Very nice documentation, DP. As a community, we tend to lack proper documentation, good job!



Re: Turret and GT not shooting [message #469267 is a reply to message #469244] Thu, 14 June 2012 01:06 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
I have found the best way to handle 'stop shooting at stuff you can no longer see' is to record the last time you 'saw' the enemy (via the Enemy_Seen) event and have a timer that fires regularly to check that against the current time. If you have not 'seen' the enemy you are trying to shoot at for more than 2 or 3 seconds you should probably stop shooting at them.

Alternatively if you change;

params.AttackCheckBlocked = false;

to
params.AttackCheckBlocked = true;


I believe you will get an ActionComplete and it will stop firing if it can no longer shoot at the target, but I am not 100% sure what AttackCheckBlocked does so you will have to experiment (this is the sort of thing I would like to document so let me know your results if you do try this)



reborn wrote on Wed, 13 June 2012 22:57


Very nice documentation, DP. As a community, we tend to lack proper documentation, good job!



I am actually working on documenting all of the TT stuff in that fashion but there's an awful lot of it so it's slow going. Jonwil has done a bit too.

Another example;


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Thu, 14 June 2012 01:14]

Report message to a moderator

Re: Turret and GT not shooting [message #469270 is a reply to message #469267] Thu, 14 June 2012 02:25 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
danpaul88 wrote on Thu, 14 June 2012 10:06

Alternatively if you change;

params.AttackCheckBlocked = false;

to
params.AttackCheckBlocked = true;



i tried that:


my gun would stop shooting BUT it would still follow the target

so it wont give an action complete it just wont fire

as soon as target pops up again it will fire again


however this is what happened in my case could be this is not for all cases

if you want i can try it out to full extend

i think its just that it wont attack if it cant hit a target but it wont lose track of it (you need to do action reset for it)


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Thu, 14 June 2012 02:27]

Report message to a moderator

Re: Turret and GT not shooting [message #469275 is a reply to message #469012] Thu, 14 June 2012 03:28 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Looking at your code, there is a problem with your Timer_Expired function. In the case that timer number == 2 and IsValidEnemy returns true you don't restart the timer, thus you never re-check the enemy is valid after the initial check. That could be the source of your problems.

http://steamsignature.com/card/1/76561197975867233.png
Re: Turret and GT not shooting [message #469277 is a reply to message #469012] Thu, 14 June 2012 05:20 Go to previous message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
it indeed was ive changed the check

but i used it for continuous fire

else full automatic guns keep pausing there fire


ive now changed that to 10 seconds

and removed the check for a valid target

PS: even with that check if i had check attack blocked and it would do action complete (becuase it cant hit his target) it would reset

so the checkblocked will only stop its fire when he cant hit you


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Thu, 14 June 2012 05:27]

Report message to a moderator

Previous Topic: New 3rd Party to host legacy DCOM Renegade content.
Next Topic: Tiberium Crystal War: Radio Commands ;)
Goto Forum:
  


Current Time: Sat Jul 13 17:46:57 MST 2024

Total time taken to generate the page: 0.01544 seconds