BeerBoz 0 Posted March 6 I trying to do a scoresystem with the help of ChatGPT, Im not a programmer at all. But why does'nt this works, I want scorepoints to popup at the hitpoint, but nothing happends? I trying to achiev this by using "BIS_fnc_dynamicText" All this goes into init.sqf // Define the private layer ID private _layerid = "scoreLayer" call BIS_fnc_rscLayer; // Create dynamic text for the score { // Add an event handler for damage for each unit _x setVariable ["someVarName", _x addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint", "_directHit", "_context"]; // Define score values for different hit points private _scoreHead = 50; private _scoreTorso = 20; private _scoreLegs = 10; // Calculate score based on hit point private _score = switch (_selection) do { case "head": { _scoreHead }; case "body": { _scoreTorso }; case "legs": { _scoreLegs }; default { 0 }; // No score if hit is not in head, torso, or legs }; // Add the score to the unit's total score if (isPlayer _instigator) then { private _playerScore = _instigator getVariable ["playerScore", 0]; _instigator setVariable ["playerScore", _playerScore + _score, true]; }; // Display the score at the hit point using BIS_fnc_dynamicText private _scoreText = format ["+%1", _score]; private _hitPos = _unit selectionPosition _selection; private _Pos = _unit modelToWorldVisual _hitPos; // Display dynamic text with the score on the private layer [_scoreText, 0.5, 0.5, 1, 1, <0, _layerid] spawn BIS_fnc_dynamicText; // Show a hint with information about the hit hint format ["You hit %1 on %2, causing %3 damage", name _unit, _selection, _score]; // Clear memory _score = nil; _scoreHead = nil; _scoreTorso = nil; _scoreLegs = nil; _scoreText = nil; }] }] forEach allUnits; Share this post Link to post Share on other sites
mrcurry 496 Posted March 7 On 3/6/2024 at 10:57 AM, BeerBoz said: with the help of ChatGPT In short: don't. LLM's doesn't understand the code they write. At best this means they are unable to fix it unless you explicitly state what's wrong. At worst they introduce hard to spot bugs and/or security issues. On top of that you have implicit ownership of, and responsibility for, things you create. No matter which tools you use. If your shit hits the fan it's your responsibility to clean up the mess so you must either understand it or have access to someone who does. If you wish to learn code I'd happily help. There are plenty of resources online, read existing code examples and ask on these forums. If you want something coding related done either do it yourself or ask someone competent like over on the scripting request subforum. LLMs probably have their place in programming but that place is not (yet) helping non-programmers, that's like the blind leading the deaf. 1 Share this post Link to post Share on other sites