|
Post by Quintaxel on Sept 4, 2015 11:10:08 GMT 1
Interesting question. Maybe you could write a small script where the player can choose a difficulty level on the map, so regardless of the settings in the option menu.
|
|
|
Post by keepitsimple on Sept 4, 2015 13:00:06 GMT 1
Nice idear.
Have an officer and sniper at the start of the map. Chose the officer or sniper to get into the car. Delete Car with officer or sniper. Left with sniper ==> easy. Left with officer ==> hard.
LandReinforcement(1); --officer -- LandReinforcement(2); --sniper -- LandReinforcement(3); --car --
function SelectLevel() local StatOfficer= GetUnitState(1); local StatSniper= GetUnitState(2); if StatOfficer == 4 then SetIGlobalVar("Level",1); DeleteReinforcement(1); DeleteReinforcement(3); Suicide(); elseif StatSniper == 4 then SetIGlobalVar("Level",2); DeleteReinforcement(2); DeleteReinforcement(3); Suicide(); end; end;
"Level" you can then use in number of counter attacks.
RunScript("Counterattack",1200000, GetIGlobalVar("Level",0));
function Counterattack(); LandReinforcement(10); --using start command in mapeditor to move units -- --notice no Suicide() otherwise it will only run ones -- end;
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,112
|
Post by kaoz on Sept 4, 2015 13:09:35 GMT 1
Don't you need a SetDifficultyLevel function then? But why script a choice if player can choose in options? I would use SetDifficultyLevel in script only when overriding player's choice...
|
|
|
Post by Quintaxel on Sept 4, 2015 13:43:12 GMT 1
Don't you need a SetDifficultyLevel function then? But why script a choice if player can choose in options? I would use SetDifficultyLevel in script only when overriding player's choice... That would be the idea as setting the difficulty level in the options does not influence the way the script acts but only certain game paparameters. Setting the difficulty in the map does not have to overide the settings in the options but it is a possibility. In fact you can combine difficulty levels in the options with the difficulty settings in the map. eg. Hard selected in the options combined with easy in the map selection. As said the first selection effects the game parameter, the latter affects the script.
|
|
Denis
Pukovnik
Posts: 423
|
Post by Denis on Sept 15, 2015 23:38:02 GMT 1
Create 3 versions of same map (easy,medium,hard). Then create chapter with these maps. Player can select one from them. When he finish 1 map chapter is finished
|
|
|
Post by Quintaxel on Sept 16, 2015 11:27:10 GMT 1
Maybe slightly of topic but how about some kind of adaptive AI, so an AI that somehow measures the performance of the player and adapts the difficulty level of the map accordingly. It's possible I guess but it would require more complex scripting. eg. The script could react (airsupport yes or no or the type of airsupport)depending on the losses of the player within a certain timeframe. Territory taken within a certain timeframe could be another trigger.
|
|
|
Post by keepitsimple on Nov 21, 2017 22:22:06 GMT 1
Here is another possible use of planes of player two.
What is needed is on the map right angle area's name A11 to A51 in the first row. Next row are named A12..A52 etc.
The script test if an Area A{nrXNrY} has zero troops of the player. From left to right this test and from back row to the front.
As long as is true - player is NOT in this area - the next area to left is checked. Until in this case nrX = 6 (player is not yet in the back row). The next row is test (nrX back to 1 and nrY is now 2) ect. If the player enter an area A{nrXnrY} the while procedure stops or if the player has move into the area. If player has not yet enter the area the Nry = maxRow (here 4) and NrX = maxCol+1 (here 6). If this true then function CAS2 which is copy of function here except named and where here CAS2 is called it calls CAS (this function). if the player has enter an area for instance A24 then the ground attack gives support by flying to A23 (in front of the troops).
If player 2 player are not for player but AI then A24 would be the target.
-- Close Air Support --
function CAS()
local nrX=1; local nrY=1;
SetIGlobalVar("NrA", 11);
while ((GetNUnitsInArea (0, "A" .. GetIGlobalVar("NrA", 0))==0) and (nrX<6)) do nrX=nrX+1; SetIGlobalVar("NrA", nrX*10+nrY); -- restart next row -- if nrY<4 and nrX==6 then nrY=nrY+1; nrX=1; SetIGlobalVar("NrA", nrX*10+nrY); end; end; --do --
-- no player found -- if nrY==4 and nrX==6 then RunScript("CAS2", 18000); Suicide(); -- player is not yet in last row so it possible to send plane one row higher -- elseif nrY>1 then SetIGlobalVar("NrA", nrX*10+nrY-1); Cmd(36,0,2,GetScriptAreaParams ( "A" .. GetIGlobalVar("NrA", 0))); RunScript("CAS2",280000); Suicide(); -- player is last row now you can't sent plane to row higher hence now to area of player -- else SetIGlobalVar("NrA", nrX*10+1); Cmd(36,0,2,GetScriptAreaParams ( "A" .. GetIGlobalVar("NrA", 0))); RunScript("CAS2",280000+RandomInt(8)*10000); Suicide(); end; end;
|
|
|
Post by keepitsimple on Nov 24, 2017 21:31:40 GMT 1
Having made the squares for the close-air support, I could of course also use it to direct a good counter.
If the player moves into the first row then a counter is send to intervene. I send first down the middle and let it then move on target.
RunScript( "Attack13", 30000);
This function is repeat every half minute (=30000) until the player move into the area. Then the counter is started and loop terminated.
function Attack13() local nrX=1; local nrY=4; {is first row from the player point of view}
SetIGlobalVar("AttNrA", 14); {notice not same name as in Close-Air support script done want parameters of the function incidentally mixed up}
while ((GetNUnitsInArea (0, "A" .. GetIGlobalVar("AttNrA", 0))==0) and (nrX<6)) do nrX=nrX+1; SetIGlobalVar("AttNrA", nrX*10+nrY); end; --do --
{if the player is in one of the area's then nrX is in the range 1 to 5. Hence if 6 then the player has moved up yet} if nrX<6 then Cmd(3,130,GetScriptAreaParams ("A34")); QCmd(3,130,GetScriptAreaParams ( "A" .. GetIGlobalVar("AttNrA", 0))); Cmd(3,139,GetScriptAreaParams ("A34")); QCmd(3,139,GetScriptAreaParams ( "A" .. GetIGlobalVar("AttNrA", 0))); Suicide(); end; end;
|
|