|
Post by Jagged Steel on Jun 10, 2010 17:43:50 GMT 1
Thanks Dan. Would a "correct" method to make the weather stay in a certain state require first switching the "Auto" weather off using Switch weather Automatic(0)?, and then using SwitchWeather(1)? The script as it now stands functions just fine, but simpler is generally better, so if I could eliminate a couple of functions I might change that.
The way that I understand the "FlagReinforcement" function is this:
*It will "run" every cycle, checking the current Flag Point score for each player. IF the Flag Point score for either player has increased by 150 points AND the player for which this is true holds at least 1 flag, THEN the functions following the "FlagReinforcement" will run. In the case of the Block you posted, the function will run 100 ms(next cycle?) after each time it has been triggered(by the 150 Flag Point check). In the cases posted like the LostVictory script, the function that is run is a very elaborate random "LandReinforcement" that is limited by a total units check.
What I am going to try is to replace this random reinforcement function with one that will add to a Variable, followed by another function checking the value of this Variable, which will trigger at preset values, which will then run a LandReinforcement function.
|
|
|
Post by danzig70 on Jun 10, 2010 18:25:37 GMT 1
Thanks Dan. Would a "correct" method to make the weather stay in a certain state require first switching the "Auto" weather off using Switch weather Automatic(0)?, and then using SwitchWeather(1)? The script as it now stands functions just fine, but simpler is generally better, so if I could eliminate a couple of functions I might change that. The way that I understand the "FlagReinforcement" function is this: *It will "run" every cycle, checking the current Flag Point score for each player. IF the Flag Point score for either player has increased by 150 points AND the player for which this is true holds at least 1 flag, THEN the functions following the "FlagReinforcement" will run. In the case of the Block you posted, the function will run 100 ms(next cycle?) after each time it has been triggered(by the 150 Flag Point check). In the cases posted like the LostVictory script, the function that is run is a very elaborate random "LandReinforcement" that is limited by a total units check. What I am going to try is to replace this random reinforcement function with one that will add to a Variable, followed by another function checking the value of this Variable, which will trigger at preset values, which will then run a LandReinforcement function. I use this for good weather at night: ChangeWarFog (2); SwitchWeather (0); SwitchWeatherAutomatic (0); or for bad weather: ChangeWarFog (2); SwitchWeather (1); SwitchWeatherAutomatic (0); The changewarfog is optional of course and can be left out or commented out for day time missions. Also, I updated my earlier post with Timer function. I try to minimize the functions called in the init function. After 30 minutes or so, I can call another function to change it to day by changing the war fog. I usually put this in my StartGame function that is called first. I dont understand the points associated with CTF missions. I will test it this weekend. What are the requirements you want for reinforcements? Could you make script areas encompassing the flags and check for opponent units and player units? Can you make the map available for testing?
|
|
|
Post by danzig70 on Jun 10, 2010 18:38:31 GMT 1
Actually I have a scripting question also.
I want to move the camera view at the beginning of the mission. It starts in position1, then moves to position2 to witness an event, then moves to position3 which is near the drop zone, then finally to the position4, the drop zone.
Its for my Eben Emael mission. I have a pretty cool Hollywood scene where a glider crashes in the woods. The funny part is that when the troops get out of the plane and away from it, it explodes. A motorless aircraft unexplicably explodes. I will take this out of the final version, but it is funny to watch.
The script is below. I tried using ViewZone but that only illuminates the area, doesnt move the camera.
function StartGame() DisplayTrace ("Assault on Fortress Eben Emael, 4:30 AM May 10, 1940"); Password("Panzerklein"); -- ViewZone ("scene1", 1); ShowActiveScripts (); ChangeWarFog (2); SwitchWeather (0); SwitchWeatherAutomatic (0); DisableAviation (1,-1); RunScript("TreesDown1", 1000) Suicide(); end;
function MissionTimer() local minutes, seconds; minutes = GetIGlobalVar("TimerMinutes", 0); seconds = (10 + GetIGlobalVar("TimerSeconds", 0)); if(seconds == 60) then seconds = 0; minutes = 1 + minutes; SetIGlobalVar("TimerMinutes", minutes); end; SetIGlobalVar("TimerSeconds", seconds); -- if(seconds == 0) then -- DisplayTrace("Mission Time: %g:00", minutes, seconds); -- else -- DisplayTrace("Mission Time: %g:%g", minutes, seconds); -- end; end;
function TreesDown1() if (GetIGlobalVar ("TimerSeconds", 0) == 10) then -- ViewZone ("scene2", 1) DamageObject (2000, 0); RunScript("TreesDown2", 500); Suicide(); end; end;
function TreesDown2() DamageObject (2001, 0); RunScript("TreesDown3", 500); Suicide(); end;
function TreesDown3() DamageObject (2002, 0); RunScript("TreesDown4", 500); Suicide(); end;
function TreesDown4() DamageObject (2003, 0); RunScript("TreesDown5", 500); Suicide(); end;
function TreesDown5() DamageObject (2004, 0); LandReinforcement (1); RunScript("GliderGone", 1000); RunScript("LandingZone", 1000); DisplayTrace ("One of our gliders has crashed!"); Suicide(); end;
function GliderGone() if (GetNScriptUnitsInArea (2, "crashsite") == 0) then DamageObject (1, 0); Suicide(); end; end;
function LandingZone() -- ViewZone ("scene2", 0) LandReinforcement (3); LandReinforcement (4); LandReinforcement (5); LandReinforcement (6); LandReinforcement (7); LandReinforcement (8); LandReinforcement (9); LandReinforcement (10); LandReinforcement (11); RunScript("SoundAlarm", 1000); Suicide(); end;
function SoundAlarm() Cmd (6, 1010, 1011); Cmd (6, 1021, 1020); Cmd (6, 1031,1030); Cmd (6, 1041,1040); Cmd (6, 1051,1050); Cmd (6, 1061,1060); Cmd (6, 1071,1070); Suicide(); end;
function DayTime() if (GetIGlobalVar ("TimerMinutes", 0) == 30) then ChangeWarFog (0); Suicide(); end; end;
function ShapeCharge1() if (GetNScriptUnitsInArea (81, "ShapeCharge1") >= 1) then DamageObject (2006, 0); Suicide(); end; end;
function ParaTroops() if (GetIGlobalVar ("TimerMinutes", 0) == 20) then Cmd(22, 1002, 1, 11863, 15359); Suicide(); end; end;
function Init() RunScript( "StartGame", 1000); RunScript( "MissionTimer", 10000); RunScript( "DayTime", 1000); RunScript( "ShapeCharge1", 1000); -- RunScript( "ParaTroops", 30000); end;
|
|
runrum
Zastavnik 1. klase
Posts: 85
|
Post by runrum on Jun 10, 2010 20:30:58 GMT 1
Actually I have a scripting question also. I want to move the camera view at the beginning of the mission. It starts in position1, then moves to position2 to witness an event, then moves to position3 which is near the drop zone, then finally to the position4, the drop zone. Its for my Eben Emael mission. I have a pretty cool Hollywood scene where a glider crashes in the woods. The funny part is that when the troops get out of the plane and away from it, it explodes. A motorless aircraft unexplicably explodes. I will take this out of the final version, but it is funny to watch. The script is below. I tried using ViewZone but that only illuminates the area, doesnt move the camera. Try this command: AskClient("SetCamera(x, y)")Should do the job. This command is NOT listed in Calvin's Lua Guide. Don't know why. But it's used several times in original MK maps. "cc_commander" did use it in some of his custom maps too. Example: Excerpt from original MK bonus map "Rzhavets" ----------------- Another example: MK map "Berezovka" (Southern Campaign; Map 5) used ~ line 1 and used again ~ line 320 What happened here before was recon units of "Grossdeutschland" division were relieved by recon units of 3rd Panzerdivision and players attention was drawn to another area by using "AskClient"
|
|
|
Post by danzig70 on Jun 11, 2010 19:32:36 GMT 1
Perfect! Thank you.
|
|
|
Post by danzig70 on Jun 14, 2010 16:36:29 GMT 1
How did it work for you, Jagged?
The AskClient("SetCamera(x,y)") didnt work for me using BKBH. It must be tied to the config file that MK uses. I am going to reinstall MK and try it again.
|
|
runrum
Zastavnik 1. klase
Posts: 85
|
Post by runrum on Jun 18, 2010 22:16:46 GMT 1
The AskClient("SetCamera(x,y)") didnt work for me using BKBH. It must be tied to the config file that MK uses. I am going to reinstall MK and try it again. Hm....*click*: AskClient discussed on BKP Not sure how long BKP will be up and running (thanx to "cc_commander" for the hint) for reading, so here I did copy some parts: Leon asked: In a map I am busy with the player occipies a town and is told to dig in. He then is given a second objective and starts with that. So the view area moves with him. Just as he is about to complete the second objective a counter attack happens in the area where he was told to dig in. Although you can inform him via a DisplayTrace message that a counter attack is taking place I would liketo "steal" the camera view from where it is and focus it on this area where the counterattack is taking place. Using vanilla BK I would like to know how to accomplish this. Thanks [BKP] answered: Leon: Hitandrun: Leon: GordonCZ: Leon: kaoz: Leon: BKP: Leon: Leon: kaoz: kaoz: GordonCZ: Please take a closer look especially at the last quote (GordonCZ)and "Hitandrun's" remark (he pointed out it was yet used in BK I)....Hope it helps. Edit: Another example from MK- NorthCampaign- Mission 2 "Soborowka" ~around script line 500 Please take a closer look at the x, y coordinates and the rectangles on the minimap of the screens shown below: In game the camera moves to x,y coord. ~ 17500, 13900 to direct the player's focus on the stuck Tigers.....but to get this effect the camera x,y coords. in script are set to ~12150, 9900.Please check script excerpt above and screen below: x-coords: ~17500/12150 => ~ 1.44 ratio y-coords: ~13900/9900 => ~ 1.40 ratio (Same with my other examples provided in an earlier post. Ratio of x,y coords. "camera" to x,y coords. "unveiled area" => ~1.4) Well, for your map I'd guess play around somewhat and you'll get the appropriate results Edit2: Just in case: There is another "AskClient" function: AskClient("GetSelectedUnits()")Got my hands full atm so I didn't test it yet , but you could check it out if you like (*click*): AskClient("GetSelectedUnits()") discussed on BKP"Here is another undocumented function (adapted from one of the tutorial map scripts)": ["n" is the script ID of the unit the player has selected in-game]
|
|
|
Post by danzig70 on Jun 21, 2010 17:13:26 GMT 1
Thanks for the information. I will try it again.
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,124
|
Post by kaoz on Jun 23, 2010 2:58:06 GMT 1
thx runrum! might also give it another try...
|
|
runrum
Zastavnik 1. klase
Posts: 85
|
Post by runrum on Jul 28, 2010 2:20:51 GMT 1
Here is the Mission Timer function I use: function MissionTimer() local minutes, seconds; minutes = GetIGlobalVar("TimerMinutes", 0); seconds = (10 + GetIGlobalVar("TimerSeconds", 0)); if(seconds == 60) then seconds = 0; minutes = 1 + minutes; SetIGlobalVar("TimerMinutes", minutes); end; SetIGlobalVar("TimerSeconds", seconds); -- if(seconds == 0) then -- DisplayTrace("Mission Time: %g:00", minutes, seconds); -- else -- DisplayTrace("Mission Time: %g:%g", minutes, seconds); -- end; end; This way you can call the global variables when you need to time something. I commented out the display of the time. What an amazing tool. Thanx a lot for sharing it!
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,124
|
Post by kaoz on Oct 8, 2010 15:37:54 GMT 1
very important on the camera set: AskClient("SetCamera(1600, 1900)"); does not work AskClient("SetCamera(1600,1900)"); works
this subtle difference kept me busy for some time, not to say years...
will experiment further on the 1:4 dividing of the co-ordinates will also check if it's possible to change the x,y with an area name using a local declaration
|
|
|
Post by danzig70 on Oct 8, 2010 16:15:48 GMT 1
You might be able to use GetScriptAreaParameters("string") in place of the x,y coordinates. Well, maybe not. Is it perhaps the VIS tile and not the script area coordinate?
|
|
|
Post by danzig70 on Oct 8, 2010 16:16:57 GMT 1
Here is the Mission Timer function I use: function MissionTimer() local minutes, seconds; minutes = GetIGlobalVar("TimerMinutes", 0); seconds = (10 + GetIGlobalVar("TimerSeconds", 0)); if(seconds == 60) then seconds = 0; minutes = 1 + minutes; SetIGlobalVar("TimerMinutes", minutes); end; SetIGlobalVar("TimerSeconds", seconds); -- if(seconds == 0) then -- DisplayTrace("Mission Time: %g:00", minutes, seconds); -- else -- DisplayTrace("Mission Time: %g:%g", minutes, seconds); -- end; end; This way you can call the global variables when you need to time something. I commented out the display of the time. What an amazing tool. Thanx a lot for sharing it! Its from a post on BKHQ or BKP where everyone posted scripts they use. Unfortunately I cant remember who created it.
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,124
|
Post by kaoz on Oct 9, 2010 3:04:58 GMT 1
You might be able to use GetScriptAreaParameters("string") in place of the x,y coordinates. Well, maybe not. Is it perhaps the VIS tile and not the script area coordinate? nah, that didn't work, haven't tried using the local declaration either, but the 1,4 factor dividing works magnifically fine! it's great to see this finally work... one silly character... sometimes i wonder how i keep up learning the hard way if Gordon is still around, a big thx for this and runrum of course...so remember: AskClient("SetCamera(x,y)"); NOT (x, y) and simply divide x and y with 1,4
|
|