Aldo15 11 Posted January 22, 2012 Hi guys I'm making a campaign, so I made a bleeding script, it works, but with a unit only, for example [unit] exec "Bleeding.sqs". My question is What must I do, so all units exec this script. Look the script Bleeding.sqs ;Bleeding Script ;Script will exec when unit has dammage > 0.5 ;Exec the script [Nombredelaunidad] exec "xxx.sqs" ;It needs ofpec_blood addon by SnYpir ;Made byAldo15 _unit = _this select 0 Xpos = getpos _unit select 0 Ypos = getpos _unit select 1 Zpos = getpos _unit select 2 #check ? (getdammage _unit > 0.5) : goto "bleeding" ; [_unit] exec "Efectos\Sangrar\time.sqs" ? (getdammage _unit < 0.5) : goto "nobleeding" goto "check" #Bleeding ? (getdammage _unit < 0.5) : goto "nobleeding" ? (not alive _unit) : goto "End" _sangre1 = "ASM_Bldsplat" Camcreate getpos _unit _sangre2 = "ASM_Bldchnk" Camcreate getpos _unit _sangre3 = "ASM_Bldchnk2" Camcreate getpos _unit _sangre4 = "ASM_Bldchnk3" Camcreate getpos _unit drop ["cl_water", "", "Billboard", 1, 1,[getpos _ap select 0,getpos _ap select 1,0.75], [(sin(getdir _ap) * (Velocity _ap select 0)),(cos(getdir _ap) * (Velocity _ap select 0)),1], 1, 0.05, 0.0045, 0, [0.1], [[0.3,0,0,1],[0.3,0,0,1],[0.3,0,0,1],[0.3,0,0,1]], [0,1,0], 0.5, 0.05, "","", ""] goto "Bleeding2" #bleeding2 ;Pondremos las 4 particulas en posiciones 'al azar' de la posición de la unidad _sangre1 setdir((getdir _unit )-180) _sangre1 setpos [(getpos _unit select 0)+1-(random 1),(getpos _unit select 1)+1-(random 1),0] _sangre2 setdir((getdir _unit )-180) _sangre2 setpos [(getpos _unit select 0)+1-(random 1),(getpos _unit select 1)+1-(random 1),0] _sangre3 setdir((getdir _unit )-180) _sangre3 setpos [(getpos _unit select 0)+1-(random 1),(getpos _unit select 1)+1-(random 1),0] _sangre4 setdir((getdir _unit )-180) _sangre4 setpos [(getpos _unit select 0)+1-(random 1),(getpos _unit select 1)+1-(random 1),0] ~2 goto "bleeding" #nobleeding goto "check" #End exit Time.sqs ;Note: it needs Bleeding.sqs script to work _soldier = _this select 0 _i = 0 #Loop ? getdammage _soldier < 0.5 : goto "Endloop" if (_i == 2000) then {_soldier setdammage 0.7} if (_i == 3000) then {_soldier setdammage 0.8} if (_i == 4500) then {_soldier setdammage 0.9} if (_i == 5000) then {_soldier setdammage 1} _i = _i + 0.5 goto "Loop" #Endloop _soldier setdammage 0 exit Help me please Share this post Link to post Share on other sites
nikiller 18 Posted January 22, 2012 hi, If you want to execute your script to all units in your mission give each group a name. Write myGroupName=group this in each leader's init filed and copy those lines in your init.sqs init.sqs ;******************************* ;Init Script by Nikiller ;Contact: nikillerofp@hotmail.fr ;******************************* _allgrplist=[grpname1,grpname2,grpname3,grpname4,grpname5,grpname6] _all_ar=[] {_all_ar=_all_ar+(units _x)} forEach _allgrplist {[_x] exec "whateverscript.sqs"} forEach _all_ar exit cya. Nikiller. Share this post Link to post Share on other sites
ProfTournesol 956 Posted January 22, 2012 I guess the easiest way would be to put a trigger covering the whole map, activated by anybody, and write this in the on activation line : {[_x] exec "Bleeding.sqs"} foreach thislist Share this post Link to post Share on other sites
Aldo15 11 Posted January 22, 2012 i'll try them thanks guys! Share this post Link to post Share on other sites
nikiller 18 Posted January 22, 2012 (edited) hi, I guess the easiest way would be to put a trigger covering the whole map, activated by anybody, and write this in the on activation line : {[_x] exec "Bleeding.sqs"} foreach thislist I agree it is the easiest way but IMHO, whole map triggers are not performance friendly at all. I recommand to never use it in any case. Moreover, if you use a trigger activated by anybody your bleeding script will be executed for vehicles, empty vehicles and objects (campfire, barrel, fence...) aswell. I don't think you want to see tanks or objects you placed on the map bleeding :D. cya. Nikiller. Edited January 22, 2012 by Nikiller Share this post Link to post Share on other sites
ProfTournesol 956 Posted January 22, 2012 Ha yes, that could be funky to see a barrel bleed, then you can avoid it by trying : [if ("man" counttype [_x] == 1) then {[_x] exec "Bleeding.sqs"}] foreach thislist Share this post Link to post Share on other sites
Pulverizer 1 Posted January 22, 2012 If you are afraid of a trigger wasting precious megahurtzes, you can always deleteVehicle after it served its purpose. This will stop a trigger from evaluating its condition every 0.5s. Share this post Link to post Share on other sites
NacroxNicke 11 Posted January 23, 2012 Oh, thanks Pulverizer, I didn't know that one, it will make my life easier for sure :D! Share this post Link to post Share on other sites
nikiller 18 Posted January 23, 2012 hi, Agree, AWLAYS delete trigger after activation it saves a lot of performance. There's some exception like repeatidly triggers and some others. Forgot to include it in my scripts pack, will do it. cya. Nikiller. Share this post Link to post Share on other sites
ProfTournesol 956 Posted January 23, 2012 If you are afraid of a trigger wasting precious megahurtzes, you can always deleteVehicle after it served its purpose. This will stop a trigger from evaluating its condition every 0.5s. Is the trigger still checking even if it has been fired (and cannot be fired anymore, such as activated only "once" ?) Share this post Link to post Share on other sites
NacroxNicke 11 Posted January 23, 2012 Yep, the triggers as far I know keep checking every 0.5 sec even if they were fired and not used anymore Share this post Link to post Share on other sites
Pulverizer 1 Posted January 24, 2012 Indeed. Here's a test: activate once condition: call{player sidechat format["%1",time]; true} onAct: hint "activated" (also a handy way to get something executed every 0.5s when you are too lazy to write a script :)) Share this post Link to post Share on other sites
ProfTournesol 956 Posted January 24, 2012 Thanks guys, i didn't know this. Share this post Link to post Share on other sites