Jump to content

Recommended Posts

5 hours ago, doc. caliban said:

I would like to place a zombie in a building and have it not be active until triggered.  (or spawn it when triggered).

 

This is what I've come up with.

 

I have a single group of zombies that I place in buildings.  (I use the Eden Enhanced "garrison" feature.)  The group is named "ZedGroup".

 

In my init.sqf I have,

sleep .5;

{_x disableAI "MOVE"} forEach units ZedGroup;

 

Then I have a trigger around the building (or whatever size I see fit) that is activated by a player being present, with this in the On Activation:

_nearestZeds = player nearEntities ["Man", 10];
{_x enableAI "MOVE"} forEach _nearestZeds;

 

It works perfectly so far.  It doesn't matter if it catches any already active zombies in the detection radius since it doesn't affect their behavior.

 

This was the most cut-and-paste zombies and triggers with the least amount of tweaking per-instance that I could figure out.

 

The point was to have a "mopping up" phase of missions where you have to go into buildings where you hear zombies that won't come out on their own.  They stay in the structures until you enter the trigger and then they become active.

 

I'd love it if it could be set up that, when the trigger is activated, the zombies only become active if they detect you.  That way they stay in the structure until you activate the trigger, but they only get MOVE enabled if they see or hear you after that point.  The tough part there is that, as a group, they would all be aware of you... I'm not sure if "detected by" can be limited to a specific unit that detected you?  Or does it always affect that unit's entire side?

 

It might be nicer to have the zombies have a specific string in their variable, like bZed, and have the init.sqf apply the disableAI command to any unit with that string.  That way they don't have to be grouped.  I know that can be done with the "find" command... I'll see if I can figure that out.

Share this post


Link to post
Share on other sites
6 hours ago, doc. caliban said:

I would like to place a zombie in a building and have it not be active until triggered.  (or spawn it when triggered).

 

I have tried everything I can think of for making it inactive (disabling simulation, movement, hold waypoint, garrisoning, etc) but apparently everything I do is overridden at mission start and the zombie immediately wanders out of the building.

I'm guessing I could simply spawn one with a player present trigger, but not sure how to do that.  What would the on activation code look like?  Also, if I do it that way will it have the proper behavior even though it was spawned after mission init?

 

Thanks!


The good news is: it is possible. I managed to do something like this (not tested on dedi).

 

The bad news is: That was a few months ago, just before I left A3 (frustrated & angry), so I can‘t tell you exactly what to do.

 

What I remember is, that I added an EH to the Zombie Base Class. Every zombie spawned by Ravage (not manually placed by me) had a small chance of triggering a script:

- check position around Zed for nearest building

- if building present check for number of positions in buildings

- teleport Zed to random position in building

- deactivate Wandering Zombie behaviour for this zed 

 

I do not have the command for the last point available, but I remember that it wasn‘t too complicated. Maybe @haleks can help here?

I am on the move to a new adress, so it may take a week or two before I am able to look into my notes.

 

Whiteface / Oliver
 

 

edit: ah, that‘s the problem with posting from work. Didn‘t see your new post while typing my message.

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, whiteface73 said:

 

[...]

- deactivate Wandering Zombie behaviour for this zed 

 

I do not have the command for the last point available, but I remember that it wasn‘t too complicated. Maybe @haleks can help here?

 

Yep, that bit of code will do the trick :

_zed call {
	_this setDestination [getPosATL _this, "LEADER DIRECT", true];
	_this setVariable ["_active", false];
};

But the "_active" variable only works for agents - for hand-placed zombies, @doc. caliban came up with a good solution.

 

14 hours ago, doc. caliban said:

 

I'd love it if it could be set up that, when the trigger is activated, the zombies only become active if they detect you. 

 

You can ditch the trigger and tweak the init.sqf code like so :

sleep .5;
{
	_x disableAI "MOVE";
	_x spawn {
		waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"}};
		_this enableAI "MOVE"
	};
} forEach units ZedGroup;

Zombies will pour out of their building as soon as they spot any target. 😉 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites

Hey @haleks

 

I'd love if you could come into my Discord and have a chat. PM me and I'll send you the Discord 🙂

Share this post


Link to post
Share on other sites

Thank you so much, @haleks and @whiteface73!  I'll start trying to get that implemented today!

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, haleks said:

You can ditch the trigger and tweak the init.sqf code like so :


sleep .5;
{
	_x disableAI "MOVE";
	_x spawn {
		waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"}};
		_this enableAI "MOVE"
	};
} forEach units ZedGroup;

Zombies will pour out of their buildings as soon as they spot any target. 😉 

 

The code works as expected, but I would like to tweak it if possible. 

As it is, the units in ZedGroup maintain position until they have a target, but that can be gunfire from bandits, players, etc.  Is there a way to set it up so that they only respond to direct sight of a player? 

 

The idea being that the condition of every zombie is not identical and predictable.  Maybe some have crap hearing compared to others, or have something more wrong with them and require near-direct contact to get a response from, etc.  

 

Is there a way to test for a playable unit being the target and keying off of that?

 

Thank you again for the help!

 

EDIT: This may have been suggested before, but... could the run speed and walk speeds be randomized so that each type of zombie (runner or walker) has a slightly randomized max movement speed?  That would keep them from getting clumped up in groups and lines as they pursue targets. 

 

 

Share this post


Link to post
Share on other sites
On 2/4/2020 at 8:24 AM, haleks said:

You can ditch the trigger and tweak the init.sqf code like so :


sleep .5;
{
	_x disableAI "MOVE";
	_x spawn {
		waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"}};
		_this enableAI "MOVE"
	};
} forEach units ZedGroup;

Zombies will pour out of their building as soon as they spot any target. 😉 

Can I add the additional condition of the MP player being within a minimum distance?  That way a gunshot down the street won't trigger the enableAI "Move" line. 

 

I'd need to add something like {_x distance playableUnit <25} so that the MP player would have to be within 25m AND become a target.  Not sure how to do that.

 

Edit: {_this distance _zTarget <50} would probably be simpler.  I just don't know how to add it properly... I'm trying various synaxes...

 

Edit 2: I give up for now as the trial and error starts becoming a waste of time.  This is what I have and it seems like it should work, but I get an error saying it's missing a ; on the line testing for distance.  I've not done any scripting since early 2017 so I don't remember enough to understand where the problem is.

 

sleep .5;
{
    _x disableAI "MOVE";
    _x spawn {
        waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"}};
        waitUntil {sleep 1; true {_this distance _zTarget <30}};
        _this enableAI "MOVE"
    };
} forEach units ZedGroup;

 

Would love to solve this on my own, but I've blown over an hour dealing with a syntax error.  Not worth it.  😕

Share this post


Link to post
Share on other sites

@doc. caliban

 

Hand placed zeds in my Sirens mission (SP) have this in their init. (courtesy of haleks)  they all have various distance checks, some 15, some 5 etc.

this spawn { 
 _uStayThere = getpos _this; 
 while {alive _this} do { 
  sleep 1; 
  if (_this distance _uStayThere > 15 && isNil {_this getVariable "_zTarget"}) then { 
   _this doMove _uStayThere; 
   _this forceSpeed 2; 
  }; 
 }; 
};

Maybe it can give you something to riff off. 🙂

  • Like 2

Share this post


Link to post
Share on other sites

@doc. caliban, try this bit :

sleep .5;
{
	_x disableAI "MOVE";
	_x spawn {
		waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"} && {allPlayers findIf {_x distance _this < 30} != -1}};
		_this enableAI "MOVE"
	};
} forEach units ZedGroup;

The above will wake up zombies only if they have a target, and if a player is closer than 30 meters to said zombie. Player is not necessarily the target though - if that is what you want, you would go this way :

sleep .5;
{
	_x disableAI "MOVE";
	_x spawn {
		waitUntil {sleep 1; !isNil {_this getVariable "_zTarget"} && {isPlayer (_this getVariable "_zTarget")}};
		_this enableAI "MOVE"
	};
} forEach units ZedGroup;

 

  • Like 2

Share this post


Link to post
Share on other sites
58 minutes ago, Gunter Severloh said:

Hey Haleks and Ravage fans!

Check this new WIP mod, it uses Ravage as its base:

 

OPERATION COBALT: The Walking Dead Total Conversion

https://forums.bohemia.net/forums/topic/227847-operation-cobalt-the-walking-dead-total-conversion/

 

OMG THANK YOU!

 

@haleks I just want to say, that my mod would not have been possible without Ravage! Thank you for your amazing work! 😄

  • Like 4

Share this post


Link to post
Share on other sites

Hey there! Could somebody explain to me how i can distinguish between the Zombies and Renegades on a code basis? both are on the civilian side, so i cant do anything with that. Are they of a different group?

i am trying to create different "killed" eventhandlers for zombies and renegades...

Share this post


Link to post
Share on other sites

In the killed eventhandler, filter for killed/killer (depends on what you want to test):

 

If (_killer isequalto "zombie" ) then {....} ;

 

This executes your code if the killer is a zombie, or, if you want to apply the same to _killed, then it tells you if you killed a zombie. 

Share this post


Link to post
Share on other sites

Sorry, I guess i wasnt clear. I would like to have different eventhandlers for when the Zombie or Renegade is killed.

Something like that:

 

["CAManBase", "Killed", {
    params ["_unit"];
    
    if (side group _unit == civilian) then
    {    
        blablabla lots of code;
    } else { blablabla different code;};
}] call CBA_fnc_addClassEventHandler;

 

but for this to work, i need something to distinguish the Zombies from the Renegades in the if statement. anybody knows anything about this?

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

×