You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by MosheLevi, Mister SCP

Hop to:    
Welcome! You are not logged in. Please Login or Register.1 reply
Age of Empires III Heaven » Forums » Scenario Design » Do someone help me to write the effect named"Units in Area Work Units in Area"?
Bottom
Topic Subject:Do someone help me to write the effect named"Units in Area Work Units in Area"?
ChinaBurgerMaker
Skirmisher
posted 03-03-18 01:55 AM EDT (US)         
@Mister SCP@Aizamk
Could someone help me to write the effect "Units in Area Work Units in Area"?
I don't know how to write the commands so I just write the param name.
I think this effect can be achieved because I already have the effects"Units in Area Work on Unit"and"Unit Work Units in Area".But I don't know how to combine the functions of the two.

<Effect name="Units in Area Work Units in Area">
<Param name="Player1" dispName="Source Player" VarType="string">1</Param>
<Param name="UnitType1" dispName="Source Unit Type" VarType="unittype">Unit</Param>
<Param name="SrcObject" dispName="$$22300$$Center Unit" VarType="unit">default</Param>
<Param name="Dist1" dispName=" SourceRadius" VarType="string">10</Param>
<Param name="Player" dispName="Target Player" VarType="string">1</Param>
<Param name="UnitType" dispName="Target Unit Type" VarType="unittype">Unit</Param>
<Param name="TargetObject" dispName="$$22300$$Center Unit" VarType="unit">default</Param>
<Param name="Dist" dispName="Target Radius" VarType="string">10</Param>

<Effect name="Units in area work on unit">
<Param name="PlayerID" dispName="$$22444$$From Player" VarType="player">1</Param>
<Param name="UnitType" dispName="Source Unit Type" VarType="unittype">Unit</Param>
<Param name="SrcObject" dispName="$$22300$$Center Unit" VarType="unit">default</Param>
<Param name="Dist" dispName="$$22303$$Radius" VarType="float">10</Param>
<Param name="DstObject" dispName="Target Unit" VarType="unit">default</Param>
<Command>for (all=1800;>-1){ if (kbGetUnitTypeName(all)=="%UnitType%") break;}</Command>
<Command>for(Qid=0;>1){}</Command>
<Command>xsSetContextPlayer(%PlayerID%);kbLookAtAllUnitsOnMap();</Command>
<Command>Qid=kbUnitQueryCreate("QDUA_%PlayerID%_%UnitType%");</Command>
<Command>kbUnitQuerySetPlayerID(Qid, %PlayerID%, true);</Command>
<Command>kbUnitQuerySetUnitType(Qid, all);</Command>
<Command>kbUnitQuerySetPosition(Qid, kbGetBlockPosition("%SrcObject%"));</Command>
<Command>kbUnitQuerySetMaximumDistance(Qid, %Dist%);</Command>
<Command>kbUnitQuerySetAscendingSort(Qid, false);</Command>
<Command>kbUnitQuerySetState(Qid,2);</Command>
<Command>for(i=kbUnitQueryExecute(Qid)-1;>-1){ </Command>
<Command>trUnitSelectClear();</Command>
<Command>trUnitSelectByID(1*kbUnitQueryGetResult(Qid,i));</Command>
<Command>trUnitDoWorkOnUnit("%DstObject%");</Command>
<Command>}</Command>
</Effect>

<Effect name="Unit Work Units in Area">
<Param name="SrcObject" dispName="$$22295$$Source Units" varType="unit">default</Param>
<Param name="Player" dispName="Target Player" VarType="string">1</Param>
<Param name="UnitType" dispName="Target Unit Type" VarType="unittype">Unit</Param>
<Param name="DstPoint" dispName="$$22410$$X" varType="area">0</Param>
<Param name="Dist" dispName="$$22303$$Radius" VarType="string">10</Param>
<Param name="EventID" dispName="$$22362$$Trigger" varType="event">-1</Param>
<Command>for (all=1600;>=-1){ if (kbGetUnitTypeName(all)=="%UnitType%") break;}</Command>
<Command>for(Qid=0;>1){}</Command>
<Command>xsSetContextPlayer(%Player%);kbLookAtAllUnitsOnMap();</Command>
<Command>Qid=kbUnitQueryCreate("QDUA_%Player%_%UnitType%");</Command>
<Command>kbUnitQuerySetPlayerID(Qid, %Player%, true);</Command>
<Command>kbUnitQuerySetUnitType(Qid, all);</Command>
<Command>kbUnitQuerySetPosition(Qid, vector(%DstPoint%));</Command>
<Command>kbUnitQuerySetMaximumDistance(Qid, %Dist%);</Command>
<Command>kbUnitQuerySetAscendingSort(Qid, true);</Command>
<Command>kbUnitQuerySetState(Qid, 2);</Command>
<Command>kbUnitQueryResetResults(Qid);</Command>
<Command>kbUnitQueryExecute(Qid);</Command>
<Command>trUnitSelectClear();</Command>
<Command loop="" loopParm="SrcObject">trUnitSelect("%SrcObject%");</Command>
<Command>trUnitDoWorkOnUnit(""+kbUnitQueryGetResult(Qid, 0)+"",%EventID%);</Command>
</Effect>

[This message has been edited by ChinaBurgerMaker (edited 03-03-2018 @ 02:27 AM).]

AuthorReplies:
murdilator
Skirmisher
posted 03-08-18 05:12 AM EDT (US)     1 / 1       
Just use Unit Work, with Source units, on say, a herd, mine, or a tree.

This you have to do specific, unless resources are placed close together.

I know a command like that would be neat, but the construction of such things is actually unknown.



Try out Unknown Maps at Random Map Scripts. !
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Empires III Heaven | HeavenGames