-
07-21-2009, 08:28 AM #46
Re: The Scripting How-To Thread
The countdown is in seconds, so you'd need to set it to 7200 for two hours. You could set that trigger to true in the condition field, and it'd start counting at once.
Set it either as an END trigger, or put for example outOfTime = TRUE in the On Activation field and have that variable as a condition for some other trigger. You can only have one END#-trigger per end, but you can have an infinite amount of LOSE-triggers. So you could have the time-out trigger cause one mission failure, failing with the tasks causing another, and having the successful victory as your END#1 trigger.




-
07-21-2009, 11:36 AM #47
- Join Date
- Jun 2009
- Location
- Orlando, FL
- Posts
- 68
Re: The Scripting How-To Thread
I was trying to figure out how to get units to spawn parachuting on launch of the game and my code doesn't seem to work. I finally got it to stop with the syntax errors, but now just nothing happens. It's supposed to iterate through the units in a leader's group, create a parachute for all of them and place them in the parachute as driver.
The syntax may not be perfect since I'm not copying and pasting, I'm at work. And I shortened the case statements, there's more.Code:_osprey = this select 0; _leader = this select 1; _pos = objNull; { switch (_osprey) { case 0: { _pos = Osprey0; }; }; if (_pos) then { para = createVehicle ["Parachute", _pos, [], 0, "FLY"]; _x moveInDriver para; }else { exitWith {}; }; }foreach units _leader;
-
07-21-2009, 03:31 PM #48
- Join Date
- Jun 2007
- Posts
- 351
Re: The Scripting How-To Thread
Here's the code I have to spawn a para squad
spawnParaSquad.sqf
Code:if (isServer) then { _soldierClasses = ["RU_Soldier_SL", "RU_Soldier_AA", "RU_Soldier_GL", "RU_Soldier_GL", "RU_Soldier_AR", "RU_Soldier_AR", "RU_Soldier_Medic", "RU_Soldier_Marksman", "RU_Soldier_AT", "RU_Soldier_AT", "RU_Soldier", "RU_Soldier"]; _ranks = ["PRIVATE", "CORPORAL", "SERGEANT"]; _spawnPoints = ["VehSpawn1"]; _attack = "Attack"; _spread = 400; _maxSkill = .6; _grp = createGroup east; _wp = _grp addWaypoint [getMarkerPos "Attack", 0]; [_grp, 0] setWaypointType "SAD"; [_grp, 0] setWaypointCompletionRadius 400; [_grp, 0] setWaypointTimeout [500, 500, 500]; _currentSpawn = _spawnPoints select 0; for [{_x = 0},{_x < count _soldierClasses},{_x = _x + 1}] do { _currentSpawnPos = [(getMarkerPos _currentSpawn select 0) + (random _spread) - (_spread / 2), (getMarkerPos _currentSpawn select 1) + (random _spread) - (_spread / 2), 100]; _type = _soldierClasses select _x; _skill = random _maxSkill; _rank = _ranks select (round (random 2)); if (_x == 0) then { _rank = "LIEUTENANT"; }; _type createUnit [_currentSpawnPos, _grp, "", _skill, _rank]; }; for [{_x = 0},{_x < count _soldierClasses},{_x = _x + 1}] do { _currentSpawnPos = [(getMarkerPos "Attack" select 0) + (random _spread) - (_spread / 2), (getMarkerPos "Attack" select 1) + (random _spread) - (_spread / 2), 100]; _para = "ParachuteEast" createVehicle _currentSpawnPos; _para setPos _currentSpawnPos; (units _grp select _x) moveInDriver _para; }; _grp allowFleeing 0; _allUnits = units _grp; waitUntil { {alive _x} count _allUnits == 0 }; sleep 60; { deleteVehicle _x; } foreach _allUnits; waitUntil { count units _grp == 0 }; deleteGroup _grp; };---Bellicosity---

-
07-21-2009, 04:02 PM #49
- Join Date
- Jun 2009
- Location
- Orlando, FL
- Posts
- 68
Re: The Scripting How-To Thread
With mine I was hoping I would be able to create the groups in the editor so all group generation and variation could be done there and then just have a script that ran across a group putting them in the air. But when I get back home I'll go through your script try it in my mission then see if I can change it to work how I originally wanted it. If it just can't work the way I want it, I guess I'll have to go with it that way.
-
07-21-2009, 04:16 PM #50
Re: The Scripting How-To Thread
One thing that caught my eye, among other things, was this:
That won't work unless _leader is a group, which it isn't judging by your post. forEach only works on an array of units, so we have to give it one:Code:foreach units _leader
Code:forEach units group _leader
-
07-21-2009, 08:01 PM #51
- Join Date
- Jun 2009
- Location
- Orlando, FL
- Posts
- 68
-
07-22-2009, 04:59 AM #52
Re: The Scripting How-To Thread
Yeah you're right and I stand corrected. It really should accept a unit too as input according to the comref.
-
07-22-2009, 08:42 PM #53
Re: The Scripting How-To Thread
Stupic question time... What is a Civ respawn called?
I thought it was Respawn_Civ but clearly it is not as my civ respawns at Respawn_East when he is a neutral...
Is it Respawn_Civilian?BlackDog1





"What we do in life... echoes in eternity!"
-
07-23-2009, 01:19 AM #54
- Join Date
- Jun 2009
- Location
- Orlando, FL
- Posts
- 68
Re: The Scripting How-To Thread
Not exactly a scripting issue, but how do you make the AI drive better? More waypoints, less waypoints? I'm trying to put together a mission where it starts with the players being driven somewhere(want it to be out of their control) but the damn AI keeps running off the road and into trees and weaving and just making a whole mess of this vehicle column I'm trying to have...
-
07-23-2009, 01:52 AM #55
- Join Date
- Jun 2007
- Posts
- 351
Re: The Scripting How-To Thread
I've heard if you put only one vehicle in the convoy it drives better
Not tested---Bellicosity---

-
07-24-2009, 02:56 AM #56
- Join Date
- Jun 2009
- Location
- Orlando, FL
- Posts
- 68
Re: The Scripting How-To Thread
They do seem to drive better when not grouped with other vehicles... They still suck, but that's probably just the bad pathfinding.
-
07-24-2009, 03:59 AM #57
- Join Date
- Jun 2005
- Posts
- 126
Re: The Scripting How-To Thread
@Blackdog: respawn_civilian
http://community.bistudio.com/wiki/D...on.ext#Respawn...The most dangerous thing on a battlefield is an officer with a map.
-
07-24-2009, 02:52 PM #58
Re: The Scripting How-To Thread
Yep ta Vic, found that yesterday.
Cheers
BD1BlackDog1





"What we do in life... echoes in eternity!"
-
07-26-2009, 02:30 PM #59
- Join Date
- Jan 2006
- Location
- I jump between Maine and Trier, Germany
- Age
- 26
- Posts
- 2,134
Re: The Scripting How-To Thread
How do you make it so a vehicle burns for a set period of time instead of just setting the damage to 1 and letting it burn out?




-
07-26-2009, 07:34 PM #60
Re: The Scripting How-To Thread
Not sure if you can change that when a vehicle is already burning, but you could try to do a VehicleName setFuel 0 when you want it to stop. How long a vehicle burns is supposedly depending on how much fuel it had when it was destroyed. If some variant of this doesn't work I don't have a clue.





Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)




Reply With Quote

Bookmarks