Home   Help Search Login Register  

Author Topic: Deleting / activating areas  (Read 3126 times)

0 Members and 1 Guest are viewing this topic.

Offline Grimfist

  • Members
  • *
    • Armaholic
Deleting / activating areas
« on: 04 Sep 2009, 19:20:00 »
I have a few missions where i have the same base but 4 different areas to complete objectives, is it possible to have a whole big mission, with all target areas but only 1 area is active at each time, so when i have blew up the factory and killed the general in area 1, all the objects and ai disapeer and all the objects in area 2 apeer.

i am not sure if this is possible. sort of like evolution but not random patrols or objects, ones i have created in the editor. i had a look at the garbage collector module but im not sure what that does.

Thanks in advance, grimfist.

Offline sardaukar17

  • Members
  • *
Re: Deleting / activating areas
« Reply #1 on: 04 Sep 2009, 19:52:01 »
I have something set like what you are talking about. but all of my stuff is created through scripts and then assigned waypoints through the script. i a
 sure you could get the same result. I am not atm but ill post some stuff to maybe help when i get home... i warn you though it is all sqs scripts.

Offline Grimfist

  • Members
  • *
    • Armaholic
Re: Deleting / activating areas
« Reply #2 on: 04 Sep 2009, 19:59:44 »
does that include triggers and objects? if it does then:  :clap:

BUT im not to sure about scripts, ive wrote a few very small ones and changed variables to other peoples larger scripts so i hope it isnt to complicated.

ALSO RTE had an ' export as script' option in arma 1, ill have a look if the new arma 2 version has it - but  i dont want to create my mission again.

Offline sardaukar17

  • Members
  • *
Re: Deleting / activating areas
« Reply #3 on: 05 Sep 2009, 03:42:45 »
Well really there are no triggers unless you include the ones that just send messages like "Ememy Bunker has been destroyed" Those I have set up as triggers other than that it is all in script form. You should also know. I am new at this.. Only had like 2 months practice but I am learning really fast (atleast I would like to think so :P) There may be ways to shorten some of this stuff down a bit that I haven't discovered yet. Regardless take what I am saying in here with that in mind

Anyway what I am working on is centered around 3 cities each of which have to be taken in order which sounds like what your wanting to do. The key that finishes one city and moves to another is 3 buildings I call Bunker, Factory, and Tower. These objects can be replaced by any object you want. Say your General you want to assassinate or a vehical anything. When all 3 buildings are destroyed everything is moved to the Newcity. Lets start with MasterTimer.sqs:
Code: [Select]
;MASTER TIMER
?!(local Server): Goto "exit"

_bunker=_this select 0
_Factory=_this select 1
_Tower=_this select 2
buildings=[_bunker,_factory,_tower]

[Buildings] exec "Bunker.sqs"
[Buildings] exec "Factory.sqs"
[Buildings] exec "Tower.sqs"

[] exec "Infantry.sqs"
[] exec "Armor.sqs"
[] exec "Air.sqs"

#ReStart
Timer=901
publicVariable "Timer"

#Timer
~1
timer=timer-1
PublicVariable "timer"

_bunker=Buildings select 0
_Factory=Buildings select 1
_Tower=Buildings select 2

?(timer==900): goto "Infantry"
?(timer==600): goto "Armor"
?(timer==300): goto "Air"
?(timer<=0): goto "ReStart"
goto "timer"

#Infantry
?!(alive _Bunker):goto "Timer";
[] exec "infantry.sqs";
goto "timer"


#Armor
?!(alive _Factory):goto "Timer";
[] exec "Armor.sqs";
goto "timer"


#Air
?!(alive _Tower):goto "Timer";
[] exec "Air.sqs";
goto "timer"

The first thing that is done is the execution of the script MasterTimer which looks like this [Bunker, Factory,Tower] exec "MasterTimer.sqs". I execute it in the Init.sqs of the map.

There are several things that this script dictates. But all you really need to know is that it basically dictates when the other scripts are executed. You can see several in there. I will list them because these are the ones that I think are going to help you the most.
  • Infantry.sqs
  • Armor.sqs
  • Air.sqs
  • Bunker.sqs
  • Factory.sqs
  • Tower.sqs
The other things that is very important is that MASTERTIMER.sqs checks to see if the 3 buildings are alive. If any of the buildings are not alive it will not execute the scripts that create the types of units associated with that building. I'm sure you can guess that Infantry.sqs is associated with Bunker.sqs, Aromer:Factory, Air:Tower.
The Next script I want to show you is maybe not as important to what you want. But I liked it when you could only destroy a building in EVO by getting up close and personal and planting a satchel next to it. I'll just throw it in since this is going to be a huge post anyway.
Code: [Select]
;Bunker
~5
_bunker=buildings select 0

#loop
~1
_bunkerBomb = getPos _bunker nearestObject "pipeBomb"
_distB = _bunker distance _bunkerBomb
?!(isnull _bunkerBomb):goto "Wait"
_bunker setdamage 0
goto "loop"

#wait
~1
?(_distB>=10):goto "Loop"
?(isnull _bunkerBomb): _bunker setdamage 1
?!(alive _bunker): goto "exit"
goto "wait"

#exit
exit
The stuff your after is the 3 unit creation scripts. I don't think I should list all three. But if you want me to I can. I will just list Armor.sqs it has the most in common with the other 2.
Code: [Select]
;Armor
?!(local Server): Goto "exit"

_EastMax = East countside units
?(_eastmax >=60):goto "exit"



_Veh = createGroup east

#RandomStart
_rand0 = random 3
_Startnum = _rand0 - (_rand0 mod 1)
~1
?(_startnum==0):_randomstart=getmarkerpos "start1"
?(_startnum==1):_randomstart=getmarkerpos "start2"
?(_startnum==2):_randomstart=getmarkerpos "start3"
goto "RandomVehical"


#RandomVehical
_rand1 = random 5
_vehnum = _rand1 - (_rand1 mod 1)
~1
?(_vehnum==0):goto "Tanks"
?(_vehnum==1):goto "BMPs"
?(_vehnum==2):goto "LHTTanks"
?(_vehnum==3):goto "AAtanks"
?(_vehnum==4):goto "Wheeled"

#Tanks
_armor = createVehicle ["T90", _randomstart, [], 0, "none"]
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e1=this", 0.6, "major"];
e1 assignAsCommander _armor
e1 moveinCommander _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e2=this", 0.4, "private"];
e2 crew assignasdriver _armor
e2 moveindriver _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e3=this", 0.4, "private"];
e3 Assignasgunner _armor
e3 moveingunner _armor
~1
_armor = createVehicle ["T90", _randomstart, [], 0, "none"]
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e1=this", 0.6, "sergeant"];
e1 assignAsCommander _armor
e1 moveinCommander _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e2=this", 0.4, "private"];
e2 crew assignasdriver _armor
e2 moveindriver _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e3=this", 0.4, "private"];
e3 Assignasgunner _armor
e3 moveingunner _armor
[_veh] exec "waypoint.sqs"
goto "exit"

;-----------------------------------------------

#BMPs
_armor = createVehicle ["BMP3", _randomstart, [], 0, "none"]
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e1=this", 0.6, "major"];
e1 assignAsCommander _armor
e1 moveinCommander _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e2=this", 0.4, "private"];
e2 crew assignasdriver _armor
e2 moveindriver _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e3=this", 0.4, "private"];
e3 Assignasgunner _armor
e3 moveingunner _armor
~1
_armor = createVehicle ["BMP3", _randomstart, [], 0, "none"]
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e1=this", 0.6, "sergeant"];
e1 assignAsCommander _armor
e1 moveinCommander _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e2=this", 0.4, "private"];
e2 crew assignasdriver _armor
e2 moveindriver _armor
"RU_Soldier_Crew" createUnit [_randomstart, _veh,"e3=this", 0.4, "private"];
e3 Assignasgunner _armor
e3 moveingunner _armor
[_veh] exec "waypoint.sqs"
goto "exit"

Basically this script creates the actual Armor unit and the Crew that will be inside it. You can see that there is a section that randomizes what type of unit is created. I only listed 2 types of vehicals out of the list you can see in the "Random" section. Also at the very begining you can see that there are Random start positions. These are Markers on the map that I have placed. So each time a set of vehcials is created it will be in one of 3 random locations I have defined in the editor by markers. Looking back at the script again, when you get to the end of creation lines for each set of vehcials and thier crews you can see the [_veh] exec "Waypoint.sqs" That is our next script. This is the one that assign as many waypoints as you want to each group (_veh) of vehcials. This script takes the longest by far to set up in the editor beacuse I have 25 of them that can be randomly selected. I used GameLogics named wp1 all the way to wp25 in the editor and placed them in a pattern around and in the city I wanted. Here is the Script:
Code: [Select]
;Waypoint
?!(local Server): Goto "exit"

_veh=_this select 0

_wpnum=1
goto "Waypointmaster"


#WaypointMaster
_rand = random 25
_num = _rand - (_rand mod 1)
~1
?(_num==0):goto "Wp1"
?(_num==1):goto "WP2"
?(_num==2):goto "WP3"
?(_num==3):goto "WP4"
?(_num==4):goto "Wp5"
?(_num==5):goto "wp6"
?(_num==6):goto "wp7"
?(_num==7):goto "wp8"
?(_num==8):goto "wp9"
?(_num==9):goto "wp10"
?(_num==10):goto "wp11"
?(_num==11):goto "wp12"
?(_num==12):goto "wp13"
?(_num==13):goto "wp14"
?(_num==14):goto "wp15"
?(_num==15):goto "wp16"
?(_num==16):goto "wp17"
?(_num==17):goto "wp18"
?(_num==18):goto "wp19"
?(_num==19):goto "wp20"
?(_num==20):goto "wp21"
?(_num==21):goto "wp22"
?(_num==22):goto "wp23"
?(_num==23):goto "wp24"
?(_num==24):goto "wp25"

#wp1
_wp1 = _veh addWaypoint [wp1, _WPnum]
[wp1, _WPnum] setWaypointType "SAD"
[wp1, _WPnum] setwaypointBehaviour "SAFE"
[wp1, _WPnum] setwaypointcombatmode "RED"
[wp1, _WPnum] setWaypointSpeed "NORMAL"
goto "WpNumber"

#wp2
_wp2 = _veh addWaypoint [wp2, _WPnum]
[wp2, _WPnum] setWaypointType "SAD"
[wp2, _WPnum] setwaypointBehaviour "SAFE"
[wp2, _WPnum] setwaypointcombatmode "RED"
[wp2, _WPnum] setWaypointSpeed "NORMAL"
goto "WpNumber"

#wp3
_wp3 = _veh addWaypoint [wp3, _WPnum]
[wp3, _WPnum] setWaypointType "SAD"
[wp3, _WPnum] setwaypointBehaviour "SAFE"
[wp3, _WPnum] setwaypointcombatmode "RED"
[wp3, _WPnum] setWaypointSpeed "NORMAL"
goto "WpNumber"
;------------------------------------------------------
#Cycle

_wpnum=_wpnum+1
~1
wp26 = _veh addWaypoint [wp25, _WPnum]
[wp25, _wpnum] setWaypointType "CYCLE"

goto "exit"
;------------------------------------------------------

#WpNumber
_wpnum=_wpnum+1
~1
?(_wpnum==10):goto "exit"
goto "WayPointMaster"

#exit
exit
I shortened it up but you get the idea. It is important to note.. For reasons I cannot explain the Cycle waypoint does not work. Haven't figured it out yet. The last check at the end with "_wpNumber" is the setting on how many waypoints you want your units to have randomly assigned to them. The next script is the NEWCITY.sqs is the script that has the Main checks on the buildings and forces the moves from one city to another. I used again many more game logics to place everything where I wanted it. You can see the names in the script below. I kept it as simple as I could for my own benifit. Using that system worked for me and kept it easy. Just copy paste  :good:
Code: [Select]
;NewCity
?!(local Server): Goto "exit"

_Bunker = _this select 0
_Factory = _this select 1
_Tower = _this select 2
~1
buildings=[_Bunker, _Factory, _Tower]
Citycnt=1

#start
~1
_Bunker = buildings select 0
_Factory = buildings select 1
_Tower = buildings select 2

?!(alive _Bunker): Bunkerdead=true
publicVariable "Bunkerdead";
?!(alive _Factory): Factorydead=true
publicVariable "Factorydead";
?!(alive _Tower): Towerdead=true
publicVariable "Towerdead";
publicVariable "citycnt";
?((Bunkerdead)and(Factorydead)): goto "Towercheck"
goto "start"

#Towercheck
?(Towerdead): goto "CityCount"
goto "start"

#CityCount
?(citycnt==1):goto "City2"
?(citycnt==2):goto "City3"
?(citycnt==3):End=True
publicVariable "End";
goto "exit"


#city2
"Start1" setmarkerpos (getpos Start1loc_1)
"Start2" setmarkerpos (getpos Start2loc_1)
"Start3" setmarkerpos (getpos Start3loc_1)
"InfStart" setmarkerpos (getpos C2Bunkerloc)
"target" setmarkerpos (getpos wp25_1)
wp1 setpos (getpos wp1_1)
wp2 setpos (getpos wp2_1)
wp3 setpos (getpos wp3_1)
wp4 setpos (getpos wp4_1)
wp5 setpos (getpos wp5_1)
wp6 setpos (getpos wp6_1)
wp7 setpos (getpos wp7_1)
wp8 setpos (getpos wp8_1)
wp9 setpos (getpos wp9_1)
wp10 setpos (getpos wp10_1)
wp11 setpos (getpos wp11_1)
wp12 setpos (getpos wp12_1)
wp13 setpos (getpos wp13_1)
wp14 setpos (getpos wp14_1)
wp15 setpos (getpos wp15_1)
wp16 setpos (getpos wp16_1)
wp17 setpos (getpos wp17_1)
wp18 setpos (getpos wp18_1)
wp19 setpos (getpos wp19_1)
wp20 setpos (getpos wp20_1)
wp21 setpos (getpos wp21_1)
wp22 setpos (getpos wp22_1)
wp23 setpos (getpos wp23_1)
wp24 setpos (getpos wp24_1)
wp25 setpos (getpos wp25_1)
Awp1 setpos (getpos awp1_1)
Awp2 setpos (getpos awp2_1)
Awp3 setpos (getpos awp3_1)
Awp4 setpos (getpos Awp4_1)
factoryloc setpos (getpos C2factoryloc)
bunkerloc setpos (getpos c2bunkerloc)
Towerloc setpos (getpos c2Towerloc)

[] exec "Infantry.sqs"
[] exec "Armor.sqs"
[] exec "Air.sqs"
goto "respawn"


#city3
"Start1" setmarkerpos (getpos Start1loc_2)
"Start2" setmarkerpos (getpos Start2loc_2)
"Start3" setmarkerpos (getpos Start3loc_2)
"InfStart" setmarkerpos (getpos C3Bunkerloc)
"target" setmarkerpos (getpos wp25_2)
wp1 setpos (getpos wp1_2)
wp2 setpos (getpos wp2_2)
wp3 setpos (getpos wp3_2)
wp4 setpos (getpos wp4_2)
wp5 setpos (getpos wp5_2)
wp6 setpos (getpos wp6_2)
wp7 setpos (getpos wp7_2)
wp8 setpos (getpos wp8_2)
wp9 setpos (getpos wp9_2)
wp10 setpos (getpos wp10_2)
wp11 setpos (getpos wp11_2)
wp12 setpos (getpos wp12_2)
wp13 setpos (getpos wp13_2)
wp14 setpos (getpos wp14_2)
wp15 setpos (getpos wp15_2)
wp16 setpos (getpos wp16_2)
wp17 setpos (getpos wp17_2)
wp18 setpos (getpos wp18_2)
wp19 setpos (getpos wp19_2)
wp20 setpos (getpos wp20_2)
wp21 setpos (getpos wp21_2)
wp22 setpos (getpos wp22_2)
wp23 setpos (getpos wp23_2)
wp24 setpos (getpos wp24_2)
wp25 setpos (getpos wp25_2)
Awp1 setpos (getpos awp1_2)
Awp2 setpos (getpos awp2_2)
Awp3 setpos (getpos awp3_2)
Awp4 setpos (getpos Awp4_2)
factoryloc setpos (getpos C3factoryloc)
bunkerloc setpos (getpos c3bunkerloc)
Towerloc setpos (getpos c3Towerloc)

[] exec "Infantry.sqs"
[] exec "Armor.sqs"
[] exec "Air.sqs"
goto "respawn"

#respawn
~3
_Bunker = "RU_WarfareBBarracks" createVehicle getpos Bunkerloc
_Factory = "RU_WarfareBHeavyFactory" createvehicle getpos Factoryloc
_Tower = "RU_WarfareBAntiAirRadar" createvehicle getpos Towerloc
Buildings=[_Bunker,_Factory,_Tower];
Citycnt=citycnt+1
publicVariable "citycnt";

[Buildings] exec "Bunker.sqs"
[Buildings] exec "Factory.sqs"
[Buildings] exec "Air.sqs"
goto "MakeFalse"

#Makefalse
Bunkerdead=False
Factorydead=False
Towerdead=False
goto "start"


#exit
exit
This script makes sure the buildings are alive and when they aren't it keeps checking till all 3 buildings are dead. Then it hits the huge set of setpos commands. Each of those items are either markers or gamelogics. At the end it creates the new buildings names them _bunker,_factory,_tower and redefines them the Buildings array. This is what allows the whole process to start over in the new city. If you look back at the MASTERTIMER.sqs script in it's main loop it keeps pulling _bunker,_factory,_tower out of the Buildings array. So when the new ones are created it only takes 1 second for the master timer to have the new buildings. That buildings array has to be global array. At the end here.. If I haven't made a post that is bigger than allowed I will post the scripts in a folder in the full form. They are pretty raw and have a few ;;ed out sections of experiments but maybe my trials can help you.

On a side note. If anyone has any insight into the
Code: [Select]
_EastMax = East countside units
?(_eastmax >=60):goto "exit"
-EDIT- I got the Eastmax kind of figured out. it is a Total Unit maximum to not crash servers :D
Code: [Select]
_Unitmax= count allunits
?(_unitmax >=300):goto "exit"
and
Code: [Select]
;------------------------------------------------------
#Cycle

_wpnum=_wpnum+1
~1
_wp26 = _veh addWaypoint [wp25, _WPnum]
[wp25, _wpnum] setWaypointType "CYCLE"

goto "exit"
;------------------------------------------------------

sections of my work here then let me know. I am stumped on these. Grim I hope I was able to help. Not sure why I spent so much time but lol there it is. Be my guest. Its yours to use and abuse
« Last Edit: 07 Sep 2009, 05:41:13 by sardaukar17 »

Offline Grimfist

  • Members
  • *
    • Armaholic
Re: Deleting / activating areas
« Reply #4 on: 05 Sep 2009, 11:04:37 »
WOW, thanks - thats exactly what i needed by the sound of it, there is a bit there that just looks like  :scratch: to me but i can make out what its doing,  etc if i changed BMP with BTR and added more units in the cargo, changed some of the classnames etc (like ammo crate and a general and a AA tank).

i found your example mission in another thread, i just need to now edit it and put my units in.

but thanks really a lot.
« Last Edit: 05 Sep 2009, 13:52:24 by Grimfist »