Jump to content

Recommended Posts

Posted

Hi ED,
There is a trigger function "UNIT AI SET LIFE" in trigger interface.

But there is no LUA function "Unit:setLife() repertoried in Hoggitworld.
This function is very usefull for mission maker for scripting.

Can you add a lua function like

nullUnit.setLife(Class Self, number )
 

@ED : Where Number is hitpoint or percentage?
This function definitivly exist (she is on the trigger editor), car you give us an access in unit object ?

Ex :
local u = Unit.getByName("myUnit")

u:setLife(200)
u:setLifePercent(50)

Thanks you !

image.png

  • Like 2
Posted
11 minutes ago, BIGNEWY said:

Hi Kappa,

this has been requested before but currently there are no plans to add it sorry. 

thank you

Oh, it's a shame 😞 It will be very usefull (and the fact this function exist in triggers means the function already exists, it's just not implemented in the engine scripting, which shouldn't be a lot of work to add it!)

  • Like 2
  • 2 weeks later...
Posted

Please ED we need Unit.setLife(Class Self, number ) function , the trigger exist(unit ai set life)  already(the function exist for the trigger) , it can be implemented  , it would help a lot for mission editing/ability to simulate fragment explosion with script in a better way , ability to set mobility kill etc... it would make the game better🥰

 

  • Thanks 1

member of 06 MHR /  FENNEC Mi-24P

Posted (edited)

 This may be of use read DML Documetation -  "DML"    delicates.lua -  the strength is adjustable  -

Making clones “delicate” or “brittle” You can assign a Delicate Zone to the cloner with the useDelicates attribute. If you do so, the named Delicate Zone is used to assign delicate status to all clones, making them explode when they receive a tiny amount of damage. See Delicates module for more info.

delicates.lua

Edited by waterman
  • 1 month later...
Posted (edited)
On 10/11/2024 at 2:41 PM, BIGNEWY said:

I will mention it to the team again, but can not make any promises. 

Thanks 

Hi @BIGNEWY,
No return from ED's team about adding the lua function "Unit.setLife" to have the equivalant of the function in the trigger editor ?
 

 

One example of the necessities of having this function

I created a script so that helicopters are more effective in carrying out anti-ship missions, in order to allow helicopters to be able to engage medium ships such as Ropucha, La Combattante or Molnya. The goal of my script is to increase ship damage reasonably and proportionally to the missile used.

The script will bring additional damage to the ship depending on the explosive mass of the missile hitting it.
So, a Kamov's KH-25ML will do much more damage than a Vikhr, for example.
This script is based with a coefficient to adjust the damage you want : The higher the coefficient is, the stronger the additional explosion will be



The script

ShipDamageCoeff=4 --coeff : explosion damage multiplier
local eventhitArmedShip = {}
function eventhitArmedShip:onEvent(event)
    if event.id ~= 2 then return false end-- if event not a hit : exit
	if event.target == nil then return false end --If target is not exist (yet destroy) : exit
	if not event.target:hasAttribute("Heavy armed ships") then return false end--if target is not heavy ship : exit
	if not event.weapon then return false end-- if no weapon (ex: crash) : exit 
	if event.weapon:getDesc()["missileCategory"] == nil then return false end-- if not a missile : exit
	if event.initiator:getPlayerName()== nil then return false end --if initiator is not a player : exit
	if type(event.weapon:getDesc()["warhead"]["explosiveMass"]) == 'number' then --If the missile have data for explosiveMass 
		trigger.action.explosion(event.target:getPoint(),math.ceil(ShipDamageCoeff*event.weapon:getDesc()["warhead"]["explosiveMass"]))
	end
end
world.addEventHandler(eventhitArmedShip)

--ShipDamageCoeff= volumeExplosion / explosiveMass
--ShipDamageCoeff 4 : 4 * 46.2 (Kh25ML volume) = 278 expl

--explosiveMass
--FBA-500			-> 428
--SCUD				-> 395
--GBU-38			->  72
--Kh25ML			->  46.2
--AGM-65D Maverick	->  15.6
--AGM-65H Maverick	->  39
--AGM 114 Hellfire	->   5.67
--Vikhr				->   4
--HOT2				->   4.1
--ATAKA				->   7.4

--CLASS	PV
--Type 071 Amphibous	7300
--Kuznetsov				7000
--Kirov					6500
--Slava					5200
--Udaloï				3500
--Type 52C Destroyer	3200
--Ticonderoga			2700
--Type 52B Destroyer	2700
--Type 54A frigate		2500
--Admiral Gorshkov		2200
--Neustrashimy			2180
--Sovremenny			2100
--Arleigh Burke			2100
--Olivier Hazard Perry	2100
--Admiral Grigorovich	2000
--Ropucha				2000
--Krivak II				1800
--Steregushchy			1800
--Grisha				1600
--Patrol Ship			1500
--Karakourt				1200
--La Combattante Ila	 750
--Molnya				 700

 

I have make grids for evaluate the degat with KH-25L on many ships (Ropucha, Kuznetsov) to choice wich coefficient I want to use to propose reasonable damage : 

For example with a Ropucha Class
(Explosion : Volume explosion, PV = HP hitpoint, "PV restant" mean "remaining Hitpoint") :

dmg1

So a volume 200 explosion destroys 1/4 of a Ropucha's life. If I want a Ropucha sank with 3-4 KH-25ML, I must use a ratio that make one explosion of KH-25Ml make 200 explosion.

This is all the complexity that we have to take into account to be able to create a script to manage the damage without this very useful function that we all hope to have one day!!

 

Unfortunately, despite all my tests and calculations, I encountered a problem with my script: Explosion damage on ships is not IDENTICAL in singleplayer and multiplayer!

So, my entire damage grid tested in solo is no longer calibrated for multiplayer (it causes too much damage in multiplayer, and the boats sink too quickly with too little ammunition.
Having a function that would allow you to do a setter on the damage would make it possible to avoid encountering this type of problem where explosions do not cause the same volume of damage between SINGLEPLAYER and MULTIPLAYER.


This script is just an example.
I have many other scripts in mind where this function could be used effectively

So please ED, this function EXIST in the trigger editor, so technicaly she is already coded, we just want the equivalent on LUA. 

Edited by Kappa-131st
  • 1 month later...
  • 2 months later...
Posted
On 10/11/2024 at 2:41 PM, BIGNEWY said:

I will mention it to the team again, but can not make any promises. 

Thanks 

@BIGNEWY, have you any answer ? This feature is very important for all missionmaker who code in lua ! It is a very demanded feature, and the fact she exist in Trigger editor means the function exist somewhere. We just want an lua function to call the same function use in the trigger editor.
This is an easy way to please the DCS community.

Please insist,we must have it!

  • ED Team
Posted
Quote

@BIGNEWY, have you any answer ? This feature is very important for all missionmaker who code in lua ! It is a very demanded feature, and the fact she exist in Trigger editor means the function exist somewhere. We just want an lua function to call the same function use in the trigger editor.
This is an easy way to please the DCS community.



No sorry, it is not currently planned. I will keep pushing for it so thank you for the nudge. 

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, PIMAX Crystal

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...