Jump to content
Sign in to follow this  
grzegorz87

random units or random action

Recommended Posts

Hi,

I'm new to this forum and I have the following question. I'm in the process of creating mission, MP, in a certain place is three people: cia1, cia2 and cia3. I'd like to do so each time you start the mission, only one appeared. I tried to zip the likelihood of the presence, but once there are two units and other times not at all. So that it will not work. This is needed for the random end of the mission, because each of them is assigned a different action script to completion. You could also do so from the beginning that there was one man and share scripts were random. So I have a question how to do that was simple and worked. Thank you in advance for your help.

ps Sorry for my poor English

Share this post


Link to post
Share on other sites

you can do so via:

_var = random 100; // generate random number from 0 - 100

// delete cia2, cia3 if 33 or less
if (_var < 34) then {
        {deletevehicle _x} foreach [cia2, cia3];
};

// delete cia1, cia3
if (_var > 33 && _var < 77) then {
        {deletevehicle _x} foreach [cia1, cia3];
};

// delete cia1, cia2
if (_var > 76) then {
        {deletevehicle _x} foreach [cia1, cia2];
};

use this inside the init.sqf

Share this post


Link to post
Share on other sites

execute it on the server only.

are cia1 - 3 playable units? or are they ai? if they are playable units, then its a different story.

Share this post


Link to post
Share on other sites

They are AI not playable units. I add this to init.sqf and work in editor and my server but when I start mission on dediceted server this remove cia1, cia2 and cia3.

Edited by wszystko_zielone

Share this post


Link to post
Share on other sites

How about this, if you paste it into init.sqf?

if isserver then {
 private ["_cias","_rand"];
 _cias = [cia1,cia2,cia3];
 _rand = floor random count _cias;
 _cias set [_rand,"SAVEDGUY"];
 _cias = _cias - ["SAVEDGUY"];
 {
   deletevehicle _x;
 } foreach _cias;
};

Share this post


Link to post
Share on other sites

tomorrow i try this :

place the 3 units cia1,cia2,cia3 far away from action game.

place an helipad invisible and named it "here" where You want to appear the unit.

create 3 trigger

1° trigger

condition: c1

inact: cia1 setpos getpos here

2° trigger

condition: c2

inact: cia2 setpos getpos here

3° trigger

condition: c3

inact: cia3 setpos getpos here

make this script

--------------------------------------------

_cia = random 2;

if (_cia >= 0 and _cia < 1) exitWith {c1 = true};

if (_cia >= 1 and _cia < 2) exitWith {c2 = true};

if (_cia >= 2 and _cia < 3) exitWith {c3 = true};

if (true) exitwith {};

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  

×