Jump to content

albertfish

Member
  • Content Count

    65
  • Joined

  • Last visited

  • Medals

Everything posted by albertfish

  1. Hello, this is a simple script I threw together that allows you to spawn in karts with a specific colour, number and logo. Parameters: Parameters: 0: ARRAY - the position where the kart will be created 1: STRING - the number to be displayed on the kart > "0" - "99" inclusive - the number that will be displayed > "random" (default) - random number assigned 2: STRING - the colour of the kart > "black" > "blue" > "green" > "orange" > "red" > "white" > "yellow" > "random" (default) 3: STRING - the logos to be displayed on the kart > "Bluking" > "Fuel" > "Redstone" > "Vrana" > "random" > "none" (default) 4: BOOL - spawn a drive in with the vehicle, false by default Usage: [getPos player, "75", "red", "none", true] execVM "spawn_kart.sqf"; Download: spawn_kart.sqf
  2. albertfish

    Spawn Kart Script

    Good idea. I might throw together a simple GUI to spawn them in on the fly.
  3. I believe the OP wanted to know if there was a way to get more information than what currentCommand returns.
  4. You have to break it down by each depth of the array. _array1 = purchase select 5; _array2 = _array1 select 6; _array3 = _array2 select 6; _array3 set [6, "0"]; _array2 set[6, _array3]; _array1 set[5, _array2]; Also, are you using addaction with these actions?
  5. Have you tried formatting the condition as a string? [((veh select 0) select 1),[2],"",-5,[["expression","nul=[1200, 'B_MBT_01_TUSK_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1","missionnamespace getvariable ['myvar','0']" ],
  6. What is your input? I think if the code you supply has an error, you will get this error report.
  7. albertfish

    UI Slider

    The function that is called on button press needs to check the slider value right? You should be able to use that code there to find the open dialog and then find the slider control for that dialog. Alternatively if the slider control has an event handler that is calling that function, _this select 0 should be the slider control. You can then use sliderPosition (_this select 0) to get the slider position from that control.
  8. albertfish

    Force showGPS

    You need to define idd entry. In the RscTitles is where you will define the dialog that you want to display. You were trying to create a dialog called RscMiniMap earlier. That dialog should be defined within the RscTitles class. You can add those three entries that I listed above to RscMiniMap, and then use cutRsc ["RscMiniMap", "PLAIN"];
  9. albertfish

    UI Slider

    You will need to use findDisplay, or store the dialog in a variable in the OnLoad event, to get the dialog. Once you find the dialog, you can get the slider control like so: _dialog = findDisplay DISPLAY_IDD; _slider = _dialog displayDtrl 17002; // The idc of the slider control _sliderPos = sliderPosition _slider;
  10. albertfish

    Force showGPS

    createDialog will block control of the player. Use cutRsc instead. When using this you will need to define your dialog class inside the RscTitles class inside the description.ext file. You will also need to define a couple more things in your dialog. fadein = 0; fadeout = 0; duration = 1e+011; If you set those values the dialog will be displayed for a long time.
  11. albertfish

    No entry?

    The duration value is the time in seconds the dialog will remain open. If the duration is 1 the dialog will close rather quickly. Try setting duration to a large number, like 1e+1000 as mentioned above.
  12. Good call. I thought it summed it up, but after checking I see that it does not.
  13. albertfish

    No entry?

    Since you are including this dialog in the RscTitles class it needs to have a few extra things defined. The error you are getting is telling you that in My_Dialog there is no duration member defined. In your My_Dialog class try putting fadein = 0; fadeout = 0; duration = 1;
  14. Although it would only be necessary to shuffle the array once. Since after you shuffle it, all of the elements are in a random order. Also, BIS_fnc_arrayShuffle returns the new sorted array, so you would have to store it. _numbers = _numbers call BIS_fnc_arrayShuffle. { // Do something with _x (the random number) } foreach ([1, 2, 3, 4, 5, 6, 7] call BIS_fnc_arrayShuffle) This would be a little bit more efficient.
  15. But from what the OP says, it looks like he wants each number to be unique. Your example can choose the same number more than once. For example: 1, 4, 5, 6, 2, 1, 6 If he wanted to have each number selected exactly once you would need an array. [1, 2, 3, 4, 5, 6, 7] Then using the array shuffle function you get the numbers in a random order, [4, 2, 3, 7, 5, 1, 7] The difference is that in the second example each number is unique.
  16. Are you modifying a mission, or are there not many other scripts running? Seems odd that the unit would gain health unless there is another script or event handler that is interfering. What ever you return from the event handler should be the damage the unit will take. If you return 0, the unit should not take any damage, making him invulnerable. This can allow you to do your own damage processing, wither have a variable keep track of the damage taken and kill the unit once it gets to a certain point, or use setDamage to set units damage. For example, you can keep track of the total damage taken so far in a variable, and use setDamage to set the unit's damage to that variable. Then return 0 so the unit does not take additional damage. This can allow you to control when the unit takes damage. This in conjunction with checking the selections could give you additional control. There is also a function setHit that will allow you to set the damage to a particular part. When uned on a body you can set damage to the legs, and once it gets to a certain threshold they can no longer run. You can also use this in the event handler to damage parts of the body without adding to the overall damage to the unit.
  17. That will return a random number between 1 and 7, but it seems like the OP wanted to have a loop iterate 7 times and each time choose a unique number between 1 and 7. In that case he would need an array.
  18. albertfish

    No entry?

    What is the rest of the error?
  19. Does the hint display? If it does you know for sure the event handler is triggering. You can try _x removeAllEventHandlers "HandleDamage"; before adding the event handler to make sure yours is the only one attached to the player. The issue with the HandleDamage event handler is that it is triggered multiple times for each time you take damage. If you look at the event handlers page you can see an example of this that I copied below: In the preceding example, the unit was shot two times. The event handler triggers for each body part hit. It also seems to trigger twice for overall damage (selection = "") and head damage (selection = "head"). The second time the overall damage triggers it seems to be a sum of total damage incurred thus far. When you return a value from the event handler, that is the damage the unit will take. So if you get shot in the head and take 1 damage to the head, and 1 damage to the body, the event handler will trigger 4 times. Twice for the head damage, and twice for the overall damage. The total damage you will take will be 4 * (1 * 0.05) = 0.2 damage. This does reduce the damage, but not by quite as much as you intend. If more body parts are affected, by and explosion for example, the event handler will trigger more times and your will take even more damage. You can check the selection type, and only allow damage when the selection type is "". This can give you a more accurate result, but it still wont be perfect.
  20. albertfish

    Help with variables

    %1 is used for formatting a string; it is a placeholder that gets replaced by the value of a variable. The is used in the format command. For example _var1 = 2; _var2 = 5; _string = format ["Var1 is equal to %1 and var 2 is equal to %2", _var1, _var2]; %1 is a placeholder that get replaced with the value of the first parameter following the format string. %2 gets replaced with the second parameter after the format string. The resulting variable _string will look like "Var1 is equal to 2 and var 2 is equal to 5". As far as veh_name, that just looks like an ordinary variable, presumably storing the name of a vehicle. Where did you come across this variable?
  21. Ah, got you now. I think he wanted the _heli variable to reference an actual helicopter so that is why your post confused me slightly.
  22. However, in that example would _this select 1 be the weapon that was fired and not the helicopter, as defined by the event handler? Also, glad you got everything working.
  23. I remember dealing with AI landing before and I would see it do some of these things in certain circumstances. The pilot will land when there is a large enough clearing, so if there are objects in the way it might not be able to find a landing zone properly. Another thing is when landing on a hill sometimes the AI would take off right after landing. This was something I noticed back in Arma 2, so I am not sure if it is the same currently. As far as the helicopter spawning in the air, when you use createVehicle, the "special" parameter should be set to NONE instead of FLY. FLY will spawn the helicopter in flight.
  24. I don't think that is it possible without using some sort of global variable. In the init.sqf of Iceman's example, the _this variable will be set by the event handler, and so _this select 0 refers to the unit that fired and _this select 1 refers to the weapon. Those two things are passed into the function TAG_fnc_Evac, but in that function it makes a reference to _this select 4 which is out of range since _this contains only two elements. You can use setVariable that may be nicer than using global variables. For example, _group_leader setVariable ["helipocter", _helipocter];. This way you can assign a variable in the variable space of the particular object. When the event handler triggers, you can check "helicopter" variable in the variable space of the unit that fired using getVariable. If that variable exists, you can do whatever you need to with it. For example, you can use this inside the event handler to get the helicopter: _helicopter = (_this select 0) getVariable "helicopter"; if (isNil "_helicopter") exitWith {}; Try something like this: EVAC_Heli_FiredEH = { if ((_this select 4) != "SmokeShell") exitWith {}; _heli = (_this select 0) getVariable "EVAC_Heli_Helicopter"; if (isNil "_heli") exitWith {}; _null = ([_this select 6, _heli]) spawn { _projectile = _this select 0; _heli = _this select 1; _posg = getPos _projectile ; sleep 0.5; while {(_posg distance (getPos _projectile )) > 0} do { _posg = getPos _projectile ; sleep 0.5; }; _heli sideChat "Smoke seen. Landing now"; }; }; EVAC_Heli_addEventHandler = { _helicaller = _this select 0; _heli = _this select 1; _helicaller setVariable ["EVAC_Heli_Helicopter", _heli]; _idx = _helicaller addEventHandler ["Fired", EVAC_Heli_FiredEH]; };
×