Jump to content

lawman_actual

Member
  • Content Count

    258
  • Joined

  • Last visited

  • Medals

Everything posted by lawman_actual

  1. Ahh ok, I see what you mean. I'm still fairly new to scripting and when I wrote this I had a lot of errors trying to run the .sqf from the event handler. The script I posted was just one attempt I made that happened to work properly (probably adapted from an example I saw somewhere else) - and since it worked I never thought to look back at it (until now) Now that you have pointed it out, and I know a bit more about it, I can see what you mean! Thanks for the advice :)
  2. lawman_actual

    Help with "Missing semi-colon"

    Urgh. One day I'll get used to these BIS functions Thanks again Killzone!
  3. Ok, I've searched around and spent a good while rewriting this script, but I'm still getting error messages to the effect of: "MISSING ;" Clearly I'm not understanding something, because as far as I can see the line indicated (and all surrounding lines) end with ; where appropriate. Script: //***** LOAD TROOPS *****// //OBJECTIVE 7|Woodland|DAG1A,DAG1B _thisposi = getMarkerPos "MarkerOne"; _xposi = _thisposi select 0; _yposi = _thisposi select 1; _zposi = (_thisposi select 0) + 500; _locationi = [_xposi, _yposi, _zposi]; //line120 _distvari = [250,750] BIS_fnc_randomInt; _dirvari = [0,359] BIS_fnc_randomInt; _spawni = _distance 7 + 500; _startdeployi = [_locationi, _distancei, _directioni] call BIS_fnc_relPos; _startspawni = [_locationi, _spawni, _directioni] call BIS_fnc_relPos; startheloi = "B_Heli_Transport_01_camo_F" createVehicle _startspawni; The error log thing tells me it's line 121 that's missing the ; so I've marked line 120 in the script for your reference Any help much appreciated
  4. Larrow I'm confused; your proposal still seems to be calling respawni.sqf using execVM? As for WHY I'm going this; I'm working on a system whereby units are redeployed on their death, which requires the event handler and some scripting. I appreciate that I could work the code from respawni.sqf into the event handler's outcome - but I just haven't been bothered yet ;) I may get around to it, but doesn't it achieve the same thing either way? Is there a particular reason that using execVM to achieve the effect is less desirable than writing it into the event handler?
  5. Perfect! Thanks again Green
  6. Understood Thanks for the assistance :) ---------- Post added at 15:17 ---------- Previous post was at 13:33 ---------- Slight hitch.... _this wasn't working as the handle, it still said undefined variable for _deceased so I tried using the global variable of myvariable Seemed to work, but when i tried to select the first value in this array it tells me that input was a script, when a string etc was expected. Here's what I have; init of unit: this addEventHandler ["killed", {null = call {myarray = execVM "respawni.sqf";}}]; respawni.sqf: //start of script _deceased = myarray select 0; potentialunits = potentialunits - [_deceased]; _deceased = nil; myarray = nil; ticketcount = ticketcount +1; //hint (format ["%1",ticketcount]); if (ticketcount > 3) then { ticketcount = ticketcount -4; //hint (format ["%1",ticketcount]); _newgroup = createGroup west; _leadunit = _newgroup createUnit ["B_Soldier_GL_F",[135,122,0],[],0.5,"CORPORAL"]; _leadunit addEventHandler ["killed", {null = call {_this = execVM "respawni.sqf";}}]; _leadunit moveInCargo ustruck1; addSwitchableUnit _leadunit; //spawnedunits = spawnedunits + [_leadunit]; _autounit = _newgroup createUnit ["B_soldier_AR_F",getMarkerPos "respawn1",[],0.5,"PRIVATE"]; _autounit addEventHandler ["killed", {null = call {_this = execVM "respawni.sqf";}}]; _autounit moveInCargo ustruck1; addSwitchableUnit _autounit; _medunit = _newgroup createUnit ["B_medic_F",getMarkerPos "respawn1",[],0.5,"PRIVATE"]; _medunit addEventHandler ["killed", {null = call {_this = execVM "respawni.sqf";}}]; _medunit moveInCargo ustruck1; addSwitchableUnit _medunit; _rifleunit = _newgroup createUnit ["B_soldier_F",getMarkerPos "respawn1",[],0.5,"PRIVATE"]; _rifleunit addEventHandler ["killed", {null = call {_this = execVM "respawni.sqf";}}]; _rifleunit moveInCargo ustruck1; addSwitchableUnit _rifleunit; potentialunits = potentialunits + [_leadunit]; potentialunits = potentialunits + [_autounit]; potentialunits = potentialunits + [_medunit]; potentialunits = potentialunits + [_rifleunit]; doGetOut _leadunit; _leadunit leaveVehicle ustruck1; sleep 1; doGetOut _autounit; _autounit leaveVehicle ustruck1; sleep 1; doGetOut _medunit; _medunit leaveVehicle ustruck1; sleep 1; doGetOut _rifleunit; _rifleunit leaveVehicle ustruck1; sleep 1; _wpPos = getMarkerPos "point1"; _radius = 10; _thisobjective = _newgroup addWaypoint [_wpPos, _radius]; _newgroup setCurrentWaypoint _thisobjective; base = [west, "HQ"]; base sideChat "Fireteam Deployed at Hawk"; } else { }; //end of script
  7. Many thanks, I'll test it out when I get back to it in a few hours Can you clarify what's happening exactly? You're saying (and correct me if I'm wrong) that within respawni.sqf the unit is the first entry in an array known as _this ? That doesn't make much sense to me but if that's the way it works then I guess I can accept it :)
  8. Thanks Jona! Only just spotted this After some searching on my own I did find the setVector options and managed to get it working after a lot of trial and error I will experiment with setPitchBank in future to see if it saves me that hassle
  9. Likely a pretty simple task, but I've spent hours trying to figure this out and looked across heaps of forums and videos. All I want is for an explosive round (preferably something large like an MK82) to fall from the sky and explode. first thing I tried was simply modifying a script I had for a smoke marker with an mk82 cfg I found in the cfg viewer. This worked fine with a red smoke shell, but produced no effect with the mk82. _nearest = player findNearestEnemy player; _smokearea = getPos _nearest; _shell = createVehicle ["2Rnd_Mk82",_smokearea, [], 0, "NONE"]; player groupChat "Hostiles Marked by RED smoke"; Since then I've experimented with a heap of formats, including a simpler version from the BIKI (not createVehicleArray, but plain createVehicle) using a placed marker; _jdamarea = getMarkerPos "jdamstrike"; player groupChat (format ["%1",_jdamarea]); _veh = "2Rnd_Mk82" createVehicle _jdamarea; player groupChat "Shell Released"; Why can't I create explosives?
  10. lawman_actual

    Camera Blur when killed

    Star! Should have guessed it would be a BIS function.... Many thanks Killzone
  11. Hi All I've recently reworked what happens when a player is killed in one of my missions, but I'm getting some problems with the camera every now and then. Currently, when a player is killed they are given a 5 second top-down view of the man they just got killed while in the background they are switched to a placeholder unit across the map. After the 5 seconds the player becomes another active unit on the battlefield. In most cases the switching to another unit manages to prevent the camera blurring as part of the death sequence, but occasionally this fails. The camera will blur-out but the script will continue, leaving me switched to another unit and all working properly....except that I can't see anything because it's all still blurred. I've run through various camera related functions on the wiki and didn't spot anything relating to blur, so how can I stop the blurring, or at the very least un-blur it if it happens again? I wondered if the blur happened when the switch to placeholder wasn't happening quick enough and the blur gets triggered thinking the player is dead. Is there a way to keep the player as the deceased unit but stop the on-death effects (menu appearing, camera blurring) from appearing? This would allow me to cut out the random extra unit and simplify the script somewhat. Script so far; _camtarget = player; _cam = "Land_HandyCam_F" createVehicleLocal [0,0,0]; _cam attachTo [_camtarget, [0,0,4]]; _cam setVectorUp [0,0.99,0.01]; _cam hideObject true; selectPlayer hqunit; _cam switchCamera "Internal"; _updated = allUnits; _casualty = livingunits - (_updated); potentialunits = potentialunits - _casualty; livingunits = allUnits; _casualty = nil; sleep 5; _regen = potentialunits select floor(random(count potentialunits)); selectPlayer _regen; player switchCamera "INTERNAL"; deleteVehicle _cam; player removeAllEventHandlers "killed"; player addEventHandler ["killed",{null = [] execVM "unitkia.sqf";}]; execVM "respawni.sqf";
  12. lawman_actual

    Camera Blur when killed

    Nobody? ---------- Post added at 11:13 ---------- Previous post was at 10:39 ---------- I've messed around with the post processing options while the blur is active. It doesn't appear to be a radial blur or rotational blur. Also no luck creating a ppEffect and setting blur to 0 via trigger (to counter once activated). Still very much needing an answer to this
  13. Hi all I'm developing a mission where it doesn't matter who the player is. When the player is killed I want them to be switched to another unit, which I figure I can achieve having spotted the Select Player function However, I don't want the player to be switched instantaneously. Ideally I'm thinking a brief pause of maybe 4 or 5 seconds to take in what's happened, then something like "Patching you through to....[unit]" comes over the radio and you switch. So how do I achieve that 4-5 second pause without the menu being displayed. You know...that one that pops up when you die that says who killed you and lets you load/switch etc. How do I stop that? Many thanks, Lawman PS. this is currently being developed for single player only ---------- Post added at 20:35 ---------- Previous post was at 19:19 ---------- I sort of figured it out; if (isPlayer deceased) then { _casualty = deceased; deceased = nil; selectPlayer hqunit; _cam = "Land_HandyCam_F" createVehicleLocal [0,0,0]; _cam hideObject true; _cam attachTo [_casualty, [0,0,4]]; _cam setVectorUp [0,0.99,0.01]; _cam switchCamera "Internal"; sleep 2.5; base = [west, "HQ"]; base sideChat "Patching you through to Alpha"; sleep 2.5; selectPlayer dag1a1; player switchCamera "INTERNAL"; deleteVehicle _cam; execVM "respawni.sqf"; } else { deceased = nil; execVM "respawni.sqf"; }; The above script relies on switching to a random officer I have placed on the other side of the map (to stop him being killed) called hqnit when the player is killed. This stops the screen being displayed. As soon as this happens I switch the camera back to the unit that has just been killed (with the camera height at 4m, looking down over the unit - it's a nice touch!) This happens so fast the player never even sees the random officer After the timer the new unit is switched and the camera returned to normal. The only problem with this seems to be that sideChat isn't showing up when the camera is focused on the deceased unit
  14. Yes, the above code is actuated by a killed event handler I've been struggling to set variables using the event handler though Ideally I need to do two things when the unit is killed; 1) Remove the unit killed from an array of 'playable units' 2) execute script i've tried various formats but I just can't get the two happening at once One example I was toying with looked something like this: this addEventHandler ["killed", [{deceased = this}, {null = [] execVM "unitkia.sqf";}]]; It rejected this though, telling me the event handler wouldn't take an array. I tried adding two separate event handlers but doing this the first one, which set the variable deceased = this; didn't seem to have an effect.
  15. Overview - An array, "blueunitsassignedto1" lists all groups that are assigned to objective 1. - When all hostiles are killed in a zone, the objective is completed, and the following script is called; "objmark1" setMarkerColor "ColorBLUFOR"; _basehandle = [west, "HQ"]; _basehandle sideChat "Location Alpha controlled"; objstate1 = 1; sleep 1; {deleteWaypoint [_x,0]} forEach blueassignedto1; player groupChat "Reassigning"; blueassignednot = blueassignednot + blueassignedto1; blueassignedto1 = blueassignedto1 - blueassignedto1; nul = [] execVM "blueseekmainobjective.sqf"; blueseekmainobjective.sqf contains the following relevant code: _wpPos = getMarkerPos "objmark2"; _radius = 50; _thisobjective = {_x addWaypoint [_wpPos, _radius]} forEach blueassignednot; {_x setCurrentWaypoint _thisobjective;} forEach blueassignednot; blueassignedto2 = blueassignedto2 + blueassignednot; blueassignednot = blueassignednot - blueassignednot; The Problem(s) - The deleteWaypoint command does not appear to be deleting the waypoint. It remains visible on the map - The new objective (and accompanying waypoint) are only assigned to a single group from the array. For the one successful group the new wayPoint is successfully assigned and set as current, at which point the old one (which should have been deleted) is marked with a tick and ignored. All other groups appear to have the new wayPoint successfully created, but the first one is not deleted and the new one is not set as current. These other two groups move to the first waypoint and then proceed to the new one I'm struggling to understand why the forEach command is successfully creating new waypoint for all 3 groups within the array but only setting it as current for one of them. I'm also confused about why the deleteWaypoint command is failing Many thanks. ---------- Post added at 16:00 ---------- Previous post was at 15:53 ---------- Update: I can confirm that groups are being correctly added and removed from the following arrays at the correct times; - blueassignednot - blueassignedto1 - blueassignedto2
  16. Post is now redundant. Content removed for clarity.
  17. EDIT Odd things are happening with the Mk82s velocity. I lowerd the starting altitude to 50 and noticed that although the bomb starts off nice and fast (I changed the velocity to 300 to see if it would be closer to the target) ...but after a brief moment of moving at the correct speed it appears to snag on something and slow down significantly. anyone have any idea what this is all about? ---------- Post added at 18:09 ---------- Previous post was at 17:06 ---------- I believe the problem may lie with the fact that the Mk82 is being spawned in facing up. In a 'natural flight' (not altering its acceleration) it will right itself after a second or two of flight. However, when 'pushing' the bomb suddenly at an increased velocity it seems to mess up this process I'm currently researching how to either spawn in the bomb facing down or change its orientation before changing its velocity
  18. Ah ok. I was confused by the fact that the magazine cfg for a red smoke shell was working fine. Where is "Bo_Mk82" found under then? I first looked under the cfg vehicles....this seemed the obvious place for something created using the createVehicle command. Don't see it under there now though (unless I'm just being exceptionally blind)
  19. Probably quite a straightforward question, but I'm running into some problems trying to get a script to run when a newly spawned unit is killed. So far I have the following to spawn in the unit; _newgroup = createGroup west; _leadunit = "B_Soldier_GL_F" createUnit [getMarkerPos "respawn1",_newgroup,"",0.5,"CORPORAL"]; _leadunit addEventHandler ["killed",execVM "trial.sqf";]; The above successfully runs the script, but it works as soon as the unit is spawned - NOT when the unit is killed. Furthermore, the script hangs here and doesn't continue. So I tried a format I'd used successfully for units present from the start of the mission; _newgroup = createGroup west; _leadunit = "B_Soldier_GL_F" createUnit [getMarkerPos "respawn1",_newgroup,"",0.5,"CORPORAL"]; _leadunit addEventHandler ["killed",{null = [] execVM "trial.sqf";}]; Well....the script runs all the way to the end, but the event handler never takes effect. When the unit is killed, the script never runs. Help please? :icon_mrgreen:
  20. lawman_actual

    execVM within event handler

    Never heard of it (I'm pretty new to the Arma Editor) What's the best way to enable this thing?
  21. lawman_actual

    execVM within event handler

    Hallelujah. A big thank you to you all, it appears I've achieved all I needed for now.
  22. lawman_actual

    execVM within event handler

    Okie dokie So are you saying that it is not the handle being stored, but the value of the handle? (Hopefully, because this is what I'm trying to achieve!) I've been running a test to see if the storing of a new units name is working correctly, but it doesn't appear to be :( Here's how it works; 1) spawnedunits is defined in the init.sqf file. I've placed some values in the array so It shows up when I test for it spawnedunits = ["value1","value2"]; 2) A Radio Trigger is placed on the map that calls the array, letting me know the values stored player groupChat (format ["%1",spawnedunits]); The following is returned if triggered from mission start; "["value1","value2"]" 3) respawn.sqf is triggered (by radio for now) and creates a new unit, attempting to add it's object name to the array _newgroup = createGroup west; _leadunit = _newgroup createUnit ["B_Soldier_GL_F",getMarkerPos "respawn1",[],0.5,"CORPORAL"]; _leadunit addEventHandler ["killed",{null = [] execVM "respawni.sqf";}]; spawnedunits = spawnedunits + _leadunit; For some reason, the addition of the last line seems to hang the script. The unit is created, but nothing is added to the array and the script does not finish (i have a hint at the end that tells me if it finished or not)
  23. lawman_actual

    execVM within event handler

    It works! Thank you one and all The following successfully spawns a unit and adds the event handler to it: _newgroup = createGroup west; _leadunit = _newgroup createUnit ["B_Soldier_GL_F",getMarkerPos "respawn1",[],0.5,"CORPORAL"]; _leadunit addEventHandler ["killed",{null = [] execVM "trial.sqf";}]; I'm curious though....the first thing I tried after learning I needed createGroup array followed this example from the BIKI; _unit = group player createUnit ["SoldierWB", Position player, [], 0, "FORM"]; This example failed to spawn the unit. Furthermore it doesn't seem to include a field for units rank? Bonus marks Ok, so now that I've learned that createUnit array returns the object name - can I then store this as part of an array? For example, if I were to say something along the lines of; _newgroup = createGroup west; _leadunit = _newgroup createUnit ["B_Soldier_GL_F",getMarkerPos "respawn1",[],0.5,"CORPORAL"]; _leadunit addEventHandler ["killed",{null = [] execVM "trial.sqf";}]; spawnedunits = spawnedunits + _leadunit; What will the array look like? am I storing the handle; [_leadunit] or am I storing the actual name of the newly spawned unit [examplename]; Thanks again
  24. lawman_actual

    execVM within event handler

    @Sel - understood. My intention was to apply the eventHandler to the new unit Since the unit was not one I placed at the start of the mission, I wasn't really sure how I can obtain the units name Thank you for the alternative suggestion - I will attempt it later today @Curry - trial.sqf couldn't get much simpler ;) player groupChat "Leader KIA!"; It's only role was to indicate whether or not the execVM command was working. I have seen it work in the first format I posted (where it was triggering as the unit spawned rather than on KIA) ---------- Post added at 13:14 ---------- Previous post was at 13:10 ---------- That makes some sense. group CreateUnit [params..] I'm not sure what you mean with the above? Replace the unit class with a group of some kind?
×