hank_officer 0 Posted January 25, 2008 a part of init.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> [] execVM "enemy.sqf"; .... .... .... jipplayer = false; OnPlayerConnected " jipplayer = true; publicVariable 'gameround'; "; .... .... .... a part of enemy.sqf (old post) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unitsE = ["SquadLeaderE","SoldierEAT","SoldierEAA","TeamLeaderE","SoldierEB","SoldierESniper","SoldierEMG", "SoldierEG","SoldierEMedic","SoldierESaboteurBizon","SoldierESaboteurMarksman"]; _unitsW = ["SquadLeaderW","SoldierWAT","SoldierWAA","TeamLeaderW","SoldierWB","SoldierWSniper","SoldierWMG", "SoldierWG","SoldierWMedic","SoldierWSaboteurAssault","SoldierWSaboteurMarksman"]; _groundpos = ["enemycome_ne","enemycome_se","enemycome_w","enemycome_s"]; _groundcount = count _groundpos; _airpos = ["enemycome_sea_n","enemycome_sea_e"]; _aircount = count _airpos; _townpos = ["camp","towncenter","town_n","town_s"]; _towncount = count _townpos; gameround = 0; callednext = true; noeast = false; nowest = false; _musicplaying = "rock2_1"; Attack_1 = { hint "First Attack is coming in minutes, take the weapons and ready to fight.\n\nThis Attack: |SLA|\nInfantry(1)"; if (local Server) then { [] call Infantry_SLA; }; sleep 2.0; clearall = createTrigger [ "EmptyDetector",getMarkerPos "town_area" ]; clearall setTriggerArea [ 2000,2000,0,false ]; clearall setTriggerActivation [ "EAST","NOT PRESENT",false ]; clearall setTriggerStatements [ "this","callednext = true","" ]; }; Attack_2 = { hint "First Attack defeated.\n\nThis Attack: |SLA|\nInfantry(2)"; playmusic _musicplaying; if (local Server) then { .... .... .... Attack_now = { noeast = false; nowest = false; sleep 5.0; gameround = gameround + 1; publicVariable "gameround"; if( gameround==1 ) then { [] call Attack_1; }; if( gameround==2 ) then { [] call Attack_2; }; if( gameround==3 ) then { [] call Attack_3; }; if( gameround==4 ) then { [] call Attack_4; }; if( gameround==5 ) then { [] call Attack_5; }; if( gameround==6 ) then { [] call Attack_6; }; if( gameround==7 ) then { [] call Attack_7; }; if( gameround==8 ) then { [] call Attack_8; }; if( gameround==9 ) then { [] call Attack_9; }; if( gameround==10 ) then { [] call Attack_10; }; if( gameround==11 ) then { [] call Attack_11; }; if( gameround==12 ) then { [] call Attack_12; }; if( gameround==13 ) then { [] call Attack_13; }; if( gameround==14 ) then { [] call Attack_14; }; if( gameround==15 ) then { [] call Attack_15; }; if( gameround>=16 ) then { [] call End_Won; }; }; .... .... .... for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { sleep 0.01; if(callednext) then { [] call Attack_now; callednext = false; }; }; the problem is... when server is playing attack_1,and 1st wave enemy is not cleared yet. JIP player always show Attack_2's message when he was in game recently... i tried a lot of method. all dont work... even i destoryed my enemy.sqf script 0.o (it's fine that i saved a backfile) i admit i dont know publicVariable cmd very much anyone can help me? Share this post Link to post Share on other sites
loyalguard 15 Posted January 25, 2008 Hank- Are you testing/running this on a true dedicated server? Â If not, I imagine that is one of the primary problems. Â The reason I ask is I am pretty sure that the player the shouldn't receive any messages on a dedicated server the way you have written enemy.sqf. Â If read the code correctly, you apply a "local server" condition in enemy.sqf meaning that code should only run on the server (assuming there is a game logic called server - in either case I recommend using isServer instead): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local Server) then { .... .... .... Attack_now = { noeast = false; nowest = false; sleep 5.0; gameround = gameround + 1; publicVariable "gameround"; if( gameround==1 ) then { [] call Attack_1; }; if( gameround==2 ) then { [] call Attack_2; }; Hints are local only, so, if this code is only being run on the server then a player client should not see any hints unless it is being played in the editor, single player, or a hosted server (where the server is local). if not being run on a dedicated server, then seeing the attack 2 message makes sense I think, here's why (this is a guess): in your init.sqf, when the onPlayerConnected runs it broadcasts the most recent value of gameround. Â If the game is in progress already and the 1st wave is still not clear the value is most likely 1. Now, I can see that in enemy.sqf you set gameround to 0, but, when onPlayerConnected runs it is most likely overwriting the 0 with 1. So, when the below sequence of code in enemy.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">gameround = gameround + 1; publicVariable "gameround"; if( gameround==1 ) then { [] call Attack_1; }; if( gameround==2 ) then { [] call Attack_2; }; gameround is starting at the value of 2, so, Attack_2 is called. If you are running this on a true dedicated server I can't discern what is going on. Share this post Link to post Share on other sites
sickboy 13 Posted January 25, 2008 Hey, Try running through this baby: http://community.bistudio.com/wiki/6thSense.eu:EG It might help you in grasping the wonders of ArmA MP and JIP Share this post Link to post Share on other sites
hank_officer 0 Posted January 26, 2008 thx to all. these info. are helped To Loyalguard : I am testing/running on both. I wanna they all works but i wanna ServerClient work first. then dedicated server. To sickboy : these info. are helpful. I fixed a few little bugs now i have problem on publicVariable because I don't understand. Here http://community.bistudio.com/wiki/publicVariable It says it will "broadcast variable value to all computers" even player will "broadcast variable value to all computers"?? = = (I tested with it and got some strange bug, and JIP still dont work) then which variable value should computer receive? and here is new enemy.sqf and still wrong on JIP (play without JIP is ok) i deleted all publicVariable cmd. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unitsE = ["SquadLeaderE","SoldierEAT","SoldierEAA","TeamLeaderE","SoldierEB","SoldierESniper","SoldierEMG", "SoldierEG","SoldierEMedic","SoldierESaboteurBizon","SoldierESaboteurMarksman"]; _unitsW = ["SquadLeaderW","SoldierWAT","SoldierWAA","TeamLeaderW","SoldierWB","SoldierWSniper","SoldierWMG", "SoldierWG","SoldierWMedic","SoldierWSaboteurAssault","SoldierWSaboteurMarksman"]; _groundpos = ["enemycome_ne","enemycome_se","enemycome_w","enemycome_s"]; _groundcount = count _groundpos; _airpos = ["enemycome_sea_n","enemycome_sea_e"]; _aircount = count _airpos; _townpos = ["camp","towncenter","town_n","town_s"]; _towncount = count _townpos; gameround = 0; callednext = true; noeast = false; nowest = false; _musicplaying = "rock2_1"; Attack_01 = { hint "First Attack is coming in minutes, take the weapons and ready to fight.\n\nThis Attack: |SLA|\nInfantry(1)"; if (IsServer) then { [] call Infantry_SLA; sleep 2.0; clearall = createTrigger [ "EmptyDetector",getMarkerPos "town_area" ]; clearall setTriggerArea [ 2000,2000,0,false ]; clearall setTriggerActivation [ "EAST","NOT PRESENT",false ]; clearall setTriggerStatements [ "this","callednext = true","" ]; }; }; Attack_02 = { hint "First Attack defeated.\n\nThis Attack: |SLA|\nInfantry(2)"; playmusic _musicplaying; if (IsServer) then { [] call Infantry_SLA; sleep 0.1; [] call Infantry_SLA; sleep 2.0; clearall = createTrigger [ "EmptyDetector",getMarkerPos "town_area" ]; clearall setTriggerArea [ 2000,2000,0,false ]; clearall setTriggerActivation [ "EAST","NOT PRESENT",false ]; clearall setTriggerStatements [ "this","callednext = true","" ]; }; }; .... .... .... End_Won = { hint "Good job. Enemy is retreating from Rahmadi..."; playmusic _musicplaying; sleep 30.0; "1" objstatus "done"; endgame = true; }; Attack_now = { noeast = false; nowest = false; sleep 5.0; gameround = gameround + 1; if( gameround==1 ) then { [] call Attack_01; }; if( gameround==2 ) then { [] call Attack_02; }; if( gameround==3 ) then { [] call Attack_03; }; if( gameround==4 ) then { [] call Attack_04; }; if( gameround==5 ) then { [] call Attack_05; }; if( gameround==6 ) then { [] call Attack_06; }; if( gameround==7 ) then { [] call Attack_07; }; if( gameround==8 ) then { [] call Attack_08; }; if( gameround==9 ) then { [] call Attack_09; }; if( gameround==10 ) then { [] call Attack_10; }; if( gameround==11 ) then { [] call Attack_11; }; if( gameround==12 ) then { [] call Attack_12; }; if( gameround==13 ) then { [] call Attack_13; }; if( gameround==14 ) then { [] call Attack_14; }; if( gameround==15 ) then { [] call Attack_15; }; if( gameround>=16 ) then { [] call End_Won; }; }; Infantry_SLA = { groundattack = getmarkerpos (_groundpos select floor (random _groundcount)); grp = createGroup east; sleep 0.05; unit = grp createUnit [(_unitsE select 0), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 1), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 1), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 3), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 4), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 4), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 5), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 6), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 7), groundattack, [], 30, "FORM"];sleep 0.05; unit = grp createUnit [(_unitsE select 8), groundattack, [], 30, "FORM"];sleep 0.05; waypoint = grp addWaypoint [[getmarkerpos "enemy_up" select 0,getmarkerpos "enemy_up" select 1,2], 0]; sleep 0.05; waypoint setWaypointType "HOLD"; waypoint setWaypointFormation "DIAMOND"; }; .... .... .... for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { sleep 0.01; if(callednext) then { [] call Attack_now; callednext = false; }; }; Share this post Link to post Share on other sites