Jump to content

Recommended Posts

This is the scenario Im trying to create in my mission...

You have to defuse a carbomb like this...

3179rw2.jpg

Im trying to make it so the only way you can approach the car is to be crouched or prone and if not then the IED explodes! I need help getting up to the car if your prone or crouched it does not explode and if your standing it does explode! Simple IED scripts are no problem but this is abit difficult for me.

:confused:

Share this post


Link to post
Share on other sites

Writing the code to best explain the linearity and steps.

_boom = {
//explode script
};

_object addaction ["Defuse","defuse.sqf"];

_diffused = false;
while {not KRU_defused} do {
if ((velocity player) distance [0,0,0] > 0.9) then { //vector magnitude, ie speed of player
	[] call _boom;
};
if ((player call CBA_fnc_getAnimType) select 1 != "prone") then {
	[] call _boom;
};
};

defuse.sqf

KRU_defused = true;

There is some things missing, but should give you a rough idea.

Share this post


Link to post
Share on other sites

Ok, I know only the very basics of scripting, so I´ll need lots of help.

Here´s my first question:

How do I designate a group placed on the editor? Is it Group this or something?

Second:

How do I make a group placed on the editor appear only when a trigger is set off? Example: I want to create a huge army of enemies and in order not to overload the system, parts of the army are not present, but appear as reinforcements after a trigger is set off, like when half or 75% of the first groups are killed.

Can I make this with editor placed groups with waypoints set and all, all I would have to do is place something in the condition of presence field or something?

Third: How do I make the trigger? How do I make a condition that is set off after 50-75% of a designated group is killed. The same principle works with one person triggers I presume, that is in case of key officers getting killed when there is just one person that needs to get killed.

Thanks.

Share this post


Link to post
Share on other sites

Well, I probably won't be of much help, but here goes...

First Question:

I'm not totally sure as I haven't done it for a looong time! Might be something along the lines of:

Delta = group this;

Second Question:

Creating groups is not one of my fortes. I absolutely hate it, and there's always something I'm doing wrong! Anyway, here's a script somebody posted to me on an unrelated problem, but it might help you out. I can adapt it a little bit if you tell me what you want.

//nul = [<"GroupName">,<"Spawn">,<"Wp1">,<"Wp2">] execvm "spawn.sqf"

_grp = _this select 0;
_pos = _this select 1;
_wp1 = _this select 2;
_wp2 = _this select 3;

call compile format ["%1 = [getmarkerpos _pos, EAST, %2] call BIS_fnc_spawnGroup",_grp,["RU_Soldier","RU_Soldier2",]];

_grp = call compile format ["%1",_grp];

Sleep 3;

_waypoint0 = _grp addwaypoint [getmarkerpos _wp1,0];
_waypoint0 setWaypointType "move";
_waypoint0 setWaypointBehaviour "alert";
_waypoint0 setwaypointcombatmode "green";
_waypoint0 setWaypointSpeed "full";

_waypoint1 = _grp addwaypoint [getmarkerpos _wp2,0];
_waypoint1 setWaypointType "SAD";
_waypoint1 setWaypointBehaviour "combat";
_waypoint1 setWaypointformation "wedge";
_waypoint1 setwaypointcombatmode "red";
_waypoint1 setWaypointSpeed "normal"; 

Third Question:

You could try it with variables. Let's say we have a group of soldiers. Assuming a random amount have spawned, we'll first create a variable which manages how many units are in the group led by 'man1' to begin with:

_howMany = count [units group man1];

We'll then create a variable which keeps up-to-date with how many units are alive.

While {true} do {
    _howManyLeft = count [units group man1];
};

Next, in our trigger, we'll set the condition to:

_howManyLeft <= (_howMany / 4)

And finally, in the Activation of our trigger we'll call the enemy spawn script.

nul = [<"GroupName">,<"Spawn">,<"Wp1">,<"Wp2">] execvm "spawn.sqf";

Like I said, I can adapt and explain the spawn script to you if you like.

Hopefully that helped a bit. The scripting looks complicated but is really just utilising a few commands. I use the Wiki a lot. It helps with a lot of things. A LOT of things.

Share this post


Link to post
Share on other sites

count [units group player]

Surely you mean parenthesis, as this example would always return 1?

Edited by Mike84

Share this post


Link to post
Share on other sites
Ok, I know only the very basics of scripting, so I´ll need lots of help.

Here´s my first question:

How do I designate a group placed on the editor? Is it Group this or something?

Second:

How do I make a group placed on the editor appear only when a trigger is set off? Example: I want to create a huge army of enemies and in order not to overload the system, parts of the army are not present, but appear as reinforcements after a trigger is set off, like when half or 75% of the first groups are killed.

Can I make this with editor placed groups with waypoints set and all, all I would have to do is place something in the condition of presence field or something?

Third: How do I make the trigger? How do I make a condition that is set off after 50-75% of a designated group is killed. The same principle works with one person triggers I presume, that is in case of key officers getting killed when there is just one person that needs to get killed.

Thanks.

1.

myGroupName = group this;

http://community.bistudio.com/wiki/group

http://community.bistudio.com/wiki/this

2. I have a system for this, but it is by no means easy; your better off using spawned groups that generically patrol the area.

myGroup = [POSITION, SIDE, COUNT] call BIS_fnc_SpawnGroup

3. myCount = count units (group this);

In the trigger:

{alive _x} count myGroupName < myCount * 0.75

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  

×