Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Everything posted by Coucoul38

  1. Hi, I'm changing the player's vehicle with a script, and I want the turret of the new vehicle to face the same way as the old one did. Before changing the vehicle, I'm getting the old turret's aiming position with this: _turretDirection = eyePos vehicle _x; And to make the new turret rotate I tried this : _veh unitTurret(_x) lookAt _turretDirection; and this: _x lookAt _turretDirection; but it doesn't work.
  2. Thanks, this works perfectly. Do you know if it's possible to speed up the turret traverse so that it's almost instantaneous?
  3. Thanks, I got it to work perfectly 🤗
  4. I found this script to find the displayName form the className, but it doesn't seem to work with the mod Project RACS. I'm taking the displayNames from a list, and I want it to not call this function if I put the configName in the list instead of the displayName. So I want to check if the variable is actually the configName of a vehicle. Here's what I have right now, but I'm new and I have no idea how to search in the config, so it doesn't work: vehiclesList = ["M2A3","PRACS_M163_VADS"]; //Mix of displayName and configName _vehicleDisplayName = vehiclesList select _playerScore; //Check if the className is given if(count(_vehicleDisplayName configClasses (configFile >> "cfgVehicles"))!=0) then { //this is not working _vehicleClassName = _vehicleDisplayName; } else { _vehicleClassName = _vehicleDisplayName call fnc_g_findClassname; }
  5. Well I tried to do it, but it is not instantaneous, and most importantly the eyePos function actually returns the position of the optic ? So I need to find a function that returns the coordinates where the player is looking at. Either that or find a way to rotate the turret so that it aligns with a vector that I can get using this: eyeDirection vehicle _x
  6. Coucoul38

    From display name to classname

    Well thanks for the answer, but its not really what I'm looking for, I already have a killfeed displaying the names of the players and the killer's vehicle. What I'm trying to do is this: I have a list of vehicles, and I want to change the player's vehicle depending on his score : vehiclesList = ["M2A3","M1134"]; //CREATE new vehicle _vehicleDisplayName = vehiclesList select _playerScore; _vehicleClassName = _vehicleDisplayName call fnc_g_findClassname; _veh = _vehicleClassName createVehicle _vehPosition; _veh lock true; This is working, but it goes through all the config to find the className of the vehicles, so that's why I thought it was a good idea to use a hashMap, I just don't understand how I should set it up.
  7. Maybe this will work : _turretDirection = eyePos vehicle _x; // _x is the player
  8. Coucoul38

    From display name to classname

    Oh yeah, basically I'm making a gun game, but with vehicles, and I'm storing the displayName of the vehicles I want the players to get in a list. So each time the player gets a kill, it would go through the whole cfgVehicle to find the configName, so definitely not optimized. I will use a hashMap as you said, but could you please explain to me what these lines you shared here do exactly? Thanks for replying 🙏
  9. Coucoul38

    From display name to classname

    I have an issue. The mod rhsusaf adds a Stryker with a tow missile. The issue is, it has two variants with the same display name, and when I use this function, it return "rhsusf_stryker_m1134_base", but the two variants are "rhsusf_stryker_m1134_d" and "rhsusf_stryker_m1134_wd". Edit: I figured out, by changing the "select 0" to "select 1" on this line it works fine: if (count _findClassname > 0) exitWith {configName (_findClassname select 1)};
  10. This is perfect, took me some time to get it to work, cause I'm a noob but now its *almost* perfect. I just have an issue where when I kill multiple enemies at once (like with a grenade or bomb), the messages overlay each one another.
  11. Figured it out, it works just fine with the setDebriefingText function: if(isServer) then { unitKilled = { { _x addPlayerScores [2,0,0,0,0]; //Add 1 kill to the player (2 because killing a friendly is -1 (this is deathmatch, everybody is on the same side)) _playerScore = score _x; if (_playerScore == 2) then { "endDM" setDebriefingText ["End of match", name _x + " got 20 kills.", "Winner: " + name _x]; // this is the magic part "endDM" call BIS_fnc_endMission; // just end the match }; } forEach allPlayers; }; { _x addEventHandler ["killed", unitKilled]; } forEach allUnits; }; And the description doesn't need to be longer than this: class CfgDebriefing { class endDM { title = "End of game"; subtitle = "Someone got 20 kills."; pictureBackground = "credits.jpg"; }; }; title and subtitle will be overwritten by setDebriefingText, but are needed if you want the overwritten text to appear on the player's UI when ending the mission. Its kinda hard to explain so here's some screenshots : Without setting up the subtitle in CfgDebriefing: Subtitle in CfgDebriefing (it can be whatever you want, cause setDebriefingText will override it, you're just saying if you want it to display "in-game" or not😞 Note that in both cases, you will see the subtitle in this ending screen, even if not setting it up in CfgDebriefing : Maybe this will help someone someday...
  12. Edit : got it to work, solution in the post below Hi, I'm new to scripting (just started yesterday) and I'm trying to make a Deathmatch (Free For All, not in teams). I got everything to work, but now I'm trying to put the name of the winner in the debriefing and I can't get it to work. This forum post is the only information I could find, and idk if anybody's going to respond because its been 7 years, but here's what I did: This is my init.sql : if(isServer) then { unitKilled = { { _x addPlayerScores [2,0,0,0,0]; //Add 1 kill to the player (2 because killing a friendly is -1 (this is deathmatch, everybody is on the same side)) _playerScore = score _x; if (_playerScore == 2) then { missionnamespace setvariable ["winnerName", name _x]; //_myStringValue = missionNamespace getVariable "winnerName"; //hint _myStringValue; // This is working, and returns the player name "endDM" call BIS_fnc_endMission; }; } forEach allPlayers; }; { _x addEventHandler ["killed", unitKilled]; } forEach allUnits; }; As you can see, when a player reaches 2 kills, I pass his name to the missionNamespace "winnerName" before ending the mission. The hint is working as intended, and returns the player's name from the missionNamespace. However, when I'm trying to use it in my Description.ext, it doesn't work anymore: class CfgDebriefing { class endDM { variable = winnerName; title = "End of game"; //Line 25 subtitle = "Winner: "+variable; description = variable+" got 20 kills."; pictureBackground = "credits.jpg"; }; }; This basically doesn't work, giving me the following error: description.ext, line 25: 'CfgDebiefing/endDM.': '+' encountered instead of '='. Why can it not concatenate variable to another string ? I tried to do it before and store it in a variable, then saying "subtitle = subtitleText" but I get the same error. Trying to display "variable" with hint tells me it found 'v' instead of '='. I don't understand why its not working, because when I hint the value of the missionNamespace in init.sqf it works ! Apparently what fixed it for you was to update it in a while loop, but I can't do that because it only decides the winner at the end of the game ! Someone please help 😞