Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
OFP - Editing/Scripting General / Re: Additional EventHandlers
« Last post by SoldierEPilot on 18 Mar 2018, 23:05:21 »

; to get all WPs one can use DASH_Library 2.5

Code: [Select]
_array_of_pos=_unit call localize "f_waypoints"

; But it's often more easy to lock current WP and do what u want
Code: [Select]
_unit lockWP true
; some scripting actions
_unit lockWP false

; about RESISTANCE allies detection:
1) create 2 invis targets of East and West side
(laser type is the best) in a meter near some resistance unit
2) show 'em to him via reveal command
3) wait a second
4) use _unit countEnemy [_tgt] to see who is resistance enemy.
5) the rest of sides are friendly 2 Troska fraction.
6) remove targets

U can use SideFriendly 4 "All" and SideEnemy 4 "Nobody".

However there are only few situations where u realy need to know
RES fraction allies -  group link (infoshare) and :hmmm: ... do u know one more implementation?

>AI taking cover script
See also
\DASH_Library 2.5\Test Missions\Examples (part 2).Eden\Examples\Misc\useCover.sqs
(one unit hides from another using some big object like APC)
OFP - Editing/Scripting General / Re: Additional EventHandlers
« Last post by Alex_Mercer_1479 on 18 Mar 2018, 12:44:30 »
It felt like you read my mind except getting the current waypoint of a unit part your way is not that reliable

Anyways I'm probably going to release my script soon the AI taking cover script (Dynamically) stay tuned :D
I'm not a MP scripter but anyway :D

Code: [Select]
code = "if (local player) then {player addRating 0.001}"
player addEventHandler ["fired", code]

To see statistics:
Code: [Select]
hint format ["%1 fired %2 times", name player, 1000*((rating player) %1)]
For chopper attack mission u can use
Code: [Select]
vehicle player addEventHandler ["fired", code]
Another way is to compare ammo counts of all weaps before
and after the fight
For M2 hmg:
Code: [Select]
ammoCount =  mg ammo (weapons ms select 0)
shotsHMG = 500 - ammoCount
I am basically making a mission which is very straightforward, just shooting a lot at enemies to train our beginner guys to become better at it.

I thought it would be a cool to have sort of an end statistic that shows for each player how many shots they fired and how many hit. However I dont know much about scripting so I would not know how to do it. Does such script already exist and if not, how would you go about creating it?

Actually just a counter for shots fired by each player would be enough to get an idea since the multiplayer automatically gives you the number of kills you have got.
OFP - Editing/Scripting General / Re: Condition of Presence and !alive
« Last post by snafu on 02 Mar 2018, 00:04:47 »
Thank you for the assistance guys, I have it working nicely  :good:
OFP - Editing/Scripting General / Re: Condition of Presence and !alive
« Last post by Gruntage on 01 Mar 2018, 18:42:14 »
Following on from what h- said, if you want to get rid of the gunner and the mg, I'd have thought that...

Code: [Select]
_gunner = gunner _mg
deletevehicle _gunner
deletevehicle _mg

...would work. Though if you do in fact need to move the gunner out before deleting him, I suppose you could get him to do this:

Code: [Select]
_gunner = gunner _mg

_gunner action ["getout", _mg]
deletevehicle _gunner
deletevehicle _mg

Where I'm a bit hazy with this one though is whether _gunner is still usable when he's no longer in the mg. You could do all this with global variables, i.e. naming the unit you want to be in the mg. In which case the name of the unit is the same whether he's in the mg or not.

It's been a long time since I've done anything like this and I can't easily check what works and what doesn't. I do recall doing something similar to this.
OFP - Editing/Scripting General / Re: Condition of Presence and !alive
« Last post by h- on 01 Mar 2018, 17:17:08 »
Go vice versa, delete the MG via a trigger or script in case e3 is alive.

Just remember that in OFP when you delete a vehicle with crew the crew doesn't get deleted so you need to jump additional hoops to get the gunner to disappear as well. Can't remember how it was done but IIRC you need to move the gunner out of the MG (however that was done) and delete 'him' after that, or maybe easier to delete him after the gun is gone..  :hmmm:
OFP - Editing/Scripting General / Condition of Presence and !alive
« Last post by snafu on 01 Mar 2018, 15:21:45 »
Hello all

I'm designing a mission and looking for easy ways to give it a degree of randomness. For example, I have an enemy group in an LP/OP where the leader's Probability of Presence is set to 30%. The soldiers in his group have alive e3 in their Condition of Presence field.

I thought I could use Condition of Presence to add some easy replay value to the mission. So, I placed a group and an MG vehicle with their Condition of Presence fields containing !alive e3, thinking that when e3 did not spawn they would do so instead.

I discovered during testing that this did not work and from reading I see it's a limitation of the Condition of Presence field.

Is there a simple way to work around this problem?  :hmmm:
OFP - Editing/Scripting General / Re: Additional EventHandlers
« Last post by SoldierEPilot on 25 Feb 2018, 10:54:24 »
 >So there isn't a vanilla way?
In 1.96 there is no good native way to check out unit's current animation.
But there is a way to check out if unit's weapons are in safe mode:
Code: [Select]
?behaviour player in ["CARELESS","SAFE"]:  player sideChat "My hands are empty"
Take note, what WW4-based mods uses patrol anims and wherefore rifles will always
be in hands till dropped.

Another limitation is what once u holster the gun, your behavior will be "safe" or "careless"
after a several seconds and this may be critical in stealth missions.

>Also what about getting the current way point position of unit and also dynamically checking if resistance is friendly to east/west

Current waypoint position: find all waypoints of unit, find 2 nearest of them and
second waypoint in this pair should be the current.
To find all WPs use getWPpos command and loop.

The side of resistance can be set in init.sqs:
;RES_SIDE = sideEnemy
;RES_SIDE = sideFriendly

More universal way is to use a global array of all units,
select one unit of resistance side and use commands "reveal"
and "countEnemy" with pairs (res unit - east unit) and/or (res unit - west unit).
It's hard to do and I recommend much simpler way:

just use countEnemy command to determine if this known unit
is enemy or not for current.

OFP - Editing/Scripting General / Re: Force out of helicopter
« Last post by h- on 25 Feb 2018, 09:03:11 »
If you have all of your units getting in as cargo, you can simplify matters by using this
Considering the command takes an array as argument, no need for a looped method
Code: [Select]
(units _groupname) orderGetIn trueshould suffice..
Assuming of course that the command actually works as advertised  :P
Pages: [1] 2 3 4 5 6 ... 10