Welcome to Tactical Gamer

+ Reply to Thread
Page 5 of 16 FirstFirst 123456789101112131415 ... LastLast
Results 61 to 75 of 237
Discussion: ArmA - Development / ArmA - Mission Development - The Scripting How-To Thread - Yeah. A custom populated ammo crate will spawn the weapons in the crate the order
  1. #61

    GeneralCarver's Avatar

    Join Date
    Aug 2007
    Location
    Indiana, USA
    Age
    32
    Posts
    532

    Re: The Scripting How-To Thread

    Yeah. A custom populated ammo crate will spawn the weapons in the crate the order in which you script them. So, If I put an AK, 9mm, and AT4 in a crate, you'll see them in that order from the top down.

    This message was brought to you by the Society for Better Ammo Crate Scripting.

  2.  
  3. #62

    Sc[ + ]pe's Avatar

    Join Date
    Aug 2007
    Location
    Vancouver, Canada
    Posts
    847

    Re: The Scripting How-To Thread

    Not from what I've seen, Carver. Despite scripting the weapons in the order I wanted, they appear ALPHABETICALLY in the crate. Dunno how to fix it at the moment.

  4.  
  5. #63


    Join Date
    Jun 2007
    Posts
    351

    Re: The Scripting How-To Thread

    Quote Originally Posted by viper1986 View Post
    How do you make it so a vehicle burns for a set period of time instead of just setting the damage to 1 and letting it burn out?
    You might like this
    http://forums.bistudio.com/showpost....44&postcount=3
    ---Bellicosity---


  6.  

     
  7. #64

    Eavy Gunner's Avatar

    Join Date
    Feb 2008
    Location
    North East Lincolnshire, England.
    Age
    19
    Posts
    817

    Re: The Scripting How-To Thread

    Something I found on my first go by visiting the BI Forums, if you have the "Artillery" module synchronized to a MRLS M270, remove its ammo by the sliding bar and then add
    this addmagazine "ARTY_12Rnd_227mmHE_M270";
    to the initialize And you have a working MRLS battery, although it needs to be placed on the other side of the map to hit the target. For some reason, the default rockets explode in your face when using "target arty"

  8.  
  9. #65

    Sc[ + ]pe's Avatar

    Join Date
    Aug 2007
    Location
    Vancouver, Canada
    Posts
    847

    Re: The Scripting How-To Thread

    Heh, I completely forgot about that ammo slider. Here I had to go all over the place to figure out that the MLRS rockets were called 12Rnd_MLRS!!

    Unfortunately, I can't get much use out of the mobile platform right now, because Chernarus simply isn't big enough to need me to move this thing around at all!

  10.  
  11. #66

    Mikee's Avatar

    Join Date
    Jun 2009
    Location
    Naugatuck, CT | USA
    Posts
    619

    Re: The Scripting How-To Thread

    Quick question. I created few radio messages in *.sqf file, and put trigger in game with on activation [] exec "radio1.sqf". It works perfect in the SP, but when I tested on dedicated server it didn't show up.


    colonel SideChat "THIS IS GEN. GARRISON, BE ADVISED THAT SUPER 68 IS READY TO PROVIDE YOU WITH SNIPER COVER FROM THE AIR."
    ~8
    ch1 SideChat "ROGER THAT CROSSROAD. OUT."
    Like I said, it works in SP, but doesnt show up in MP. Any help would be appreciated.

  12.  

     
  13. #67


    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    737

    Re: The Scripting How-To Thread

    What is the trigger's activation conditions?

    sideChat is a local command, so when you run it on a dedicated server, it won't show up for anyone. You need to make sure the condition is such that it will fire for all clients.

  14.  
  15. #68

    Mikee's Avatar

    Join Date
    Jun 2009
    Location
    Naugatuck, CT | USA
    Posts
    619

    Re: The Scripting How-To Thread

    Quote Originally Posted by beita View Post
    What is the trigger's activation conditions?

    sideChat is a local command, so when you run it on a dedicated server, it won't show up for anyone. You need to make sure the condition is such that it will fire for all clients.
    In trigger's activation is: this.

    How can I do this, to be showed in MP?

  16.  
  17. #69


    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    737

    Re: The Scripting How-To Thread

    Well, this refers to all the other stuff you put in the trigger: ie: BLUFOR present.

    Are you sure the trigger is firing properly? As with a trigger and the only activation of "this", it should give a message to all clients.

  18.  

     
  19. #70
    Vic
    Vic is online now


    Join Date
    Jun 2005
    Posts
    126

    Re: The Scripting How-To Thread

    If you're using Radio triggers, those are only run on the computer calling the radio action. You'd have to publicVariable a variable (and read it via script or a trigger with that variable as condition and the desired messages on activation) to run the sideChat on all clients.
    The most dangerous thing on a battlefield is an officer with a map.

  20.  
  21. #71


    Join Date
    Jun 2007
    Posts
    351

    Re: The Scripting How-To Thread

    This works as expected in editor and single player but not multiplayer. Been racking my brain over it. Anyone able to spot why it does not work in multiplayer? Oh, and I have tried without the 'if isServer' bits.

    Code:
    if (isServer) then
    {	
    	_unit = _this;
    	_unit setcaptive true;
    	
    	removeAllWeapons _unit;
    	removeAllItems _unit;
    
    	if (random 1 > 0.3) then
    	{
    		_unit addWeapon "Makarov";
    		_ammo = 1 + random 2;
    		for [{_x = 1}, {_x < _ammo}, {_x = _x + 1}] do
    		{
    			_unit addMagazine "8Rnd_9x18_Makarov";
    		};
    		_unit selectWeapon "Makarov";
    	};
    	sleep 0.1;
    
    	if (random 1 > 0.7) then
    	{
    		_unit addWeapon "Huntingrifle";
    		_ammo = 2 + random 3;
    		for [{_x = 1}, {_x < _ammo}, {_x = _x + 1}] do 
    		{
    			_unit addMagazine "5x_22_LR_17_HMR";
    		}; 
    		_unit selectWeapon "Huntingrifle";
    	};
    	sleep 0.1;
    
    	if (random 1 > 0.5) then
    	{
    		_unit addWeapon "ItemMap";
    		if (random 1 > 0.6) then
    		{
    			_unit addWeapon "ItemGPS";
    		};
    	};	
    	sleep 0.1;
    
    	if (random 1 > 0.2) then
    	{
    		_unit addWeapon "ItemCompass";
    	};
    	sleep 0.1;
    
    	if (random 1 > 0.6) then
    	{
    		_unit addWeapon "ItemRadio";
    	};
    	sleep 0.1;
    
    	if (random 1 > 0.3) then
    	{
    		_unit addWeapon "ItemWatch";
    	};
    
    	_trig = createTrigger ["EmptyDetector", getMarkerPos "Base"];
    	_trig setTriggerArea[75,75, 0, false];
    	_trig triggerAttachVehicle [_unit];
    	_trig setTriggerActivation ["VEHICLE", "PRESENT", this];
    	_trig setTriggerStatements ["this", "{_x setCaptive false} foreach thisList;", ""];
    
    	waitUntil { primaryWeapon _unit != "" and primaryWeapon _unit != "Huntingrifle" };
    	_unit setCaptive false;
    };
    Basically I have an independent calling that in their init line with
    null = this execVM "addWeapons.sqf";

    In multiplayer it doesn't work at all, in singleplayer it works.

    Edit: Got it to work. I guess the init of the players overrides what the server does in init. They give them weps and gear... nice of them. ANYWAYS, I fixed it by putting the call in a trigger instead of the init of the player
    ---Bellicosity---


  22.  
  23. #72

    nthamma's Avatar

    Join Date
    Jul 2008
    Location
    Houston, Tx
    Age
    23
    Posts
    338

    Re: The Scripting How-To Thread

    Quote Originally Posted by Blackdog1-22 Reg.SAS View Post
    I have a fun question... I want a sound to be played from a Vehicle with the driver to be able to actio the sound?

    Any ideas how to do this?

    Ta
    Not sure if your question was answered but here is one way of doing it:

    1) Put this in the init of the vehicle:
    Code:
    this addAction ["Play Sound", "activateSound.sqf", [], 0, false, true, "", "driver _target == player"];
    2) Create activateSound.sqf:
    Code:
    unitname = _this select 0;
    // This is a safe way to ensure the sound will be executed across all clients on the server
    activateSound = true;
    publicVariable "activateSound";
    3) Create a repeated trigger with condition:
    Code:
    activateSound
    and on activation:
    Code:
    unitname say ["sound1", 5]; activateSound = false; publicVariable "activateSound";


    IN GAME ARMA: |TG-Irr| Lq.Snake


  24.  

     
  25. #73

    nthamma's Avatar

    Join Date
    Jul 2008
    Location
    Houston, Tx
    Age
    23
    Posts
    338

    Re: The Scripting How-To Thread

    I'm having trouble making a script that will calculate the velocity of an object. The problem is that it doesn't give me the hint at the bottom which should show the value. I was wondering if someone could point out the error that I'm doing. Thanks in advance!

    Code:
    _target = _this select 0;
    
    _start = getPos _target;
    _new = 0;
    _vector = 0;
    _norm = 0;
    
    while {_norm <= 10} do
    {
    	_new = getPos _target;
    	_vector = [(_new select 0 - _start select 0), (_new select 1 - _start select 1), (_new select 2 - _start select 2)];
    	_norm = (((_vector select 0)^2) + ((_vector select 1)^2) + ((_vector select 2)^2))^0.5;
    };
    
    waitUntil {_norm >= 10};
    _velocity = _norm/_time;
    _printf = format["%1", _velocity];
    hint _printf;


    IN GAME ARMA: |TG-Irr| Lq.Snake


  26.  
  27. #74

    Fincuan's Avatar

    Join Date
    Jan 2009
    Location
    Helsinki, Finland
    Posts
    772

    Re: The Scripting How-To Thread

    At one point _time didn't work properly in .sqf called with execVM, but I have no idea what the current situation is.

    Why not use velocity(returns velocity vector of an object) or speed(returns speed in km/h) on the other hand? The script above could thus be:

    Code:
    _target = _this select 0;
    
    //Get object speed and convert it to m/s
    _speed = (speed _target)/3.6;
    
    hint format["%1",_speed];

  28.  
  29. #75

    nthamma's Avatar

    Join Date
    Jul 2008
    Location
    Houston, Tx
    Age
    23
    Posts
    338

    Re: The Scripting How-To Thread

    haha, i just realized there was a speed command. Thanks fincuan for your help!


    IN GAME ARMA: |TG-Irr| Lq.Snake


  30.  

     

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