Forum Jump :

Author Message


Posts: 2
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-04-12 07:23        
     
I have this simple script I am working on to use as an even on a server

In the simplest form I want to spawn a satellite phone on the ground add action to it make it display a hint or play some music.

This works fine for me locally but other players can't see the addaction

null = [] spawn { 
 laptop = createVehicle ["Land_SatellitePhone_F", player modelToWorld [0,5,0], [], 0, "NONE"];
   [laptop,"ASY_fnc_setIdleTime",false,false] spawn BIS_fnc_MP;
      


hack1 = laptop addAction ["<t color='#FF0000'>Hack the Satellite Transmission</t>", 
           
      {       laptop removeAction hack1;

sleep 5; 
playmusic "LeadTrack02_F_Mark";      
Hint "* Gained Access * Collecting Data";
  "    *****TOP SECRET INTEL*****" HintC ["1","1","1"];
      }]; 
[{hack1},"BIS_fnc_spawn",true,true] spawn BIS_fnc_MP;
}


Its probably something very simple but I tried reading about it on this forum and tried to copy but I am very good at scripting, can't understand.


Author Message


Posts: 83
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: J.Shock

 
#2 Posted at 2015-04-12 08:14        
     
Try this for size:

null = [] spawn 
{ 
	laptop = createVehicle ["Land_SatellitePhone_F", player modelToWorld [0,5,0], [], 0, "NONE"];
	[laptop,"ASY_fnc_setIdleTime",false,false] spawn BIS_fnc_MP;
    
	[
		[
			laptop,
			[
				"<t color='#FF0000'>Hack the Satellite Transmission</t>",
				{
					(_this select 0) removeAction (_this select 2);
					sleep 5;
					playmusic "LeadTrack02_F_Mark";      
					hint "* Gained Access * Collecting Data";
					"    *****TOP SECRET INTEL*****" hintC ["1","1","1"];
				},
				nil,
				6,
				true,
				true,
				"",
				"_this distance _target < 5"
			]
		],
		"addAction",
		true,
		false,
		false
	] call BIS_fnc_MP;
};

John Shock
Scripter, Mission Developer

My scripts: Simple Mortar Script, Redressing Script, Cruise Control Script

My Missions: [COOP-40]Operation Bloody Bayonet

Advertisement


Author Message


Posts: 4
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2015-04-12 08:21        
     
You could try this:

null = [] spawn { 
	laptop = createVehicle ["Land_SatellitePhone_F", player modelToWorld [0,5,0], [], 0, "NONE"];
	[laptop,"ASY_fnc_setIdleTime",false,false] spawn BIS_fnc_MP;
    [{  
		hack1 = laptop addAction ["<t color='#FF0000'>Hack the Satellite Transmission</t>",{
				[{
					laptop removeAction hack1;
					sleep 5; 
					playmusic "LeadTrack02_F_Mark";      
					Hint "* Gained Access * Collecting Data";
					"    *****TOP SECRET INTEL*****" HintC ["1","1","1"];
				},"BIS_fnc_spawn",true,true] call BIS_fnc_MP;
		}]; 
	},"BIS_fnc_spawn",true,true] spawn BIS_fnc_MP;
};

Take JShocks solution, I was thinking, you want to play the hint on every Client (don't know why i was thinking that)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#4 Posted at 2015-04-12 08:44        
     
Why multiplying the bis_fnc_MP if code inside works in MP context?

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 4
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2015-04-12 08:53        
     
I was thinking, that he was trying to play the sound and the message on every client. It's my fault. Jshocks solution is the one he should use.


Author Message


Posts: 2
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2015-04-12 11:13        
     
# JShock : Try this for size:

null = [] spawn 
{ 
	laptop = createVehicle ["Land_SatellitePhone_F", player modelToWorld [0,5,0], [], 0, "NONE"];
	[laptop,"ASY_fnc_setIdleTime",false,false] spawn BIS_fnc_MP;
    
	[
		[
			laptop,
			[
				"<t color='#FF0000'>Hack the Satellite Transmission</t>",
				{
					(_this select 0) removeAction (_this select 2);
					sleep 5;
					playmusic "LeadTrack02_F_Mark";      
					hint "* Gained Access * Collecting Data";
					"    *****TOP SECRET INTEL*****" hintC ["1","1","1"];
				},
				nil,
				6,
				true,
				true,
				"",
				"_this distance _target < 5"
			]
		],
		"addAction",
		true,
		false,
		false
	] call BIS_fnc_MP;
};



THANK YOU VERY MUCH! It worked! Don't know how many hours I tried to make it working!