Welcome to Tactical Gamer

+ Reply to Thread
Results 1 to 2 of 2
Discussion: ArmA - Development / ArmA - Mission Development - addAction issues need help - I've got a mission the requires three bridges to be blown up. I've written a
  1. #1

    Rustic41's Avatar

    Join Date
    Aug 2009
    Location
    Outer banks, North Carolina, USA
    Posts
    117

    addAction issues need help

    I've got a mission the requires three bridges to be blown up. I've written a script to blow the bridges, but I want to require the player(s) to move to the bridges, where there are explosives (notional at this point) already planted, and insert blasting caps. Once they have inserted the blasting caps they will then be able to remote detonate the bridge.

    I've been tooling around trying to figure out a way to give the player an action "plant blasting caps" once they are within a few meters of the explosives, then once they have planted the blasting caps I need an action given to them that enables them to blow the bridge (which is a simple call on an existing script).

    To better illustrate what I want, the satchel charge is a great analogy. It has the following properties:

    1. An action menu item is added that allows a player to place a satchel charge wherever he wants
    2. Once the satchel is place, another action is added, this time to detonate the charge.
    3. The player then moves a safe distance away and executes the action, which blows up the charge.

    I want exactly the same thing, except in my example I need the following:

    1. An action menu item that is enabled once the player is close enough to a certain object (within 2m), it will be called "insert blasting caps"
    2. Once the "blasting caps" are set, another action is added that, instead of blowing up a certain item, will execute the script I have already written to blow up the bridge, (exec "blowbridge.sqf")
    3. The player will then be able to move a safe distance away and execute the action, which will blow up the bridge via the script that I have already written.

    So you see, all I need is essentially what is already in the game with the satchel charge. I just can't figure out how to make it work...

    Thanks to whomever cares to lend a hand.

    |TG-1st|Rustic 4-1


    "Do not pray for easier lives. Pray to be stronger men." John F. Kennedy

  2.  
  3. #2

    Fincuan's Avatar

    Join Date
    Jan 2009
    Location
    Helsinki, Finland
    Posts
    772

    Re: addAction issues need help

    You'll want to do it like this:
    1. Add an action to the "certain object" that runs the script or code that you want to be run when inserting the blasting caps. Have the code to remove the action once it's run.
    2. Have the above code add the "Blow up bridge" action to whoever runs it(use player addAction ...)

    Something like this... I don't remember what the default distance for the action is, but it's a few meters max. If you want the "place caps"-action to show up only to certain players you can use the new "condition" part of addAction. Consult the comref for the exact syntax.
    "Certain object's" init
    Code:
    if (isServer) then
    {
    	this addAction ["Plant blasting caps", "place_caps.sqf"];
    };
    place_caps.sqf
    Code:
    #define arg(x) (_this select x)
    
    if (local arg(1)) then
    {
    	//Remove the "place caps" action
    	arg(0) removeAction arg(2);
    
    	//Play an animation to simulate doing something
    	player playMove "AinvPknlMstpSlayWrflDnon_medic";
    	sleep 5;
    
    	//Add the new action
    	player addAction ["Detonate charges", "blowbridge.sqf"];
    };
    Finally, remove the action when the bridges are blown:

    blowbridge.sqf
    Code:
    player removeAction (_this select 2);
    Last edited by Fincuan; 11-03-2009 at 05:15 AM.

  4.  

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


  
 

Back to top