Jump to content
Sign in to follow this  
Whitsel

Creating Random Surrender Trigger???

Recommended Posts

Okay, I have posted at about 4 different forums three times now and no one has answered this for me so I figured I'd try here once...

I am trying to create a trigger in which the unit(s) in it will surrender when conditions are met.

here's what I have for the on act.:

removeallweapons Grp1

Grp1 is the name of the opfor unit, just a single soldier

I put in the cond. line:

random 1 < 1

or

random 1 > 1

or random 1 <= 1 / random 1>= 1

and the damn guy nvr removes his weapons! I put:

random 1 < 0.1

and he'll wait a few seconds and do it EVERYTIME!!! Putting:

random 1 < 0.9 does the same thing! I am not sure what the hell the problem is but it nvr works right! what am I doing wrong!? Plz Help, very frustrated!

edit: also, I just tried changing the variable to like 0.001 and as I add more and more zeros the time untill he does the action lengthens???

Share this post


Link to post
Share on other sites

This belongs in the scripting forum.

That aside, I'm having trouble understanding what you are trying to achieve with those "random 1" statements.

For example:

"random 1 < 1" will always return true, because "random 1" will always return a number smaller than 1.

Because of this, "random 1 > 1" will always be false.

"random 1 < 0.1" and "random 1 < 0.9" should give it a 10% or 90% chance respectively. I just gave it a try and it seems to work as expected.

Share this post


Link to post
Share on other sites

Trigger:

okay, I just tried "random 1 < 0.1" -the 10%, right?

previewed the trigger ten times in-a-row and every time the opfor would perform the 'on act.' action. it did not fail once! So I am guessing there is something wrong with my trigger?

-its set to OPFOR, once, present.

Share this post


Link to post
Share on other sites

Could you provide a screenshot of the trigger setup? That would be very helpful, as it would show all settings in the trigger.

Share this post


Link to post
Share on other sites

I really dont think it's my trigger setup. I know I am new to scripting but I still think I have the random variables setup wrong. To make a unit(s) perform a trigger move set in the 'on act.' line about 50% of the time what would the condition line look like? ex.

I have this for on act.:

{removeallweapons _x} foreach thislist

and I want them to do this randomly about 50% or less of the time. I can setup all the other info later but to adapt around it I just have a trigger set to make the OPFOR unit peform the removeweapons command the second I preview the mission as he it directly in the trigger's center without any other conditions/activation commands. So just the exzact conition line with 50% random factor would be precisely what I need! Thanks again-

Share this post


Link to post
Share on other sites

I think this has to be done through a script.

to do a random I think you have to add in codes that wouldn't work in a trigger.

check this out too.

norrin surrender script

I think you can add in your units putting there hands on there head.

but if not. try this--not tested

testsurrender.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

if (random 1 < 0.1) then

{

removeallweapons this;

Sleep .5;

unit playmove "testsurrender";

unit disableAI "MOVE";

};

put the following line into all the players you want to have surrender, init line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

nul = [this] execVM "testsurrender.sqf"

Share this post


Link to post
Share on other sites
I really dont think it's my trigger setup.

It might be your trigger setup. If the trigger is constantly assessing ((random 1) < 0.1) then eventually it will become true. BTW you are using parenthesis in the condition right?

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  

×