Home   Help Search Login Register  

Author Topic: Ai to move to object  (Read 741 times)

0 Members and 1 Guest are viewing this topic.

illmatic

  • Guest
Ai to move to object
« on: 08 Apr 2004, 13:22:54 »
ok this is what ive wrote so far:

Hintc "Mafia boss is sending out a group of technicals, there ETA is 3 min until they arrive into our lovely town, Cops start plotting your attack and lay down some traps! Civs either help the cops, join in, or hide!"

~200


#raid1

technical1 = "hiluxmg" CreateVehicle getpos Gamelogic1;
technical2 = "hiluxmg" CreateVehicle getpos Gamelogic2;
technical3 = "hiluxmg" CreateVehicle getpos Gamelogic3;
technical4 = "hiluxmg" CreateVehicle getpos Gamelogic4;
technical5 = "hiluxmg" CreateVehicle getpos Gamelogic5;
~0.2
rebel1d = "HK_MAF2_HKG37" CreateVehicle getpos technical1;
rebel2d = "HK_MAF2_HKG37" CreateVehicle getpos technical2;
rebel3d = "HK_MAF2_HKG37" CreateVehicle getpos technical3;
rebel4d = "HK_MAF2_HKG37" CreateVehicle getpos technical4;
rebel5d = "HK_MAF2_HKG37" CreateVehicle getpos technical5;

rebel1g = "HK_MAF2_HKG37" CreateVehicle getpos technical1;
rebel2g = "HK_MAF2_HKG37" CreateVehicle getpos technical2;
rebel3g = "HK_MAF2_HKG37" CreateVehicle getpos technical3;
rebel4g = "HK_MAF2_HKG37" CreateVehicle getpos technical4;
rebel5g = "HK_MAF2_HKG37" CreateVehicle getpos technical5;

rebel1d moveInDriver technical1
rebel2d moveInDriver technical2
rebel3d moveInDriver technical3
rebel4d moveInDriver technical4
rebel5d moveInDriver technical5

rebel1g moveInGunner technical1
rebel2g moveInGunner technical2
rebel3g moveInGunner technical3
rebel4g moveInGunner technical4
rebel5g moveInGunner technical5

rebel1d setbehaviour "combat"
rebel2d setbehaviour "combat"
rebel3d setbehaviour "combat"
rebel4d setbehaviour "combat"
rebel5d setbehaviour "combat"

rebel1g setbehaviour "combat"
rebel2g setbehaviour "combat"
rebel3g setbehaviour "combat"
rebel4g setbehaviour "combat"
rebel5g setbehaviour "combat"

exit

as you see ive created 5 vehicles, spawned ai into each driver and gunner seat and set them all to combat mode, now i havent ever scripted anything to do with ai, ive been far away from doing that, so i was wondering how do i tell an ai to goto a certian object.....i probaly know this but i just cant think of the command.

if you can help me TY

Rappy

  • Guest
Re:Ai to move to object
« Reply #1 on: 08 Apr 2004, 13:54:50 »
Driver domove getpos object

this will tell the driver to go to some object (getpos object, will get the object coordinates for the domove command)

illmatic

  • Guest
Re:Ai to move to object
« Reply #2 on: 08 Apr 2004, 14:11:09 »
thanks m8, jus what i was lookin 4

illmatic

  • Guest
Re:Ai to move to object
« Reply #3 on: 08 Apr 2004, 16:34:16 »
Hintc "Mafia boss is sending out a group of technicals, there ETA is 5 min until they arrive into our lovely town, Cops start plotting your attack and lay down some traps! Civs either help the cops, join in, or hide!"

~10


#raid1

technical1 = "hiluxmg" CreateVehicle getpos Gamelogic1;
technical2 = "hiluxmg" CreateVehicle getpos Gamelogic2;
technical3 = "hiluxmg" CreateVehicle getpos Gamelogic3;
technical4 = "hiluxmg" CreateVehicle getpos Gamelogic4;
technical5 = "hiluxmg" CreateVehicle getpos Gamelogic5;
~0.2
rebel1d = "HK_MAF2_HKG37" CreateVehicle getpos technical1;
rebel2d = "HK_MAF2_HKG37" CreateVehicle getpos technical2;
rebel3d = "HK_MAF2_HKG37" CreateVehicle getpos technical3;
rebel4d = "HK_MAF2_HKG37" CreateVehicle getpos technical4;
rebel5d = "HK_MAF2_HKG37" CreateVehicle getpos technical5;

rebel1g = "HK_MAF2_HKG37" CreateVehicle getpos technical1;
rebel2g = "HK_MAF2_HKG37" CreateVehicle getpos technical2;
rebel3g = "HK_MAF2_HKG37" CreateVehicle getpos technical3;
rebel4g = "HK_MAF2_HKG37" CreateVehicle getpos technical4;
rebel5g = "HK_MAF2_HKG37" CreateVehicle getpos technical5;

rebel1d moveInDriver technical1
rebel2d moveInDriver technical2
rebel3d moveInDriver technical3
rebel4d moveInDriver technical4
rebel5d moveInDriver technical5

rebel1g moveInGunner technical1
rebel2g moveInGunner technical2
rebel3g moveInGunner technical3
rebel4g moveInGunner technical4
rebel5g moveInGunner technical5



~0.5

technical1 exec goto "move1"
technical2 exec goto "move2"
technical3 exec goto "move3"
technical4 exec goto "move4"
technical5 exec goto "move5"

#move1

rebel1d action ["ENGINEON"]

rebel1d domove getpos bankstop1

exit


still not working, what am i doing wrong someone please, the ai does not drive hmm

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Ai to move to object
« Reply #4 on: 08 Apr 2004, 20:23:59 »
I don't think these lines do anything.

technical1 exec goto "move1"
technical2 exec goto "move2"
technical3 exec goto "move3"
technical4 exec goto "move4"
technical5 exec goto "move5"

Do you get an error message?


Planck
I know a little about a lot, and a lot about a little.

illmatic

  • Guest
Re:Ai to move to object
« Reply #5 on: 08 Apr 2004, 20:29:17 »
technical1 exec goto "move1"
technical2 exec goto "move2"
technical3 exec goto "move3"
technical4 exec goto "move4"
technical5 exec goto "move5"

found my error, its a mistype

illmatic

  • Guest
Re:Ai to move to object
« Reply #6 on: 08 Apr 2004, 22:09:32 »
ok a friend of mine from GHF clan has helped me build this, we think the problem was because of the way i created the ai, they werent assigned to a group therefore they would not listen to the commands, hopefully this is the final bug i'll encounter


>>----------------------------------raid.sqs

Hintc "Mafia boss is sending out a group of technicals, there ETA is 5 min until they arrive into our lovely town, Cops start plotting your attack and lay down some traps! Civs either help the cops, join in, or hide!"

~10


#raid1

technical1 = "hiluxmg" CreateVehicle getpos Gamelogic1
technical2 = "hiluxmg" CreateVehicle getpos Gamelogic2
technical3 = "hiluxmg" CreateVehicle getpos Gamelogic3
technical4 = "hiluxmg" CreateVehicle getpos Gamelogic4
technical5 = "hiluxmg" CreateVehicle getpos Gamelogic5
~0.2

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,Null,"this setBehaviour "combat"", 1,  private]
rebel2d = "HK_MAF2_HKG37" CreateUnit [getpos technical2,Null,"this setBehaviour "combat"", 1,  private]
rebel3d = "HK_MAF2_HKG37" CreateUnit [getpos technical3,Null,"this setBehaviour "combat"", 1,  private]
rebel4d = "HK_MAF2_HKG37" CreateUnit [getpos technical4,Null,"this setBehaviour "combat"", 1,  private]
rebel5d = "HK_MAF2_HKG37" CreateUnit [getpos technical5,Null,"this setBehaviour "combat"", 1,  private]

rebel1g = "HK_MAF2_HKG37" CreateVehicle [getpos technical1,Null,"this setBehaviour "combat"", 1,  private]
rebel2g = "HK_MAF2_HKG37" CreateVehicle [getpos technical2,Null,"this setBehaviour "combat"", 1,  private]
rebel3g = "HK_MAF2_HKG37" CreateVehicle [getpos technical3,Null,"this setBehaviour "combat"", 1,  private]
rebel4g = "HK_MAF2_HKG37" CreateVehicle [getpos technical4,Null,"this setBehaviour "combat"", 1,  private]
rebel5g = "HK_MAF2_HKG37" CreateVehicle [getpos technical5,Null,"this setBehaviour "combat"", 1,  private]
~0.2
rebel1d moveInDriver technical1
rebel2d moveInDriver technical2
rebel3d moveInDriver technical3
rebel4d moveInDriver technical4
rebel5d moveInDriver technical5

rebel1g moveInGunner technical1
rebel2g moveInGunner technical2
rebel3g moveInGunner technical3
rebel4g moveInGunner technical4
rebel5g moveInGunner technical5

~0.5

[rebel1d] exec "technical.sqs"
[rebel2d] exec "technical.sqs"
[rebel3d] exec "technical.sqs"
[rebel4d] exec "technical.sqs"
[rebel5d] exec "technical.sqs"

exit

>>----------------------------------technical.sqs

_unit = _this select 0

? _unit == rebel1d : _target = bankstop1
? _unit == rebel2d : _target = bankstop2
? _unit == rebel3d : _target = bankstop3
? _unit == rebel4d : _target = bankstop4
? _unit == rebel5d : _target = bankstop5

#start
~3
_unit domove getpos _target

exit

-----------------------------------------------------------------------------------------

The problem is im getting an error with

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,Null,"this setBehaviour "combat"", 1,  private]

unknown operator combat.... if anyone can help me with this new prob TY..  8) :-\ :-X

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Ai to move to object
« Reply #7 on: 08 Apr 2004, 23:30:25 »
Try:

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,Null,"this setBehaviour ""combat""", 1,  private]

or

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,Null,"this setBehaviour {combat}", 1,  private]


Planck
I know a little about a lot, and a lot about a little.

illmatic

  • Guest
Re:Ai to move to object
« Reply #8 on: 08 Apr 2004, 23:46:23 »
ty, now i get this error

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,Null,"this setBehaviour ""combat"", 1,  private]#|Error invalid number in expression

what am i doing wrong :(

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Ai to move to object
« Reply #9 on: 09 Apr 2004, 00:10:23 »
I think the unit needs to be created into an already existing group.

What you could do is put 1 unit on the map and make him his own group, then delevehicle him.

In his init line:

mygroup group this; deletevehicle this

This way the group is created, I know the unit is deleted, but the group will still exist.

I had another look at the line, presunimg you call your group mygroup........try this:

rebel1d = "HK_MAF2_HKG37" CreateUnit [getpos technical1,mygroup,"this setBehaviour {combat}", 1, " private"]

or try this one also:

"HK_MAF2_HKG37" CreateUnit [getpos technical1,mygroup,"rebel1d = this; this setBehaviour {combat}", 1, " private"]

Use copy/ paste ..........I hope one works for you.

EDIT.....remember to change the group name if you don't use .....mygroup

Planck
« Last Edit: 09 Apr 2004, 00:12:12 by Planck »
I know a little about a lot, and a lot about a little.

illmatic

  • Guest
Re:Ai to move to object
« Reply #10 on: 09 Apr 2004, 00:26:19 »
ty that looks like its working but, mygroup group this; deletevehicle this,  "group" unknown operator

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Ai to move to object
« Reply #11 on: 09 Apr 2004, 00:29:54 »
Check my syntax with the command reference.

I may have made a typo there.

EDIT......Forgot to include the correction:

mygroup = group this

Planck
« Last Edit: 09 Apr 2004, 00:40:09 by Planck »
I know a little about a lot, and a lot about a little.

illmatic

  • Guest
Re:Ai to move to object
« Reply #12 on: 09 Apr 2004, 00:45:49 »
TY 4 all ur help m8, its working without any errors, sorry for all the trouble but im new to this stuf, ty once again

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Ai to move to object
« Reply #13 on: 09 Apr 2004, 01:15:12 »
No problem.......yw


Planck
I know a little about a lot, and a lot about a little.