Jump to content

Recommended Posts

Hi everyone.

I have an ambitious, conceptual question. 
I would like to scare the pants off of my friends in a multiplayer mission.

My (ideal) technical aim is to have pre-placed corpses get up, then behave as regular AI (according to the popular Zombie mods eg Ravage).

Placing bodies is easy. Animating them to get up will probably require tedious custom animations, but is not impossible. The real question is how to assign AI to them. Or perhaps place them as AI with animations disabled, and untargetable by players (so players don't get wise when they look at them up close). 

Any thoughts?

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Melody_Mike said:

Animating them to get up will probably require tedious custom animations, but is not impossible.

 

Hello there Melody_Mike !

 

It's doable all this ,

you need to check the animations and then add a loop with a distance check in order to get up , as fo the target names , just play the game with this option disabled.

 

If i have time i'll try to add a code about it.

But you should give it a try.

  • Like 1

Share this post


Link to post
Share on other sites
17 hours ago, Melody_Mike said:

My (ideal) technical aim is to have pre-placed corpses get up, then behave as regular AI (according to the popular Zombie mods eg Ravage).


I can think of a few ways to do this that aren't too hard.  You can place live units in editor, and in their init field, spawn a little script that sets them unconscious true, waits a few seconds for them to fall down, then sets enableSimulation false on the units.  They will now look dead.    When players near you trigger them to enableSimulation true, and unconscious false.

 

Another way is to place the units, and in their init, setDamage 1 to kill them.   Then they will look better with various death physics positions on the ground.  When player is near, you trigger a script to spawn a live replacement unit that has the same face and loadout (including uniform, hat, glasses, etc) as the dead unit.  Delete the dead unit, and setpos the replacement unit as prone in same position and direction as dead unit.

 

You can get much of this spawn replacement unit code by looking at my Finger script here.

  • Like 4

Share this post


Link to post
Share on other sites

Thank y'all!

@GEORGE FLOROS GR Animations scare me :(! But I will try to find an appropriate "getting up" animation.

@johnnyboy Your solutions seem elegant, and read like they have been successfully tested. Because I would like the (zombie) AI to surprise the player up close, I think I will take the unconscious option. If this works works reliably in MP, perhaps use a starting pose in their init as well. 

Will report back on this. Appreciate the brainstorming.

  • Like 2

Share this post


Link to post
Share on other sites
21 hours ago, Melody_Mike said:

@GEORGE FLOROS GR Animations scare me :(! But I will try to find an appropriate "getting up" animation.

 

add this in the init of the unit that you want :

5 hours ago, pierremgi said:

if (isServer) then {this execVM "GF_Play_dead.sqf"}; 

 

// call{null=this execVM "GF_Play_dead.sqf"}; // edited corrected above

 

 

and add this file :

 

GF_Play_dead.sqf

GF_Wake_up_Distance 	= 10;	//	meters


GF_Play_dead = {

	params ["_unit"];
	
	[_unit,true]remoteExec["setUnconscious",_unit];
	[_unit,true]remoteExec["setCaptive",0];
	_unit spawn GF_Wake_up_Distance_Check;
	[_unit,false]remoteExec["allowDamage",_unit];
	
	systemchat "GF_Play_dead";
};

GF_Wake_up = {

	params ["_unit"];

	[_unit,false]remoteExec["setUnconscious",_unit];
	["#rev",1,_unit]remoteExecCall["BIS_fnc_reviveOnState",_unit];
	uisleep 1;
	[_unit,true]remoteExec["allowDamage",_unit];
	
	systemchat "GF_Wake_up";
};

GF_Wake_up_Distance_Check = {

	private _false = false;
	while{!_false}do{

		_allPlayers = allUnits select {isPlayer _x && {alive _x} && {!(_x isKindOf "HeadlessClient_F")}};
		if(isMultiplayer)then{

			if({_x distance _this < GF_Wake_up_Distance}count _allPlayers > 0)then{
				[_this] call GF_Wake_up;
				_false = true;
			};
		}else{
			if((_this distance player) < GF_Wake_up_Distance)then{
				[_this] call GF_Wake_up;
				_false = true;
			};
		};
		uisleep 3;
		systemchat "GF_Wake_up_Distance_Check";
	};
};


_this call GF_Play_dead;

 

Edited by GEORGE FLOROS GR
as @pierremgi said , if (isServer) then {this execVM "GF_Play_dead.sqf"};
  • Like 2

Share this post


Link to post
Share on other sites

George, the init file of a unit is not the best place in MP...

Tell me if I'm wrong, the code will run at each JIP, so you can experience these units fallen unconscious at each JIP (depending on players' distance).

On the other hand, your 2 first functions seem to me ready for MP, so I will just run the code on server:

if (isServer) then {this execVM "GF_Play_dead.sqf"};

 

My 2 cent question: is BIS_fnc_reviveOnState yet MP compatible, and then, no need to remote exec it?

 

 

  • Thanks 2

Share this post


Link to post
Share on other sites
5 hours ago, pierremgi said:

if (isServer) then {this execVM "GF_Play_dead.sqf"};

 

Thank you very much for the pointers !

To be honest i don't use almost at all the editor generally , so i didn't really think of that !

 

Might be a better solution running the code ?

I was first spawning the code in the initserver.sqf , like naming the unit in the editor and then spawn the code , ex:

g1 spawn GF_Play_dead;

 

and one more question that i don't remember ,

how to spawn a function in the init of the unit in the editor ?

- i have solved this issue in the past using :

waituntil{!isNil "GF_Play_dead";code<>};

but it's not working and i can't find the certain post to check it !

 

Thanks Pierre  !  :wave:

  • Like 1

Share this post


Link to post
Share on other sites

0 = [] spawn {waituntil{!isNil "GF_Play_dead"}; code<>}

Suspension is not allowed in init field.
The waitUntil must return a true/false boolean.
The init field must return nothing (the reason why 0 = spawned code)

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi everyone.

Sorry for the long wait. Life got in the way. 

I tested your script GF: it works fine in single- and multiplayer (player hosted). Here's a recording:

https://streamable.com/7ubmk

Notice how, even though I tried to vary the starting positions, all the AI characters get up in exactly the same, soldier-like manner.

Went digging through some popular zombie mods, and with Ryan's "Zombies and Demons", I got this:

https://streamable.com/gox1y


Note: extreme wimpiness in the face of the undead. But also the unique animations. Note that the AI scripts in this mod counteract the setUnconscious command.

My question has been answered. Hope others can use this information. Thanks for the input!

 

Share this post


Link to post
Share on other sites
52 minutes ago, Melody_Mike said:

PS anyone know how to embed videos into posts? 

Simply paste the youtube link into the post you are writing.  It will default to an embedded video (but allows you the option to make it an html link to the video instead).

Share this post


Link to post
Share on other sites

All, nice topic! We plan to implement such a feature into my survival/apocalypse mod. Will eagerly follow this topic until i lay hands on a Z raising feature myself. 

I ll be happy to help aswell once i get to it, or share my take on it. 

 

Cheers

Vd

Share this post


Link to post
Share on other sites

In a vaguely related answer........ one time, in the opening sequence, I wanted a few dead bodies lying around and so set the health to zero.

 

In testing,  I walked past them and one said to the other "enemy left"!

 

As a result, in the final mission, I made sure the player was out of earshot  and I got the result I wanted!  😀

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×