I thought I would throw this out there for the scripters - I figure you will know answer b4 I figure it out.
I want mission to end when leader (called p1) has no revives left.
thanx in advance
Lighty
I thought I would throw this out there for the scripters - I figure you will know answer b4 I figure it out.
I want mission to end when leader (called p1) has no revives left.
thanx in advance
Lighty
Are you using Norrins revive script?
yes that is correct
shk found the answer for me - damn good scripter he is - got it right first go and in about 5 minutes.
place this in the init file -
you can adjust the number 3 to reduce number of revives.Code://end when leader dead [] spawn { [] spawn { TheEnd = false; waituntil {TheEnd}; endmission "END1"; }; waituntil {!isnull player}; if (player == leader group player) then { player setvariable ["SHK_reviveCount",0]; while {(player getvariable "SHK_reviveCount") < 3} do { waituntil {(player getvariable "NORRN_unconscious")}; player setvariable ["SHK_reviveCount",(player getvariable "SHK_reviveCount") + 1]; waituntil {!(player getvariable "NORRN_unconscious")}; }; TheEnd = true; publicvariable "TheEnd"; }; };
thanx mate![]()
Last edited by Lightspeed_aust; Jan 28 2011 at 07:04.
Are you still going with that high command thing? Because I have to say my experiences with high command weren't very positive. AI don't seem to really do what you want/expect them to. When you are their group leader it's much easier to tell them exactly what to do, which is probably more suitable for the missions you're trying to make.
In any case, for mission ending, in order to have the mission correctly end on all machines without occasional bugs, you should use something like this:
And then run this script on all machines (easiest is to just execVM it from init.sqf).Code:if (!isServer) then { "end1" addPublicVariableEventHandler { if (dialog) then { closeDialog 0; }; endMission "END1"; }; "end2" addPublicVariableEventHandler { if (dialog) then { closeDialog 0; }; endMission "END2"; }; "end3" addPublicVariableEventHandler { if (dialog) then { closeDialog 0; }; endMission "END3"; }; "end4" addPublicVariableEventHandler { if (dialog) then { closeDialog 0; }; endMission "END4"; }; } else { // initialize global variables here, so you don't get undefined variable errors [] spawn { waitUntil {/*condition for 1st ending here*/}; end1=true; publicVariable "end1"; if (dialog) then { closeDialog 0; }; sleep 5; endMission "END1"; }; [] spawn { waitUntil {/*condition for 2nd ending here*/}; end2=true; publicVariable "end2"; if (dialog) then { closeDialog 0; }; sleep 5; endMission "END2"; }; [] spawn { waitUntil {/*condition for 3nd ending here*/}; end3=true; publicVariable "end3"; if (dialog) then { closeDialog 0; }; sleep 5; endMission "END3"; }; [] spawn { waitUntil {/*condition for 4th ending here*/}; end4=true; publicVariable "end4"; if (dialog) then { closeDialog 0; }; sleep 5; endMission "END4"; }; };
Also, the method you are using will not work for JIP, since the revive count is only saved on the player's machine, so leader could die twice, reconnect, and then die again. The revive script might realize he's out of lives, not sure how the revive script is made, but your mission ending script will lose count. So instead, make that counting only happen on the server, since the server can't JIP![]()
Last edited by galzohar; Jan 28 2011 at 11:06.
You don't mess with the Zohar!
http://www.blackfootstudios.com/forums/
http://www.blackfootstudios.com/foru...blog&blogid=2&
Arma 2 Israel - http://www.arma-il.info
My YouTube channel - http://www.youtube.com/user/galzohar
thanx Gal