OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Djinn aka KingMobz on 31 Dec 2010, 20:00:20

Title: Traceable Item On Map
Post by: Djinn aka KingMobz on 31 Dec 2010, 20:00:20
Hi guys,

I have a bit of a complicated one for you. Hopefully someone could help me with the answer. Don't worry! You'll be fully credited in the mission design notes as this will be an deciding factor in the completion of this mission.

I have experience at implementing scripts and creating basic .sqs/.sqf files. However, with this particular problem I simply don't know where to start. Simply put: "How does one go about eating an elephant?".

I am looking to create a mission [in ACE 1.09 / ARMA 1.18] where two sides will fight for the claim of a specific item hereby referenced as "disk". The disc will have to be taken to either the western or eastern side of the map by boat or by helicopter. Problems I am experiencing are:

1. Once I find a suitable item model how do I make that item's location appear on map so that it can be tracked [as if it had a tracking beacon built in]? This of coarse has to work even if it is carried by a player and be viewable by ALL SIDES so the enemy team can hunt the other side. It would also have to be traceable if it is dropped or if the player is in a vehicle.

2. I would also have to figure out how to make sure it cannot be placed into an ammobox/vehicle in case the ammobox/vehicle were destroyed and the item were lost causing the mission to become unplayable.

3. How do I get the item to be picked up in the inventory, have a weight of 1 Kg and be carried by a player?

4. If the item is on a player who happens to be in a vehicle/heli how can I make sure that if the vehicle is destroyed the item is placed on the ground near the wreck?

5. If the player takes the item in a heli/boat and it is destroyed how can I make sure the item either returns to shoreline OR becomes a buoy so it is easily seen and retrievable by the driver of any boat/heli that is first to come near it?

UPDATE: So far I know how to create the marker for a moving AI unit:

Code: [Select]
;this will place a moveable red "Dot" marker that will represent the disk's position on the map

#top
createMarker ["diskmarker", getPos disk]
"diskmarker" setMarkerPos getpos disk
"diskmarker" setMarkerColor "ColorRed"
"diskmarker" setMarkerType "Dot"
"diskmarker" setMarkerSize [0.6, 0.6]
goto "top"

But the rest still stands. How do I apply this for an item picked up by a unit?

As you can see this is a big problem but I am sure that if I can resolve these issues I can create a VERY interesting multiplayer mission. I look forward to your suggestions.

-----
P.S  Shameless plug! Anyone looking to play on ACE1.09, ARMA 1.18 join my Steam Community 'Secret Combined Forces' (http://steamcommunity.com/groups/secretcombinedforces (http://steamcommunity.com/groups/secretcombinedforces)). We have got a lot of active members and play co-ops every Sunday night GMT. My name is djinn08 on steam and we are looking for good team players with TS3! Over and Out!
Title: Re: Traceable Item On Map
Post by: joske on 01 Jan 2011, 12:32:05
Ok, not simple and i dont know the total solution to all your problems but il give you some code snippets i have from my missions and maybe they will help note: most of these are for SP and they might cause problems in multiplayer (my MP scripting knowledge is quite thin)

- you can check if an item is in the inventory of a unit by using this:
Code: [Select]
("Laserbatteries" In (Magazines player));i used this in a trigger condition field because i find that the easiest way to do it but this might not work in MP, so your best bet would be to put in in a script.

- i used laserbatteries in this example, and for your mission i would either select another object you dont normally use or an addon object

- for the vehicle part maybe you can use the in vehicle command.
http://community.bistudio.com/wiki/in_vehicle (http://community.bistudio.com/wiki/in_vehicle)
maybe you could do it so that when a unit is in a vehicle AND is dead AND has the item in his inventory(using  the boolean operator AND), the item gets deleted http://community.bistudio.com/wiki/removeMagazine (http://community.bistudio.com/wiki/removeMagazine) and a new item is created http://community.bistudio.com/wiki/addMagazine (http://community.bistudio.com/wiki/addMagazine) in the nearest ammobox (or weaponholder if you dont like having emty weaponboxes spread around the map), using the nearestobjects command http://community.bistudio.com/wiki/nearestObjects (http://community.bistudio.com/wiki/nearestObjects). now this would off course require you to put a whole bunch of empty weaponboxes around the map.

- you might also look up some capture the flag missions you find and salvage them for usefull scripts. (both types of missions sound quite similar)
Title: Re: Traceable Item On Map
Post by: savedbygrace on 31 Jan 2011, 20:52:01
Step 1
The object has an addaction attached to it. And a marker to identify where it is at all times(looping script).

Step 2
when a player activates the objects action, the object and the player who activated it is passed to a script.
The object is setpositioned out of harms way, the marker now follows the player, and the script slowly loops.
Meanwhile, that player has an addaction attached to him. "Drop the item"

Dropping the item will set position the object at the players feet or outside of his vehicle. (vehicle check)
If he is in water, it will setposition it at sea level.(ASL check) Forcing others to commandeer a waterborne vessel to claim it.
If he is in air, it will setposition it at terrain level(ATL check)

If the player dies, the same script executes the same checks and places the item at that players last known pos.
(The looping script will grab that position)

The marker will then pass back to the object and the addaction will be re-added to it.

The cycle continues for any player to activate the action.


Whenever a player picks up that item and the slow looping script begins, it will also check the distance of the player holding the object with his/her home base and replace the "Drop the item" action to a "Secure the item" action. Once secured, The script then executes whatever you need it to. Such as point increase, equipment issue, bonus beer party or whatever.

The key is to not have the item ever actually enter the inventory of the player carrying it. As long as he carries the action to "Drop the item" he carries the script which controls the item.

The kicker to all this is that the "Drop the item" addaction will be available to any one close to the player, so that enemy units could easily force the item out of the players possession and pick it up for themselves but they too would have to hump it to get out of his reach.

In addition, you could add a bonus to whoever secured the item so that even team mates would fight over it.
Title: Re: Traceable Item On Map
Post by: Djinn aka KingMobz on 09 Feb 2011, 21:08:17
Thanks for all the ideas/answers so far. Going to get my finger and see about sorting this all out. Will get back to you soon!
Title: Re: Traceable Item On Map
Post by: stephen271276 on 09 Feb 2011, 22:13:42
http://www.ofpec.com/forum/index.php?topic=35494.0
See my link for ideas, it could be used for what you need