|
Post by ariete on Feb 23, 2016 14:48:07 GMT 1
i wanted know how simply write an objective will be completed if the 2 conditions, or one of them, it's reached. if ....... and if .... then if ..... or if ...... then i mean where and how many parenthesis. i know, i checked different way in many xml where is put triger, setvariable, but if for the first i could understand something, about this last totally dark. so maybe i though i can write as above with some more parenthesys .. maybe .. i don't know. thank you
|
|
|
Post by keepitsimple on Feb 23, 2016 20:52:39 GMT 1
if ((condition1) or (condition2)) then
Example
if ((GetNUnitsInArea(0, "Town")>=2) or (GetNUnitsInScriptGroup(100 , 1)==0)) then
if the player has more then 2 units in area "town" or the AI has no more units with ID 100 then
|
|
|
Post by ariete on Feb 24, 2016 13:49:29 GMT 1
perfect .. thank you to keep it simple!
|
|
|
Post by ariete on Mar 1, 2016 20:46:06 GMT 1
.. mm .. and triple .. could it be possible? if ((condition1) or/and (condition2) or/ad (condition3)) then
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,121
|
Post by kaoz on Mar 3, 2016 1:27:09 GMT 1
sure is possible:
function Objective0() if ((GetNUnitsInArea(0, "port_oil") > 0) and (GetNUnitsInArea(1, "port_oil") == 0) or (GetNUnitsInArea(0, "port_center") > 0) and (GetNUnitsInArea(1, "port_center") == 0) or (GetNUnitsInArea(0, "port_east") > 0) and (GetNUnitsInArea(1, "port_east") == 0)) then ObjectiveChanged(0, 1); DisplayTrace("Well done!"); RunScript("RevealObjective6", 3000); Suicide(); end; end;
|
|
|
Post by ariete on Mar 3, 2016 9:06:11 GMT 1
wow ... so many ... thank you
|
|
|
Post by Quintaxel on Mar 3, 2016 12:08:55 GMT 1
Maybe we should start Lua classes
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,121
|
Post by kaoz on Mar 3, 2016 23:16:50 GMT 1
Maybe we should start Lua classes I think you might... my Lua knowledge sofar is only applicable upon BK and even then, as you know, i keep making mistakes. But isn't it wonderful how we all help each other here?
|
|
|
Post by ariete on Mar 4, 2016 14:55:18 GMT 1
yes, thank you
|
|
|
Post by ariete on Mar 21, 2016 14:48:50 GMT 1
now i can't find that post Quintaxel about the unit ID, anywAy i've a copy and .. 1st number 0 player 1 AI, 0 player is nothing? i mean, how start a number with 0
|
|
|
Post by Quintaxel on Mar 21, 2016 16:27:00 GMT 1
ariete , is this the post you are referring to ? For the 0 part you do not have to put the zero in front of the ScriptID. It would not be possible in the mapeditor anyway eg for UnitType 53 = arm_medium (medium armour) When unit belongs to 0 party then the scriptID should be; 5300 (4 digits) The 0 is not written. When the party = 1 the scripID would be 15300 (5 digits) The scripts I make are able to recognize the party the unit belongs to.
|
|
|
Post by ariete on Mar 22, 2016 20:57:43 GMT 1
i did i have this case quinfunction StartObjective7() RunScript("Reinforcement161171", 5000); RunScript("Reinforcement154171", 25000); RunScript("Reinforcement161172", 50000); RunScript("Reinforcement154172", 55000); ObjectiveChanged(7,0); RunScript("CheckObjective7", 5000); Suicide(); end; function CheckObjective7() if ((GetNUnitsInScriptGroup(161171) < 1) and (GetNUnitsInScriptGroup(154171) < 1) and (GetNUnitsInArea(0, "Baintsagan_heights") < 1) and (GetNUnitsInArea(0, "west_bank") < 1) and (GetNUnitsInArea(0, "east_bank") > 10)) then ObjectiveChanged(7, 1); RunScript("ToWin", 5000); Suicide(); end; end; function Reinforcement161171() LandReinforcement(161171); Suicide(); end; function Reinforcement154171() LandReinforcement(154171); Suicide(); end; function Reinforcement161172() LandReinforcement(161172); Suicide(); end; function Reinforcement154172() LandReinforcement(154172); Suicide(); end; i would reiforments ID 161171 and 154171 make a Cmd and Qcmd functions of -swarm to i can give the first command Cmd in the map editor, order them to swarm to a certain point, but i don't know, maybe you would suggest me to make these commands through script for these units which use DOUBLE (backin to the topic), due to the ipotetic complex actions these units must do .. what i have to do? i mean i have to open any RunScript functions like this?function StartObjective7() RunScript("Cmd161171", 5000); RunScript("Cmd154171", 25000); ... and then define them like this?function Cmd161171 Cmd(3, 161171, GetScriptAreaParams (''west_bank) ??i could assume but i don't know how do exactly
then i have assign for each type of unit its script ID etc etc, .. i could do the AI go to move mortars in another location if the location where they're has more than one Player soldier. how you suggest to use that system. i found just that for the moment ... (no jap tanks in the map i'm doing about nomonhan .. so no one is scaried ... BUT maybe they wrong !!! banzai )
|
|
|
Post by Quintaxel on Mar 23, 2016 9:13:18 GMT 1
ariete , pls check your PM. I need some additional info.
|
|
|
Post by ariete on Mar 23, 2016 22:07:27 GMT 1
in mapeditor, could i call a reinf group with different name rather than the ID script of the units inside that group!? and am i forced to use for units script ID beetween 1 and 32000 or i can exceed like i'm doing?
|
|
|
Post by Quintaxel on Mar 24, 2016 13:01:14 GMT 1
ariete , maybe this script solves your problem. If each unit in the reinforcement group has its own ScriptId then you get better control. DisplayTrace ("Moving units after Landreinforcements"); DisplayTrace ("For Ariete"); DisplayTrace ("Quintaxel 24-03-16");
scriptarea = {"wp1","wp2","wp3","wp4","wp5"}; -- add all ScripAreas that the unit needs to follow to the table function Reinforce() LandReinforcement (1000); -- contains units with scriptIds 100,101,102,103,104,105 RunScript ("ArieteSwarm",5000); Suicide(); end;
function ArieteSwarm() local i = 1; local x,y; while scriptarea[i] ~= nil do x,y = GetScriptAreaParams (scriptarea[i]); -- This gives the flexibility to select units within the reinforcement groups you want to move. QCmd (3,100,x,y); QCmd (3,101,x,y); QCmd (3,102,x,y); QCmd (3,103,x,y); QCmd (3,104,x,y); QCmd (3,105,x,y); i = i +1; end; Suicide(); end;
function Init() RunScript ("Reinforce",2000); end; This is quick and dirty work so there is room for improvement You can find a demo map with script here
|
|