Forum Jump :

Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#1 Posted at 2017-06-04 23:38        
     
http://www.armaholic.com/page.php?id=14137&highlight=REMOVE%2BDEAD%2BSCRIPT

I have found this script in the A2 section and i was wondering if it can be changed to A3.
i am trying to make a intro and i want to remove the dead bodies and not the living ones after det intro.
so i can't use the {deleteVehicle _x} forEach thisList in a trigger area. But i have tried a kind off revive trigger but i can't get it to work the revive trigger was this {SetDamage 0 _x} forEach thisList but no joy..

anyone got an idea.

\\ L.Lysgaard

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#2 Posted at 2017-06-05 01:18        
     
Since the eden update we also got option build in to do this.
You can choose between timers for units and/or vehicles separately.
Also if you double click any unit you can choose to "delete when empty" (or better said, delete when dead).
AI won't just get deleted in front of the player if taken the last option.
So this is good if the player wants to loot some npc's for ammo or anything else.
Whenever you go into the options from the eden editor you can also set the delete timers for units.
Again it is gonna be tricky to set them 100% right to prevent what I've said above.

Being honest if I wer you I should first check if the "delete when empty" option does anything at all...
It sounds like it does everything you need.

Do not go where the path may lead, go instead where there is no path and leave a trail...

Advertisement


Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#3 Posted at 2017-06-05 12:02        
     
Well you are right the option is there but that is only for the group when they all die, but if only one is alive after the intro the group's dead bodies still remain.

But i can have done something wrong, if only one two of the group are killed the group remain on the map, and that is my plan but i want to have the dead ones removed so it looks like they have been taken to hospital or in for maintenance, trying to make a Westworld kind of map, the movie from 1973.

All the player does is flying by and all they can see and hear is a gn fight and the a BluFor team runs for a chinook and it lift off and flies away after it is out of view the plan was to remove all dead bodies and start the mission for the rescue team, (need to get the scientists out)

When the player start to play the mission i want the bodies to stay in game, my plan was to find a way to revive them in random order and random time, so the player have to go and take the weapons from the dead bodies, before they can move on.

This post was edited by L.Lysgaard (2017-06-05 12:23, 993 days ago)

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#4 Posted at 2017-06-05 12:35        
     
Well we do got...

while {true} do {
    {if (_x isKindOf "Man") then {sleep 30; deleteVehicle _x}} forEach allDead;
};

If you use this it checks all units if they are alive and deletes the ones that are dead.
However, shooting this trigger will lag the game in the same way as saving it.

Now we also still got another way of doing this a common tactic used in multiplayer...
add: ... to the init of any unit you want to be deleted once he died.
this addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];
Now you want to open you notepad and add this into it:
sleep 30;
hideBody _this;  //or hideBody _this select 0;
sleep 10;
deleteVehicle _this;
Save that as : removeBody.sqf

Now every time a unit dies who has the eventhandler in hes init, after 30sec hes body will being hided and afterwards deleted.
Also the equipment he was wearing including weapons who felt off him when he died...

https://www.youtube.com/watch?v=y3I56Y_522E
The video shows the above in action.

Added 8 minutes later:

# L.Lysgaard : When the player start to play the mission i want the bodies to stay in game, my plan was to find a way to revive them in random order and random time, so the player have to go and take the weapons from the dead bodies, before they can move on.
Whasn't in it while I said what I said above.
The thing with dead corpses staying in the game is that it does eat fps in the end just like anything else on the map.
But again you could leave a handful of dead corpses around without the init I told you about...
This will cause the ones that got the init to be deleted but the others will remain.

The script above deletes everything, and is only bound to being killed and the init it uses.

This post was edited by theo1143 (2017-06-05 12:44, 993 days ago)

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#5 Posted at 2017-06-05 13:14        
     
great script Theo

All i want is to make the Script run one time, since i am making a small game.
Can it be done by a trigger? Like when the flyby in intro is done and the helo flies in to a trigger.


(Coop 2 player, aprox 30 min playtime) my first game.

And if the script only runs one time i can put it in my kind of briefing that the robots have to reset, so there is not a lot going on in the game, it all happens on the island Porto.(not room for a lot of probs)

This post was edited by L.Lysgaard (2017-06-05 13:49, 993 days ago)

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#6 Posted at 2017-06-05 14:35        
     
The first one the laggy one can be put in a trigger so it only triggers once, yes.

But for the other they only trigger when a unit dies and then the script runs to hide and delete them.

In the vid you will see that any unit that gets killed will be deleted after 30 secs.
So in fact it only triggers once (per unit who has the init)

Everyone has hes own preference but I didn't like the lag spike hence why I use the other one.

So just as example:
1st: The heli flies into the trigger with : ... lags for about a sec and all dead units will be deleted
while {true} do {
    {if (_x isKindOf "Man") then {sleep 30; deleteVehicle _x}} forEach allDead;
};
second: you got 30 soldiers fighting where from 13 die, those 13 will be deleted after 30sec of them dying.
init...
this addEventHandler ['killed', {(_this select 0) execVM 'removeBody.sqf'}];
removeBody.sqf
sleep 30;
hideBody _this;  //or hideBody _this select 0;
sleep 10;
deleteVehicle _this;

SideNote, 30sec have to be 30secs for arma reasons... hahaha

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#7 Posted at 2017-06-05 14:50        
     
i did put your first script in a trigger, but when i shoot someone after the trigger have been activated it keeps running so all i kill in mission is deleted after 30 sec.
How do i stop the script again ?

I have approx 15 fighting on flyby and approx 6-8 dead in the end but i do not know which one it is so i have to put the EvntHandler in all 15. And then i still have the problem with the EventHandler still running when i start the mission and i fight the remaining soldiers, they will then also be deleted, or am i doing something wrong.

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#8 Posted at 2017-06-05 15:03        
     
# L.Lysgaard : i did put your first script in a trigger, but when i shoot someone after the trigger have been activated it keeps running so all i kill in mission is deleted after 30 sec.
How do i stop the script again ?

I have approx 15 fighting on flyby and approx 6-8 dead in the end but i do not know which one it is so i have to put the EvntHandler in all 15. And then i still have the problem with the EventHandler still running when i start the mission and i fight the remaining soldiers, they will then also be deleted, or am i doing something wrong.

That is right, and that is also the problem with the second script.
Since if you want units to stay dead on the ground you need to know which are gonna be the ones.

Have you tried the first one?
If you make it trigger once the player is on a black screen he won't notice the lag spike either.
Like what I mostly do when making missions is fade them in from a black screen.
So the game has time to set up the emotes at the units who stand right in front of the player.
Giving him the idea that they've always been there.

The thing is, first (it are both scripts) script checks the entire map for any dead units and will only trigger once.
Because it is checking ALL the units and not just the one like the other does it will lag for a mili second.
I really think you should use that one and just trial and error to get it synced up with you mission.
Mission making is all about smoke and mirrors being honest, goodluck!

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#9 Posted at 2017-06-05 15:13        
     
If i have like 50 approx on the map and i can just make the fight right were the helo flies by and then fire the trigger right after the flyby and then i can be done when player lands on the map.
The player have to land on a vessel (FFAA MOD) and get a briefing then a helo will pick player up and fly to PORTO for mission. In that time the script have to be finish with the checking.

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#10 Posted at 2017-06-05 15:17        
     
# L.Lysgaard : If i have like 50 approx on the map and i can just make the fight right were the helo flies by and then fire the trigger right after the flyby and then i can be done when player lands on the map.
The player have to land on a vessel (FFAA MOD) and get a briefing then a helo will pick player up and fly to PORTO for mission. In that time the script have to be finish with the checking.

Make a trigger where the player/heli lands, trigger 5by5by5 would do and add this in on activate.
while {true} do {
    {if (_x isKindOf "Man") then {sleep 30; deleteVehicle _x}} forEach allDead;
};
Once the heli picks the player up everything is already deleted and it won't trigger ever again.

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 43
Rank:


Level: Member

Country: dk
Location:
Occupation: Trucker
Age:
In-game name:

 
#11 Posted at 2017-06-05 19:26        
     
if i put the script in a file called bodyremove.sqf and does a execVM "bodyremove.sqf";

my text inside :

scipt start :
// remove dead bodies
// from game after intro

Sleep 3;
["Speaker", "ALL UNITS Will NOW RESET, REBOOTING SYSTEM"] spawn BIS_fnc_showSubtitle;


while {true} do {
{if (_x isKindOf "Man") then {sleep 3; deleteVehicle _x}} forEach allDead;
};

script end.

Will it still only run 1 time and not when player starts shooting enemies.

\\ L:Lysgaard

Added 29 minutes later:

Hi Theo

I tried to make it a SQF file and it keeps running not only once but all the time after it has been run, is there not a way to stop the script again.

i do get a error when i only put the script inside a trigger, but i guess it is because there is no more dead bodies to count?

This post was edited by L.Lysgaard (2017-06-05 22:44, 993 days ago)

It is better to burn out than fade away.

Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#12 Posted at 2017-06-06 00:21        
     
# L.Lysgaard : if i put the script in a file called bodyremove.sqf and does a execVM "bodyremove.sqf";

my text inside :

scipt start :
// remove dead bodies
// from game after intro

Sleep 3;
["Speaker", "ALL UNITS Will NOW RESET, REBOOTING SYSTEM"] spawn BIS_fnc_showSubtitle;


while {true} do {
{if (_x isKindOf "Man") then {sleep 3; deleteVehicle _x}} forEach allDead;
};

script end.

Will it still only run 1 time and not when player starts shooting enemies.

\\ L:Lysgaard

Added 29 minutes later:

Hi Theo

I tried to make it a SQF file and it keeps running not only once but all the time after it has been run, is there not a way to stop the script again.

i do get a error when i only put the script inside a trigger, but i guess it is because there is no more dead bodies to count?

Got a bit messy up, don't put it in a script because that will mess with it.
When you use this in a trigger forget about the sleeps because you only gonna trigger it once anyway.
In the script he will no matter what keep checking or you remove both sleeps and trigger the script only once.
For this you don't need the sleeps but for the other methode it is needed, that is the thing.
So just forget about that and put this in the trigger:
while {true} do { 
    {if (_x isKindOf "Man") then {deleteVehicle _x}} forEach allDead; 
};
Lag only happens if he has to delete a lot at once, and is pretty minor tho.
https://youtu.be/iJLLN5minYs
This is what I used in the video:
while {true} do {  
    {if (_x isKindOf "Man") then {deleteVehicle _x}} forEach allDead;  
};hint "txt (mostly for testing)"

I'm going to bed right now but if you want we can chat tomorrow to, goes a bit faster over steam.
http://steamcommunity.com/id/desperado070/

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 2
Rank:


Level: Member

Country: ru
Location: Saint-Petersburg
Occupation:
Age: 41
In-game name:

 
#13 Posted at 2017-06-17 03:54        
     
Hi,What do you think about? Correct me please:

private ["_salvage"];
player playMove "AinvPknlMstpSnonWnonDr_medic1";


getContainerItems = {
private _return = [];
{
_name = _x select 0;
_object = _x select 1;

_mags = magazinesAmmo _object;
_weaps = weaponsItems _object;
_items = itemCargo _object;
_containers = everyContainer _object;

_containers = if (_containers isEqualTo []) then {[]} else {_containers call getContainerItems};

_return pushBack [_name,_mags,_items,_weaps,_containers];

} foreach _this;
_return
};

_veh = cursorObject;
_top_mags = magazinesAmmoCargo _veh;

_top_weaps = weaponsItemsCargo _veh;

_top_items = itemCargo _veh;

_top_containers = everyContainer _veh;

_containers = if (_top_containers isEqualTo []) then {[]} else {_top_containers call getContainerItems};

return = [_top_mags,_top_items,_top_weaps,_top_containers];

sleep 10;
deleteVehicle (_this select 0);


Author Message


Posts: 46
Rank:


Level: Member

Country: nl
Location: Den Haag
Occupation: Mars or Pluto?
Age: 27
In-game name: Desperado070

 
#14 Posted at 2017-06-17 15:27        
     
# Spartanius :

The thing is he wants/wanted the AI to be randomly revived by each other, not by a human push on the button.
While in fact ... works pretty neat from the forum post about it, again it requires a player to push the button.
Or you gotta know which AI is gonna do what.

https://forums.bistudio.com/forums/topic/192120-reviving-dead-ai/


PLP_fnc_revive = {
	_pos = getPosATL _this ;
	_dir = getDir _this ;
	_type = typeOf _this ;
	_name = name _this ;
	_nameSound = nameSound _this ;
	_face = face _this ;
	_speaker = speaker _this ;
	_loadout = getUnitLoadout _this ;
	_wpnCargo = getWeaponCargo (_pos nearestObject "weaponHolderSimulated") ;
	
	deleteVehicle _this ;
	_group = createGroup side _this ;
	_unit = _group createUnit [_type,_pos,[],0,"CAN_COLLIDE"] ;
	_unit setDir _dir ;
	_unit switchMove "AmovPpneMstpSnonWnonDnon" ;
	_unit setUnitLoadout _loadout ;
	_unit addWeapon (_wpnCargo select 0 select 0) ;
	_unit setName _name ;
	_unit setNameSound _nameSound ;
	_unit setFace _face ;
	_unit setSpeaker _speaker ;
} ;

player addAction [
	"Revive him",
	{
		cursorTarget call PLP_fnc_revive ;
	},
	nil,1.5,true,true,"",
	"
		!alive cursorTarget and
		cursorTarget distance player < 5
	"
] ;

Do not go where the path may lead, go instead where there is no path and leave a trail...

Author Message


Posts: 2
Rank:


Level: Member

Country: ru
Location: Saint-Petersburg
Occupation:
Age: 41
In-game name:

 
#15 Posted at 2017-06-17 20:06        
     
Thanks for the reply, but I thought that this script will remove the vehicle, but it returns items from a container vehicle

private ["_salvage"];
player playMove "AinvPknlMstpSnonWnonDr_medic1";


getContainerItems = {
private _return = [];
{
_name = _x select 0;
_object = _x select 1;

_mags = magazinesAmmo _object;
_weaps = weaponsItems _object;
_items = itemCargo _object;
_containers = everyContainer _object;

_containers = if (_containers isEqualTo []) then {[]} else {_containers call getContainerItems};

_return pushBack [_name,_mags,_items,_weaps,_containers];

} foreach _this;
_return
};

_veh = cursorObject;
_top_mags = magazinesAmmoCargo _veh;

_top_weaps = weaponsItemsCargo _veh;

_top_items = itemCargo _veh;

_top_containers = everyContainer _veh;

_containers = if (_top_containers isEqualTo []) then {[]} else {_top_containers call getContainerItems};

return = [_top_mags,_top_items,_top_weaps,_top_containers];

sleep 10;
deleteVehicle (_this select 0);