Jump to content
Sign in to follow this  
jamez_5

!Alive commands and stamina

Recommended Posts

Hey people, hope all is well. For starters I am pretty new at editing but Eden is too fun to not give it a chance. I am currently making a defend mission. I understand when making a task that I want to end when (guy1 and guy2) dies. 

 

!alive guy1 && !alive guy2;

 

What if I have 22 people? Currently I am just having the code you see above;however all the way to 22. But i do notice I can put a callsign on groups. Can I set !alive commands for groups/callsigns if possible? 

 

Also any tips on defend missions would be great also. I was going to use a trigger saying IF opfor NOT present pass; however, at the beginning of the mission there is no opfor in the circle, they come in from different angles. Woth them not starting in the circle it would show you passing all the task. 

 

Stamina:

I noticed with Eden there is a check box under the player attriburtes that say enable stamina. No matter if it is checked or not all players except the main player has stamina. I also tried using the command player enableStamina false;  This does not work either.

 

Thanks in advance.   

Share this post


Link to post
Share on other sites

What are those 22 "guys" ? Players, ai or what?.

 

Stamina is local and need to be executed on every player.

player enableStamina false;

Share this post


Link to post
Share on other sites

thanks for the fast response. the 22 guys are AI. basically each wave is 22 AI enemies. So instead of:

 

!alive g1 && !alive g2 && !alive g3 && !alive g4 && !alive g5 && !alive g6 && !alive g7 && !alive g8 && !alive g10 &&
!alive g11 && !alive g12 && !alive g13 && !alive g14 && !alive g15 && !alive g16 && !alive g16 && !alive g18 && !alive g19 && !alive g20 &&
!alive g21 && !alive g22;
I could have just one code that covers all. 
 
Also i did put that code in every player and it still did not work. Only for the player/playable character. Not that other playable characters. 

Share this post


Link to post
Share on other sites

Unless you use a script outside of the editor I think you'll have to stick with using the 21 ands (which shouldn't be a problem, it just looks ugly). The stamina part depends on what type of mission you're creating. Do you have respawns for the player? Is it a single player or multiplayer mission? If there are no respawns for the player (single or multiplayer) then putting "player enableStamina false;" in the init field (without the quotes) of every playable unit will disable stamina. If there are respawns in a single player game, then put this in the init field of the playable unit: 

player enableStamina false;
this addEventHandler["respawn",{player enableStamina false;}];

If this is a multiplayer game with respawns then put this in the init field of every playable unit:

player enableStamina false;
this addMPEventHandler["mprespawn",{player enableStamina false;}];

I know this works because I just solved this issue for myself a couple hours ago :)

Share this post


Link to post
Share on other sites

I'm not sure if this would work since I'm at work :( and would need to test it, but could you check the count of the group?

 

You could name the squad leader Dave

_group = group Dave;
if (count _group isEqualTo 0) then {...};

Share this post


Link to post
Share on other sites

Unless you use a script outside of the editor I think you'll have to stick with using the 21 ands (which shouldn't be a problem, it just looks ugly). The stamina part depends on what type of mission you're creating. Do you have respawns for the player? Is it a single player or multiplayer mission? If there are no respawns for the player (single or multiplayer) then putting "player enableStamina false;" in the init field (without the quotes) of every playable unit will disable stamina. If there are respawns in a single player game, then put this in the init field of the playable unit: 

player enableStamina false;
this addEventHandler["respawn",{player enableStamina false;}];

If this is a multiplayer game with respawns then put this in the init field of every playable unit:

player enableStamina false;
this addMPEventHandler["mprespawn",{player enableStamina false;}];

I know this works because I just solved this issue for myself a couple hours ago :)

I think you could also just put it in the initPlayerLocal.sqf right?

Share this post


Link to post
Share on other sites

I think you could also just put it in the initPlayerLocal.sqf right?

It looks like it!

 

I'm glad you mentioned that. The init boxes are great for getting started, but it makes your code less portable between different missions. Looks like I have some more editing to do ;)

 

EDIT: Now that I think about it, I'm not sure how initPlayerLocal.sqf would work with the event handler. I guess it depends on when the script actually runs, and what "this" would be referring to.

Share this post


Link to post
Share on other sites

I'm not too familiar with event handlers, but couldn't you just put 'player'? Or does 'this' have to refer to the actual soldier object?

Share this post


Link to post
Share on other sites

I'm not too familiar with event handlers, but couldn't you just put 'player'? Or does 'this' have to refer to the actual soldier object?

I know that in the init field of a unit in the editor you must use "this". So I guess you're attaching the event handler to the actual model itself.

 

EDIT: I checked. You do use player in initPlayerLocal.sqf.

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
Sign in to follow this  

×