-
07-28-2009, 08:30 PM #61
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.
-
07-28-2009, 08:36 PM #62
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.
-
07-29-2009, 08:54 AM #63
- Join Date
- Jun 2007
- Posts
- 351
Re: The Scripting How-To Thread
You might like this
http://forums.bistudio.com/showpost....44&postcount=3---Bellicosity---

-
07-29-2009, 11:44 AM #64
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
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"this addmagazine "ARTY_12Rnd_227mmHE_M270";
-
07-29-2009, 04:22 PM #65
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!
-
07-29-2009, 04:22 PM #66
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.
Like I said, it works in SP, but doesnt show up in MP. Any help would be appreciated
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."
.
-
07-29-2009, 06:42 PM #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.
-
07-29-2009, 09:20 PM #68
-
07-29-2009, 09:43 PM #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.
-
07-30-2009, 08:58 AM #70
- 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.
-
07-31-2009, 12:40 PM #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.
Basically I have an independent calling that in their init line withCode: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; };
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---

-
08-01-2009, 08:34 PM #72
Re: The Scripting How-To Thread
Not sure if your question was answered but here is one way of doing it:
1) Put this in the init of the vehicle:
2) Create activateSound.sqf:Code:this addAction ["Play Sound", "activateSound.sqf", [], 0, false, true, "", "driver _target == player"];
3) Create a repeated trigger with condition: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";
and on activation:Code:activateSound
Code:unitname say ["sound1", 5]; activateSound = false; publicVariable "activateSound";


IN GAME ARMA: |TG-Irr| Lq.Snake
-
08-06-2009, 02:25 PM #73
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
-
08-07-2009, 06:31 AM #74
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];
-
08-08-2009, 03:10 AM #75
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
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)



Reply With Quote







Bookmarks