Home   Help Search Login Register  

Author Topic: Tracer problem  (Read 1610 times)

0 Members and 1 Guest are viewing this topic.

Offline hamis

  • Members
  • *
  • I'm a llama!
Tracer problem
« on: 26 Aug 2006, 14:55:43 »
Is there any way to change this script from soldier specific to weapon specific?

Code: [Select]
_u = _this select 0
MachineGunners = ["SoldierWMG", "SoldierEMG", "SoldierGMG"];
SpecOps = ["SoldierWSniper", "SoldierWSaboteurPipeHGS","SoldierWLAWSniper", "SoldierWSaboteur", "SoldierWSaboteurPipe", "SoldierWSaboteurDay", "SoldierWSaboteurPipeHG", "SoldierWSaboteurLaser", "SoldierESniper", "SoldierESaboteurPipe", "SoldierESaboteurBizon", "SoldierESaboteurPipeHG","Hunter", "SoldierGSniper", "WHISPERSoldier", "sebnam_acsoldierm79", "sebnamsoldierwgl", "sebnammfrgl", "sebnamsealgl", "sebnamsealm3sd", "sebnamarmywgl", "sebnamarmysniperw", "sebnamsniperw", "sebnamsfgl", "sebnamsfsniper", "sebnamlrrpg"];
~1
? typeOf _u in SpecOps:exit;
? typeOf _u in MachineGunners:goTo "MG"

[_u, 2]call loadFile {\bn_tracer\addTracerUnit.sqf};
exit;

#MG
[_u, 5]call loadFile {\bn_tracer\addTracerUnit.sqf};
exit;

Other scripts you can view by opening BN_Tracers 1.24.pbo.
« Last Edit: 27 Aug 2006, 13:40:34 by bedges »

PetriHonka

  • Guest
Re: Tracer problem
« Reply #1 on: 18 Sep 2006, 21:51:12 »
Try the search function on this website or if that fails you try the Avon Lady FAQ

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Tracer problem
« Reply #2 on: 19 Sep 2006, 09:11:36 »
it all depends which weapons you want to use. basically replace the classnames of the soldiers with the classnames of the weapons, then check the primaryweapon of the unit.

Code: [Select]
_u = _this select 0
machineguns = ["M60", "PK"];
sniper_rifles = ["M21", "SVDDragunov", "HuntingRifle"]
? typeOf _u in machineguns:goto "MG"

[_u, 2]call loadFile {\bn_tracer\addTracerUnit.sqf}
exit;

#MG
[_u, 5]call loadFile {\bn_tracer\addTracerUnit.sqf}
exit

Offline hamis

  • Members
  • *
  • I'm a llama!
Re: Tracer problem
« Reply #3 on: 23 Sep 2006, 09:05:45 »
Well,it doesn't work.So here are other scripts:

addtracerunit.sqf:
Code: [Select]
_u=_this select 0;
_in=_this select 1;
_d=true;
_cc=false;
if(count _this>2)then{
_cc=_this select 2;
};
if(count bn_trinits==count bn_trinits)then{_d=false;};
if _d then{
bn_trinits=[];
[]exec{\bn_tracer\inits.sqs};
};
bn_trinits=bn_trinits+[[_u,_in,_cc]];

addtracerunit2.sqf:
Code: [Select]
_u=_this select 0;
_in=_this select 1;
_cc=_this select 2;
_d=true;
_veh="man"counttype[_u]<1;
if(_veh&&count crew _u==0)then{
_i=-1;
_i2=-1;
while{_i2!=_i+1}do{
_u removeEventHandler["getin",_i2];
_u removeEventHandler["getin",_i];
_i=_u addEventHandler["getin",{}];
_i2=_u addEventHandler["getin",format[{[_this select 0,_this select 2,%1,%2,%3]call loadfile{\bn_tracer\getInVeh.sqf};},_in,_cc,_i+1]];
};

}else{
if(count bn_trunits==count bn_trunits)then{_d=false;};
_i=0;
_ci=_In;
_wep=primaryweapon _u;
_weps=weapons _u;
if _veh then{
if(count _weps>0)then{
_wep=_weps select 0;
};
};
if _d then{
if _cc then{
call loadfile{tracerSettings.cfg};
}else{
call loadfile{\BN_tracer\tracerSettings.cfg};
};
bn_trunits=[_ci];
bn_trunitswep=[_wep];
}else{
_i=count bn_trunits;
bn_trunits=bn_trunits+[_ci];
bn_trunitswep=bn_trunitswep+[_wep];
};
_c=call format["f%2d%3%4%1;%4%1",side _u,{in},{=},{bn_trcolor}];
_d=true;
if(count bn_trweapons==count bn_trweapons)then{_d=false;};


if(_wep!=""&&!_veh)then{
_d=true;
if(count call("bn_tr_"+_wep)==count call("bn_tr_"+_wep))then{_d=false;};
if _d then{
call format[{bn_tr_%1=[_in,_c];},_wep];
};
}else{
if _veh then{
{
_d=true;
if(count call("bn_tr_"+_x)==count call("bn_tr_"+_x))then{_d=false;};
if _d then{
call format[{bn_tr_%1=[_in,_c];},_x];
};
}foreach _weps;
};
};

_u addEventHandler["fired",format[{_this+%1 call loadFile{\bn_tracer\tracereh.sqf}},[_c,_in,_i]]];
};

getinveh.sqf:
Code: [Select]
_u=_this select 0;
_m=_this select 1;
_i=_this select 4;
_u removeEventHandler["getin",_i];
[_u,_this select 2,_this select 3]call loadfile{\bn_tracer\addTracerUnit.sqf};

init.sqs:
Code: [Select]
~3
{_x call loadfile{\bn_tracer\addTracerUnit2.sqf};}foreach bn_trinits;bn_trinits=nil

tracerEH.sqf:
Code: [Select]
_u=_this select 0;
_w1=_this select 1;
if(_w1==primaryweapon _u||"man"counttype[_u]<1)then{
_a=_this select 4;_c=_this select 5;_in=_this select 6;_i=_this select 7;
_w2=bn_trunitswep select _i;
_trace=false;
if(_w1==_w2)then{
_cnt=bn_trunits select _i;
if(_in<=_cnt)then{
_trace=true;
bn_trunits set[_i,1];
}else{
bn_trunits set[_i,_cnt+1];
};
}else{
_d=false;
if(count call("bn_tr_"+_w1)==count call("bn_tr_"+_w1))then{
_wd=call("bn_tr_"+_w1);
_c=_wd select 1;
_in=_wd select 0;
bn_trunits set[_i,2];
bn_trunitswep set[_i,_w1];
if(_in<=1)then{_trace=true;};
};


};
if _trace then{
_b=nearestObject[_u,_a];
_n=objnull;
if!(isnull _b)then{
_v=velocity _b;
_s=sqrt((_v select 0)^2+(_v select 1)^2+(_v select 2)^2);
if(_s>150)then{
_p=getpos _b;
_r=acos((_v select 2)/_s);
if!bn_trdedi then{
_n="BN_Tracer"camcreate _p;_n setdir getdir _b;_n animate["tracer_swing",_r/180];_n setvelocity _v;_n setObjectTexture[0,format["\bn_tracer\%1b.paa",_c]];
  };
  _r1=(_r mod .01)*100;
  _r2=(_r mod .0001)*10000;
  [_n,_b,_c,_p,local _u,_r1,_r2]exec{\bn_tracer\tracerkill.sqs};
  };
  };
};
};
« Last Edit: 23 Sep 2006, 09:31:24 by h- »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Tracer problem
« Reply #4 on: 23 Sep 2006, 09:46:56 »
hamis, please use the code tags when posting long pieces of code, makes the posts 100% more readable..
I added them in your post above..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.