Home   Help Search Login Register  

Author Topic: Indirect Fire Attack Simulation  (Read 4306 times)

0 Members and 2 Guests are viewing this topic.

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #15 on: 16 Feb 2009, 20:57:47 »
Code: (init.sqf) [Select]
execVM "IDFattack.sqf";
Code: (IDFattack.sqf) [Select]
see below...
Problem line:
Code: [Select]
speaker setvehicleinit format["this say %1", IDFalarm];
This was the only line I could see as being a problem as I've forgotten the notation with talking marks, if that doesn't work try these solutions (sorry for the screw around, I really need to get ArmA re-installed.)
Code: [Select]
solved...
« Last Edit: 16 Feb 2009, 21:42:00 by Rommel92 »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Indirect Fire Attack Simulation
« Reply #16 on: 16 Feb 2009, 21:02:53 »
The only script that needs publicvariable is the IDF.sqs.

The other scripts are simply waiting for the publicvariable command  :cool2:

Might be:

alarmsound.sqs
Code: [Select]
#loop
if (IDFattack) then {speaker say "IDFalarm"}
~12
goto "loop"

I would go with Rommels script though, when it doesn't report errors  ;)
« Last Edit: 16 Feb 2009, 21:16:28 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #17 on: 16 Feb 2009, 21:18:56 »
(Just installed ArmA - Installing Patches  :P)

In future Laggy, try a addPublicEventHandler

Its better then having a constant loop.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #18 on: 16 Feb 2009, 21:22:37 »
Rommel, i have used the original script again:-

Code: [Select]
if (not isserver) exitwith {};

waituntil {IDF_attack};

while {true} do {
private"_w";
_w = time + 1;
while {_w < time} do {sleep 1};
_w = time + 6 + random 2;
[_w] spawn {
while {_this select 0 < time} do {
sleep 12;
speaker setvehicleinit format["this say %1", IDFAlarm];
processinitcommands;
};
};
while {_w < time} do {
sleep (5 + random 5);
private"_b";
_b = "Sh_120_HE" createVehicle [(getpos IDFCenter select 0) + 50 - random 100,(getpos IDFCenter select 1) + 50 - random 100, 50];
};
};


I've just changed the sound file name to IDFAlarm (to match the sound file) and gamelogic to IDFCenter to tie in with my mission.  I have also changed the time so that i can test if it works.  Although i dont get any errors, the script doesnt seem to start. No sound and no spawning shells.

I hope i've not changed anything i should'nt have with the time stuff, if so what should i enter so i can test it works.  I figured the values i have entered would get the script to start soon after mission start.


Thanks again to everyone for takin an interest in this.

« Last Edit: 17 Feb 2009, 00:37:19 by Shadow.D. ^BOB^ »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Indirect Fire Attack Simulation
« Reply #19 on: 16 Feb 2009, 21:31:16 »
(Just installed ArmA - Installing Patches  :P)

In future Laggy, try a addPublicEventHandler

Its better then having a constant loop.

I never got my head around how the addPublicVariableEventHandler is used.
Could you give a quick example Rommel?
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #20 on: 16 Feb 2009, 21:35:16 »
Code: (IDFAttack.sqf) [Select]
if (not isserver) exitwith {};

waituntil {IDF_attack};

while {true} do {
private"_w";
_w = time + 1;
waituntil {time > _w};
_w = time + 6 + random 2;
[_w] spawn {
while {time < _this select 0} do {
sleep 12;
speaker setvehicleinit format["this say %1", IDFAlarm];
processinitcommands;
};
};
while {time < _w} do {
sleep (5 + random 5);
private"_b";
_b = "Sh_120_HE" createVehicle [(getpos IDFCenter select 0) + 50 - random 100,(getpos IDFCenter select 1) + 50 - random 100, 50];
};
};

Positive Results! - Works a beauty.

Logic failure, I had _w < time instead of time < _w ... atleast I think.

Quote from: Laggy
I never got my head around how the addPublicVariableEventHandler is used.
Could you give a quick example Rommel?

Code: (example) [Select]
"IDFAttack" addPublicVariableEventHandler {
hint ((_this select 0) + " has been updated to: " + str (_this select 1));
if (_this select 1) then { //boolean true
while {IDFAttack} do {
sleep 12;
speaker say "IDFalarm";
};
};
};

EXAMPLE FOR LAGGY.
« Last Edit: 16 Feb 2009, 21:58:03 by Rommel92 »

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Indirect Fire Attack Simulation
« Reply #21 on: 16 Feb 2009, 21:57:10 »
Ughhh  :blink:

What does it do?

What is the "//boolean true" thingy?

EDIT:

Awesome, must try it out  :good:
Thanks for taking the time to explain it  :)

Laggy
« Last Edit: 16 Feb 2009, 22:13:06 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #22 on: 16 Feb 2009, 22:02:19 »
Code: (init) [Select]
"Laggyexample" addPublicVariableEventHandler {
player sidechat "I'm a little bit laggy today. Damn latency.";
};

Alpha Radio Trigger:
Code: (onAct) [Select]
laggyexample = "test"; publicVariable "laggyexample";
This however will not show on your computer:
Quote from: BIS
Note that the EH is only fired on clients where the publicVariable command has not been executed, as publicVariable does not change the variable where it has been executed.

So if tested on a dedicated server, it will come up on your computer saying "I'm a little bit laggy today. Damn Latency".

_this select 0 being the variable itself as a string "Laggyexample" and _this select 1 being the variables new value as a value: "test".

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #23 on: 16 Feb 2009, 22:10:46 »
Hmmm tried that script again Rommel, but i cant hear the alarm and no shells.  I have waited a couple of minutes for it to start (just incase).  Any chance you could repost the last template i uploaded with it working?  Just incase i'm missing something.  How long does it take generally to sound when you try the script using the above time numbers?

Cheers.

Edit:- This can be tested from the editor right? Or does it need to be on a dedicated server?
« Last Edit: 16 Feb 2009, 22:14:14 by Shadow.D. ^BOB^ »

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #24 on: 16 Feb 2009, 22:31:51 »
Make sure you have the Radio trigger working correctly.

Code: (OnAct) [Select]
IDF_attack = true
I tested it with a wolf sound and the shells, and my first (and only) error was that I had:

Code: (onAct) [Select]
IDFattack = true
So maybe double check that.

Note: it should be IDFattack, but I made a mistake in the script, so whichever one you chose, make sure they are consistent.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #25 on: 16 Feb 2009, 23:55:52 »
ah i see, i wasnt setting the IDFattack to true via the radio.

EDIT:- Ok tested this, i get an error once its started. 

Code: [Select]
'this say scalar |#|bool array string 0xe0ffffef'
Error Missing ;

The shells come in fine, so im guessing the error is sound related.

Sorry if it sounds like im nagging you.  :D

I've attached the example mission again as it stands now.
« Last Edit: 17 Feb 2009, 00:18:12 by Shadow.D. ^BOB^ »

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #26 on: 17 Feb 2009, 01:23:05 »
Code: [Select]
speaker setvehicleinit format["this say %1", "IDFAlarm"];
Hopefully that works. I'd test it, but I'm now at a different computer 30km away from ArmA.  :whistle:
Your not nagging me at all; I just needed to test these before posting solutions :P.

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #27 on: 17 Feb 2009, 01:37:32 »
Getting there  :D

The error has gone, the shells come in, but no sound plays.  ???

You gotta love this game, definatly keeps you busy.
« Last Edit: 17 Feb 2009, 01:39:42 by Shadow.D. ^BOB^ »

Offline Rommel92

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #28 on: 17 Feb 2009, 06:29:57 »
All fixed and working, you forgot to set up the sound in the description.ext. You were missing \sound\ for the file path and it was also really quiet, but you can modify that.

There also appears to be a loop in the sound that powers down, and it the sound lasts about 26 seconds, so I made a 2s crossover period instead of about four sounds at once.  :whistle:

Offline Shadow.D. ^BOB^

  • Members
  • *
Re: Indirect Fire Attack Simulation
« Reply #29 on: 17 Feb 2009, 14:06:42 »
Well what can i say, you guys are top notch.  Thankyou to Laggy for the original scipt and Rommel for his super "pimped" version.  :cool2: This is the reason, OFP/ArmA has the best community out there.

Before I call this one as complete, can i just verify the values to change:-

1. The length of the random time in which the attack begins.

2. The length of time the attack continues.

3. The length of time before the sound file replays, during the attack.

I will get testing this in my template asap, it really is gonna add something special.

Once again, you boys have far exceeded my expectations.  THANKYOU!!  :clap:
« Last Edit: 17 Feb 2009, 14:08:13 by Shadow.D. ^BOB^ »