Home   Help Search Login Register  

Author Topic: Recon script  (Read 3014 times)

0 Members and 1 Guest are viewing this topic.

SEAL84

  • Guest
Recon script
« on: 24 Aug 2002, 20:23:16 »
Just wanted to check that what I'm thinking of is possible....no sense in wasting my time playing around with it if it don't work  ;D

I need a recon script, so that when you've reeced a town your objective is complete.  The idea is to record the numbers/positions of enemy armor.

So if I remember right, all you'd need to do is create a list of all the units you want the player to spot, put them in an array, and then use a trigger to check if the player knowsabout all those units, right?

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:Recon script
« Reply #1 on: 24 Aug 2002, 21:22:23 »
Yeah that would work if the mission didn't take too long because the player "forgets" about some units after about 60 seconds... If the recce was gonna last even longer than that (Which I would hope) you will need to create a loop which when it is detected that the player knows about one of the enemies, it is saved in a var (or can be done using triggers)

e.g.
Code: [Select]
_ap = player

#loop
?_ap knowsabout armour1:armour1 = true
?_ap knowsabout armour2:armour2 = true
~60
;check if all triggers are true (I don't know how to do this)
goto "loop"
for this you need two triggers with the condition fields set to "armour1" and "armour2"

then you would need to check if all the trigger are true before going back to the loop. (I am not sure how to do this at the mo)

Hope this works,

Gastovski

SEAL84

  • Guest
Re:Recon script
« Reply #2 on: 24 Aug 2002, 22:05:48 »
Hmm...so this way needs a trigger for every unit being recced?  That could be kinda complicated because ATM there are 4 towns to be recced and multiple units in each town that need to be spotted...

All I really need is for the player to identify them once, not neccesarily to continue knowing about them, ya know?  I dunno if that changes the question at all  ???

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:Recon script
« Reply #3 on: 24 Aug 2002, 22:15:46 »
I don't know how long it takes for a unit to "forget" about another unit, but you could make it so that they have a cut-off time for each village and have four triggers instead of loads. Only problem is that if they don't get the cut-off type done in time, then they fail the obj... i think that my firt way would be better... Will try to think of another...

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Recon script
« Reply #4 on: 24 Aug 2002, 22:21:24 »
hmmmmm - there is a command to change the intel of the unit - so as soon as he knows about it - then u can set it to a high level of intel' - then use the knowsabout command.
Proud Member of the Volunteer Commando Battalion

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:Recon script
« Reply #5 on: 24 Aug 2002, 22:24:43 »
I have another idea... How about if you visit the town, and when you spot a unit you have to write down the poition of it in a console. This can be done using dialog scripting, however it is more complicated than using my above method!!!

It involves description.ext editing...

I can't think of anything else....  >:(

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:Recon script
« Reply #6 on: 25 Aug 2002, 00:13:11 »
So you could do that, or I had another idea.

using the same basic script before, but instead of using triggers you could make gamelogics, and have a script which counts the amount of gamelogics. When there are a predetermined amount of gl's you complete the objective...

knowsabout.sqs
Code: [Select]
_ap = player
[] exec "objdone.sqs"

#loop
?_ap knowsabout armour1:createvehicle "gamelogic"
?_ap knowsabout armour2:createvehicle "gamelogic"
~60
goto "loop"

objdone.sqs
Code: [Select]
#start
_unit = countunits "gamelogic"
?_units = "2":"0" objstatus "DONE"
goto "start"

I think that this would work as long as you have no other gamelogics.

Oh BTW i am not sure about the countunits command... I think that it exists...

Bremmer

  • Guest
Re:Recon script
« Reply #7 on: 25 Aug 2002, 00:42:47 »
I would suggest using a bit of scripting rather than lots of triggers. This is just off the top of my head, and will certainly need debugging, but :-


;recon script
_units = [target1, target2, target3, target4]

#start
_i = 0

#cycle
~0.01
_unit = _units select _i
? player knowsabout _unit > 0 : hint "enemy spotted"; _units = _units - [_unit]; goto "start"
_i = _i + 1
? _i < count _units : goto "cycle"
? count _units == 0 : hint "Recon Successful!"; exit
goto "start"


Basically what this does is check if the player knows about each of the targets in the array you define, and subtract them from the array if he does. When all targets have been spotted the array has no unts left in it, and the script exits.

Give it a try and let me know if you encounter any problems.

Cheers

[edit] Just checked what I'd typed and found a couple of bugs. This copy should work OK [/edit]
« Last Edit: 25 Aug 2002, 00:53:39 by Bremmer »

whiplash2000a

  • Guest
Re:Recon script
« Reply #8 on: 25 Aug 2002, 04:26:15 »
you could also set a variable to a certain value when the player knowsabout a certain unit. Therefore, it would'nt matter if the player "forgot" the unit.

DeusRich

  • Guest
Re:Recon script
« Reply #9 on: 26 Aug 2002, 11:13:26 »
or, you could just start counting, which may be easier, for example if you had 8 tanks in total =

Code: [Select]
_ap = player
_tank1 = _this select 0
_tank2 = _this select 1
_tank3 = _this select 2
_tank4 = _this select 3
_tank5 = _this select 4
_tank6 = _this select 5
_tank7 = _this select 6
_tank8 = _this select 7

_num = 0

#checking
? (_num = 8):[] exec "objcomplete.sqs"
? (_ap knowsabout _tank1):_num = _num + 1
? (_ap knowsabout _tank2):_num = _num + 1
? (_ap knowsabout _tank3):_num = _num + 1
? (_ap knowsabout _tank4):_num = _num + 1
? (_ap knowsabout _tank5):_num = _num + 1
? (_ap knowsabout _tank6):_num = _num + 1
? (_ap knowsabout _tank7):_num = _num + 1
? (_ap knowsabout _tank8):_num = _num + 1
~0.2
goto "checking"

that will have a number, and will add one every time you find a tank, simple, that may not work if you find about the same tank twice, but Im not sure if you can, can you?

mikeb

  • Guest
Re:Recon script
« Reply #10 on: 26 Aug 2002, 13:54:10 »
Wait a minute...


I'm not a scripting expert but I return to the first looped script that someone gave.  Isn't it true that once a variable is changed to true it remains at true unless someone actually changes it to false?

Hence if the script loops every, say 5 seconds (need to target a unit to be sure of it for 5 seconds - realism, etc.) it doesn't matter if it the variable is reactivated or not the second time, it's still set to true.  This would seem to make sense unless the ...

?_ap knowsabout armour1:armour1 = true

.... line would also do the opposite and actually change the armour1 variable back to flase if not satisfied.

Does anyone understand what I'm saying?

Logically you shouldn't have the problem of losing knowledge.  If I'm wrong could someone please explain why.

M

Offline Gastovski

  • Members
  • *
  • #loop; Gastovski setdammage 0; ~0.01; goto "loop";
    • Falklands Mod
Re:Recon script
« Reply #11 on: 26 Aug 2002, 15:18:38 »
Yeah it is true, but OFP has it built in the .exe (or somewhere) that if the player doesn't see something for a predetermined amount of time it "forgets" about it... thats why I wanted to add a unit every time he saw it...

The knowsabout command if forgettable which is why things disappear on the map if you don't see them for a long time...  ;D

mikeb

  • Guest
Re:Recon script
« Reply #12 on: 26 Aug 2002, 15:23:43 »
Sure it's forgettable, but a change in the knowsabout shouldn't REVERSE the variable to false.  Obviously a new check on the condition would not be satisfied but don't you need to actually put variable=false to reverse the variable if it's already been set to true?  Simply checking whether you can assert its "truthfulness"  does not alter the fact that the variable has already been set to true..

I know I'm not explaining this very well.  Anyone understand?

SEAL84

  • Guest
Re:Recon script
« Reply #13 on: 26 Aug 2002, 20:52:44 »
Jeez....thanks for all the ideas!

I haven't really had a chance to test this out, but at least we know the idea works.  

I was sorta wondering the same thing though...if a certain variable became true at the moment of "discovery" of a unit, it seems to me that the variable would stay true regardless of whether or not you still know about the unit...I mean, it makes sense to me.  Basically I wonder if the variable only needs to be toggled once and that's it.  

mikeb

  • Guest
Re:Recon script
« Reply #14 on: 26 Aug 2002, 20:56:34 »
Thank god you understand me!!!

You should give it a go.  I've had trouble loading OFP just now so couldn't try it myself but seeing as you can set variables to false seperately the whole system seems to work as a toggle like you say.

Try, then tell us what works.