Home   Help Search Login Register  

Author Topic: alarm style script  (Read 3269 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
alarm style script
« on: 17 Dec 2005, 11:27:11 »
im looking for a kind of alarm style script as in the enemy see you they radio reinforcements but only if  there are people in such a certain range of them.

And i dont want it to just call every group to the area, i would like it to find the closest group and see if they could go up against the force which will be yes because the player is on their own.

Then that certain squad will come and help take on the enemy but if the enemy escape they will return to their patrol area designated by Waypoints.

I would also like it to check if the player has fired (Using a Fired EH) then check if their is enemy within range of the shooting to come and check what the noise was they will look for a little while before returning to patrol.


I think im looking for something simmilar to what Thobson used in Abandoned Armies but im not sure.

There may be a script which does something like this already but im not sure of it please could somebody help i would like this possible to use with up to half of Everon

Thanks

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:alarm style script
« Reply #1 on: 17 Dec 2005, 12:16:46 »
there may well be scripts around which do some of what you need, but given your experience with flashpoint, i'm sure you can do this one ;)

you'll need a script to loop through the position of the leader of each enemy group, and store those positions in a global array.

Code: [Select]
#loop

grp_pos = [getpos (leader enemy_group1), getpos (leader enemy_group2)].... etc

~1
goto "loop"

you'll need the fired event handler, as you say. this could maybe be used to trip a 'noisy' variable to true, i would suggest taking it one step further and check for silenced weapons within the event handler... sui did this very well.... let's see if i can find the thread...

here we go.

then use a trigger in-game which checks for the 'noisy' variable and runs another script if it's set to true. this script would check the positions of the group leaders and compare the distances - that's a simple case of using the distance command. if there's a leader within range, issue him a domove command. you could even set up a couple of domoves within the same area to make it look like he's searching the place.

then comes the reinforcement problem. you'll need an all_enemy trigger (thislist) and the knowsabout command to check through each and every enemy loon on the map to see if the player's been spotted - could create lag, but give it a go.

and if the knowsabout is high enough, you've been spotted, and another script is called to find the nearest enemy group to the loon that spotted you, and give them similar domove commands.

not easy by any means, but well within your capabilities. we have faith in you - now go to it soldier :)

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #2 on: 17 Dec 2005, 13:01:24 »
okay i think i can do the firing one rather easily with a way i just thought of and since there are no silenced weapons available i dont think it will be too hard im planning on using a fired EH which sets a trigger on the player and sets a variable to true if the enemy is inside it if it is ill do a few distance checks and so on then issue the domove commands

with the other part its a bit harder but i think i could do it it will take a while, but theres one problem the lag the mission has pretty much all the enemy groups 63 of them spread throughout the southern part of Everon and it already causes a fair bit of lag and ive got a rather decent comp but ill have a go
thanks for your help

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:alarm style script
« Reply #3 on: 17 Dec 2005, 13:07:50 »
You don't need 63 groups.    Abandoned Armies doesn't use 63 groups (although it does have two armies.)   Un-Impossible Mission doesn't use 63 groups.

Be smarter.
Plenty of reviewed ArmA missions for you to play

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #4 on: 17 Dec 2005, 13:11:55 »
ive been grouping single units eg, Machine Guns and Tanks together with infantry and so on but if i dont use all the groups its hard for you to be seen since you can win the mission by basically getting out of the big box so its pretty much impossible to tell where the player will leave it at so i cant really think of anyway of reducing the amount of groups but ill have a go
cheers

edit - how do i get the array of what groups are in a trigger ive turned a bit rusty since i lost my OFP Cd
« Last Edit: 17 Dec 2005, 13:13:52 by 456820 »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:alarm style script
« Reply #5 on: 17 Dec 2005, 14:35:48 »
To get an array of groups try something like this:

Code: [Select]
_livingunits = []
{if (alive _x) then {_livingunits = _livingunits + [_x]}} forEach list Triggername

;Create a list of groups
_Groups = []
{if (_x == leader group _x) then {_Groups = _Groups +[group _x]}} forEach _livingunits

pazuzu

  • Guest
Re:alarm style script
« Reply #6 on: 17 Dec 2005, 20:35:25 »
Try "Grouplink II" script by Keycat

Best script I've ever used...

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #7 on: 18 Dec 2005, 18:36:39 »
very weird ive tried that script just now and i get a huge error i copied the contents of the init.sqs the part which i need and changed the groups and i got the error so i changed the groups names to be the same as in the demo mission same error i cant see whats wrong with it ive used it before in several missions and ive done nothing different this time

anyway at the moment im also using General Barrons AI Info share along with Bremners AI script both are going pretty well but i would love to add Key Cats aswell then im going to have a look for any other AI scripts and add that  ;D

There going to be clever AI or so i hope...

edit - Is there an easy way to make Key Cats script run for every squad on the map without having to give them all squad names and adding them to the init.sqs for it to run ?

Since i have a lot of squads it would be very time consuming to give them all different names and then add them to the init.sqs for them to run the script

This may also get rid of the error im having

edit2 -
this is how im running the script from my init.sqs

Quote
[[ge1,ge2,ge3,ge4,ge5,ge6,ge7,ge8,ge9,ge10,ge11,ge12,ge13,ge14,ge15,tankgroup1,tankgroup2,bmpp,grp1,grp2,grp3,grp4,grp5,grp6,grp8,gr9,grp10,grp11],[],[],westalpha,2,0.10] exec "ai\grouplink2.sqs"

i get an error which is too big to remember plus it doesnt say where the error is becuase the line goes of the screen its the first 'while' in the script if you goto search for words and type in While its the first one and thats the line of code

i havent modified the script in anyway just downloaded and put into the mission

whats going wrong ?
« Last Edit: 18 Dec 2005, 19:27:55 by 456820 »

pazuzu

  • Guest
Re:alarm style script
« Reply #8 on: 19 Dec 2005, 04:17:20 »
I think you need to have at least one group listed in the 2nd and 3rd [] Brackets...

1rst bracket is for groups that can be called for support, 2nd brackets is for static groups (They can still call for support but wont leave to support other groups) and 3rd brackets are for groups without vehicles.

You have to name each group and make sure you got all the commas in the right place...like with any script the syntax has to be perfect.

I've used this cript many times and its worth doing the work naming each group. Try just using simple names like the demo does, its less likely to make a mistake...

Edit: I just noticed you got one group name "bmpp". Is that the right name?

Looked like possible mistake to me...
« Last Edit: 19 Dec 2005, 04:20:33 by pazuzu »

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #9 on: 19 Dec 2005, 17:43:41 »
hey ill try what youve said BMPP is correct i made it to stand for BMPP (BMP Patrol)

ill start naming all the groups and so on and see if it works and ill put a group in each bracket

edit -
Quote
3rd brackets are for groups without vehicles.

huh? i dont get that so whats the first brackets for

what do i do if i want tanks to give support which section do i put that in ?

also i think i may of found the problem, i tried using a few infatry groups without tanks and that time i got no errors but i would love tanks to come and help search for the player so how would i go about that ?

edit2 - i gave all squads group names and then wrote each group onto a peice of paper then added them to the apropiate section to run the script i now have this

Code: [Select]
[[grp77,grphelp,mrsnipe,tree1,ge3,tree2,ge4,ge10,tree3,grp8,off11,off2,trr6,off5,tree7,ge1,tree8,grp666,trree1,trree2,grp4,grpsupport,ge7,ge12,lastguys],[ge5,ge11,tree4,tree5,grp9,off3,off4,towny1,ge9,grp777,ge6,grp13,grp12,snipegroup,nextgroup,newgroup1,grp11],[],westalpha,3,0.10] exec "ai\grouplink2.sqs"
thats every group which isnt armour or grouped to any kind of armour they are just infantry no vehicles atall in those groups i found out that the brackets dont need to be used so i tried it like above but no look back with the same error.

I would like it if i could get this to work since it would mean i dont need to make the scripts i originally wanted plus this sounds much better and comes with more features
« Last Edit: 19 Dec 2005, 18:55:42 by 456820 »

Dane

  • Guest
Re:alarm style script
« Reply #10 on: 19 Dec 2005, 19:17:07 »
Quote:
edit -huh? i dont get that so whats the first brackets for

That is for let's say you have one group that init's in a vehicle and one that doesn't, the group that is specified in bracket 3 will not try to mount/remount a vehicle in their vicinity, but a group that's not specified in bracket 3 would might even steal a vehicle in their vicinity if the vehicles group is dismounted, anyway that's how i understand the readme.

Quote:
what do i do if i want tanks to give support which section do i put that in ?

If you want different kinds of support, maybe check out Bremmer's Improved AI Script instead, or use both.

Edit:Here's link
« Last Edit: 19 Dec 2005, 19:26:42 by DaneDK »

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #11 on: 19 Dec 2005, 19:26:33 »
cheers for clearing that up im also using Bremners AI script i was planning on using both but i cant seem to get Key Cats to work

Code: [Select]
while "count _temparray > 0" do {_acount = (count _temparray); _rand = random _acount; _rand = _rand - (_rand mod 1);_moveunit = _temparray select _rand;_newarray = _newarray + [_moveunit]; _temparray = _temparray - [_moveunit]}

thats the line which is causing a problem since the lines so big it doesnt fit on the OFP screen so cant telly ou what the actuall error is but does anyone know what could be wrong with it ive looked over it and it all seems fine is it osmething to do with a group im using

Could it be a group has too many soldiers for the script or their are too many groups, is there armour in a group, can one of the groups not move etc etc what could be cuaseing an error in that line of code ?

Dane

  • Guest
Re:alarm style script
« Reply #12 on: 19 Dec 2005, 19:29:00 »
Could you show us how you are calling the script?

pazuzu

  • Guest
Re:alarm style script
« Reply #13 on: 19 Dec 2005, 20:27:29 »
The 1rst brackets are for groups that give and call for support. It doesn't matter if it's a tank, infantry or chopper it just lists the groups that can call for support and can give support to other groups.

The 2nd bracket list is for static groups. If you want a group to stay at a base for example you list them here and they will stay to defend the base. They can also call for support. At the very least they will be alerted to your presence.

DaneDK already explained how the 3rd brackets work...

There is no limit to how many groups you can list.

There is a limit to 1 chopper used as support.

If you have some static groups without vehicles try listing them in the 2nd and 3rd brackets.

I've seen that long error your getting several times and it always has to do with how the groups are listed. It could be that one of the group names is wrong and doesn't match what's listed. I had a buddy that was using Probobility of presence in his units and when the units weren't present he would get that error because the script couldn't find that group. You just have to be very carefull about naming your groups and listing them in the right place.

If you want me to look at your mission & try to fix it let me know...

pazuzu9@cox.net

huxley521@hotmail.com

Offline 456820

  • Contributing Member
  • **
Re:alarm style script
« Reply #14 on: 19 Dec 2005, 20:35:47 »
Quote
I had a buddy that was using Probobility of presence in his units and when the units weren't present he would get that error because the script couldn't find that group

ahh that could be it im using the probability of precense on all groups, ill go and change all the leaders to 100% so there always present if that doesnt work i dont know what will ill report back ASAP