pftq.com
Welcome! Please Login or Register!
November 21, 2024, 02:38:46 AM
Home Login Register
pftq Forums  |  Game Design  |  Age of Empires III  |  Need help creating a ?Flare Unit? Effect 0 Members and 1 Guest are viewing this topic. « previous next »
Latest News!Lunar Trigger(Aug 27, 2023)
Pages: 1 [2] 3 4 ... 6 Print
Author Topic: Need help creating a ?Flare Unit? Effect  (Read 33595 times)
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #15 on: June 16, 2008, 10:55:55 AM »

varType="unittype" was never used in any other triggers.  It was always varType="unit".  This sets the field/variable type.
Logged
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #16 on: June 16, 2008, 11:02:13 AM »

Yes, unittype is used in units in area... It listes all units + Stuff like all, and infentry and Calvery etc.

Random22
« Last Edit: June 16, 2008, 11:06:41 AM by Random22 » Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #17 on: June 16, 2008, 11:19:17 AM »

This is Units in Area.  It uses varType="unit"

<Condition name="$$22299$$Units in Area">
      <Param name="DstObject" dispName="$$22300$$Center Unit" VarType="unit">default</Param>
      <Param name="Player" dispName="$$22301$$Player" VarType="player">0</Param>
      <Param name="UnitType" dispName="$$22302$$Unit Type" VarType="string">Unit</Param>
      <Param name="Dist" dispName="$$22303$$Radius" VarType="float">10</Param>
      <Param name="Op" dispName="$$22297$$Operator" VarType="operator">==</Param>
      <Param name="Count" dispName="$$22304$$Count" VarType="float">1</Param>
      <Expression>trCountUnitsInArea("%DstObject%",%Player%,"%UnitType%",%Dist%) %Op% %Count%</Expression>
   </Condition>
Logged
MosheLevi
Member
*****
Offline Offline

Posts: 28

« Reply #18 on: June 16, 2008, 02:31:23 PM »

Hi Guys,

Thank you Random22 for working on this trigger and thank you pftq for helping.

I need this trigger to create many flares on the mini map all at once at all locations for specific Unit Type.

So if I have 20 Musketeers around the map I need a flare for each one of them producing 20 flares all at once.

I am assuming we can base this trigger on Unit Type in area except that the area is the entire map, and this effect needs to run in a loop, find all the Units for the specified Unit Type and flare all of them.

Hope this clears it and thank you for your help.
Logged
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #19 on: June 16, 2008, 04:49:46 PM »

Then you are using the wrong approach.  What you need is 20 different flares (or however many units there are of that type).  You can't use just one flare command for that and it also requires kbunitquery.

Something along the lines of this:
Code:
<Effect name="Flare Unit Type in Area (Center Unit)">
<Param name="Object" dispName="Center Unit" varType="unit">default</Param>
<Param name="Dst" dispName="Radius" varType="string">10.0</Param>
<Param name="UnitId" dispName="Unit Type ID (Optional)" varType="string">-1</Param>
<Param name="FromPlayer" dispName="From Player or 99 for ALL" varType="string">99</Param>
<Param name="ForPlayer" dispName="Flare Player or 99 for ALL" varType="string">99</Param>
<Param name="Dur" dispName="Duration" varType="float">1.0</Param>
<Param name="Booler" dispName="Include Center Unit" varType="bool">false</Param>
<Command>trQuestVarSet("convarea", 0);</Command>
<Command>trQuestVarSet("ffweho",0);</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("vroom", %FromPlayer%);</Command>
<Command>trQuestVarSet("warthog", 0);</Command>
<Command>trQuestVarSet("zeep", 0);</Command>
<Command>if(%UnitId%>=0) {</Command>
<Command>trQuestVarSet("zeep", %UnitId%);</Command>
<Command>}</Command>
<Command>if(0>%UnitId%) {</Command>
<Command>while(kbGetUnitTypeName(trQuestVarGet("zeep"))!="All") {</Command>
<Command>trQuestVarSet("zeep", trQuestVarGet("zeep")+1);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("lastpl", xsGetContextPlayer());</Command>
<Command>xsSetContextPlayer(0);</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("blarg",%FromPlayer%);</Command>
<Command>if(%FromPlayer%==99) {</Command>
<Command>trQuestVarSet("blarg",0);</Command>
<Command>trQuestVarSet("vroom",12);</Command>
<Command>}</Command>
<Command>trQuestVarSet("i",trQuestVarGet("blarg"));</Command>
<Command>while(trQuestVarGet("vroom")>=trQuestVarGet("i")) {</Command>
<Command>trQuestVarSet("convarea", kbUnitQueryCreate("convarea"));</Command>
<Command>kbUnitQuerySetPlayerID(trQuestVarGet("convarea"), trQuestVarGet("i"));</Command>
<Command>kbUnitQuerySetUnitType(trQuestVarGet("convarea"), trQuestVarGet("zeep"));</Command>
<Command>kbUnitQuerySetPosition(trQuestVarGet("convarea"), kbGetBlockPosition(""+1*%Object%));</Command>
<Command>kbUnitQuerySetMaximumDistance(trQuestVarGet("convarea"), %Dst%);</Command>
<Command>kbUnitQuerySetAscendingSort(trQuestVarGet("convarea"), true);</Command>
<Command>kbUnitQueryResetResults(trQuestVarGet("convarea"));</Command>
<Command>trQuestVarSet("warthog", kbUnitQueryExecute(trQuestVarGet("convarea")));</Command>
<Command>while(trQuestVarGet("warthog")>0) {</Command>
<Command>trQuestVarSet("warthog", trQuestVarGet("warthog")-1);</Command>
<Command>trQuestVarSet("ffweho", kbUnitQueryGetResult(trQuestVarGet("convarea"), trQuestVarGet("warthog")));</Command>
<Command>trQuestVarSet("ffweho2", trQuestVarGet("ffweho"));</Command>
<Command>if(%Booler%==true) {</Command>
<Command>if(trQuestVarGet("ffweho2")==kbGetBlockID(""+1*%Object%)) {trQuestVarSet("ffweho2", trQuestVarGet("ffweho")+1);}}</Command>
<Command>if(trQuestVarGet("ffweho2")!=kbGetBlockID(""+1*%Object%)) {</Command>
<Command>trMinimapFlare(%ForPlayer%, %Dur%, kbGetBlockPosition(""+1*trQuestVarGet("ffweho")), false);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("i", trQuestVarGet("i")+1);}</Command>
<Command>xsSetContextPlayer(trQuestVarGet("lastpl"));</Command>
</Effect>

Let me know what exactly happens with this - it's the right approach but I may have forgotten something (it's been a while).
« Last Edit: June 16, 2008, 04:51:45 PM by pftq » Logged
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #20 on: June 16, 2008, 06:40:05 PM »

I hate you pftq...jk...Still...WHY DO YOU HAVE TO BEE SOOOOOOOO SMART?Huh? (That trigger worked)

Shocked Random22 Cool
Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #21 on: June 16, 2008, 07:03:41 PM »

pftq,

Can you help me with this trigger?

Code:
  <Effect name="Kill All Units In Area (Center Unit)">
<Param name="Object" dispName="Center Unit" varType="unit">default</Param>
<Param name="Dst" dispName="Radius" varType="string">10.0</Param>
<Param name="Player" dispName="Player" varType="player">1</Param>
    <Command>trQuestVarSet("KillyomomINAREA", 0);</Command>
<Command>while(1500>=trQuestVarGet("KillyomomINAREA")) {</Command>
<Command>trUnitSelectClear();</Command>
    <Command loop="" loopParm="SrcObject">trUnitSelect (""+kbGetProtoUnitName(trQuestVarGet("KillyomomINAREA")));</Command>
    <Command>trUnitDelete(false);</Command>
<Command>trQuestVarSet("KillyomomINAREA", trQuestVarGet("KillyomomINAREA")+1);}</Command>

Help, :'( Random22 :'(
« Last Edit: June 16, 2008, 07:54:20 PM by Random22 » Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #22 on: June 16, 2008, 08:00:17 PM »

What are you using it for? A much better solution (less memory-intensive) is to just use Change Units in Area.  Change the units to an object you don't use much (like an Invisible Target) and modify it to 0 HP or lifespan.
Logged
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #23 on: June 16, 2008, 08:08:21 PM »

Q Pftq,

This effect will make the units fall instead of disapear.

LOOK,
  Wink
Code:
Random22
  Wink
Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #24 on: June 16, 2008, 08:13:58 PM »

I see.. and the Damage Units in Area doesn't work right? Forgot about that.  The code should be similar to the Flare.  Except of course we start killing them instead of flaring their locations...

Code:
<Effect name="Kill Units in Area (Center Unit)">
<Param name="Object" dispName="Center Unit" varType="unit">default</Param>
<Param name="Dst" dispName="Radius" varType="string">10.0</Param>
<Param name="UnitId" dispName="Unit Type ID (Optional)" varType="string">-1</Param>
<Param name="FromPlayer" dispName="From Player or 99 for ALL" varType="string">99</Param>
<Param name="Booler" dispName="Include Center Unit" varType="bool">false</Param>
<Command>trQuestVarSet("convarea", 0);</Command>
<Command>trQuestVarSet("ffweho",0);</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("vroom", %FromPlayer%);</Command>
<Command>trQuestVarSet("warthog", 0);</Command>
<Command>trQuestVarSet("zeep", 0);</Command>
<Command>if(%UnitId%>=0) {</Command>
<Command>trQuestVarSet("zeep", %UnitId%);</Command>
<Command>}</Command>
<Command>if(0>%UnitId%) {</Command>
<Command>while(kbGetUnitTypeName(trQuestVarGet("zeep"))!="All") {</Command>
<Command>trQuestVarSet("zeep", trQuestVarGet("zeep")+1);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("lastpl", xsGetContextPlayer());</Command>
<Command>xsSetContextPlayer(0);</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("blarg",%FromPlayer%);</Command>
<Command>if(%FromPlayer%==99) {</Command>
<Command>trQuestVarSet("blarg",0);</Command>
<Command>trQuestVarSet("vroom",12);</Command>
<Command>}</Command>
<Command>trQuestVarSet("i",trQuestVarGet("blarg"));</Command>
<Command>while(trQuestVarGet("vroom")>=trQuestVarGet("i")) {</Command>
<Command>trQuestVarSet("convarea", kbUnitQueryCreate("convarea"));</Command>
<Command>kbUnitQuerySetPlayerID(trQuestVarGet("convarea"), trQuestVarGet("i"));</Command>
<Command>kbUnitQuerySetUnitType(trQuestVarGet("convarea"), trQuestVarGet("zeep"));</Command>
<Command>kbUnitQuerySetPosition(trQuestVarGet("convarea"), kbGetBlockPosition(""+1*%Object%));</Command>
<Command>kbUnitQuerySetMaximumDistance(trQuestVarGet("convarea"), %Dst%);</Command>
<Command>kbUnitQuerySetAscendingSort(trQuestVarGet("convarea"), true);</Command>
<Command>kbUnitQueryResetResults(trQuestVarGet("convarea"));</Command>
<Command>trQuestVarSet("warthog", kbUnitQueryExecute(trQuestVarGet("convarea")));</Command>
<Command>while(trQuestVarGet("warthog")>0) {</Command>
<Command>trQuestVarSet("warthog", trQuestVarGet("warthog")-1);</Command>
<Command>trQuestVarSet("ffweho", kbUnitQueryGetResult(trQuestVarGet("convarea"), trQuestVarGet("warthog")));</Command>
<Command>trQuestVarSet("ffweho2", trQuestVarGet("ffweho"));</Command>
<Command>if(%Booler%==true) {</Command>
<Command>if(trQuestVarGet("ffweho2")==kbGetBlockID(""+1*%Object%)) {trQuestVarSet("ffweho2", trQuestVarGet("ffweho")+1);}}</Command>
<Command>if(trQuestVarGet("ffweho2")!=kbGetBlockID(""+1*%Object%)) {</Command>
<Command>trUnitSelectClear();</Command>
<Command>trUnitSelectByID(1*trQuestVarGet("ffweho"));</Command>
<Command>trUnitDelete(false);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("i", trQuestVarGet("i")+1);}</Command>
<Command>xsSetContextPlayer(trQuestVarGet("lastpl"));</Command>
</Effect>
Logged
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #25 on: June 16, 2008, 08:48:44 PM »

Sweeeeeeet Thanks, pftq.

Right now I am working on a new trigger set and putting these triggers in, But I am geving you credit for these triggers.

Thanks,
Smiley Random22  Smiley
Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #26 on: June 16, 2008, 09:04:33 PM »

Dear pftq,

Ok, I modded your triggers and this is what I got.

Code:
	  <Effect name="Make Units in Area Invulnerable (Center Unit)">
<Param name="Object" dispName="Center Unit" varType="unit">default</Param>
<Param name="Dst" dispName="Radius" varType="string">10.0</Param>
<Param name="UnitId" dispName="Unit Type ID (Optional)" varType="string">-1</Param>
<Param name="FromPlayer" dispName="From Player or 99 for ALL" varType="string">99</Param>
<Param name="Booler" dispName="Include Center Unit" varType="bool">false</Param>
<Param name="Enable" dispName="Enable?" varType="bool">true</Param>
<Command>trQuestVarSet("convarea", 0);</Command>
<Command>trQuestVarSet("ffweho",0);</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("vroom", %FromPlayer%);</Command>
<Command>trQuestVarSet("warthog", 0);</Command>
<Command>trQuestVarSet("zeep", 0);</Command>
<Command>if(%UnitId%>=0) {</Command>
<Command>trQuestVarSet("zeep", %UnitId%);</Command>
<Command>}</Command>
<Command>if(0>%UnitId%) {</Command>
<Command>while(kbGetUnitTypeName(trQuestVarGet("zeep"))!="All") {</Command>
<Command>trQuestVarSet("zeep", trQuestVarGet("zeep")+1);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("lastpl", xsGetContextPlayer());</Command>
<Command>xsSetContextPlayer(0);</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>if(%FromPlayer%!=99) trQuestVarSet("blarg",%FromPlayer%);</Command>
<Command>if(%FromPlayer%==99) {</Command>
<Command>trQuestVarSet("blarg",0);</Command>
<Command>trQuestVarSet("vroom",12);</Command>
<Command>}</Command>
<Command>trQuestVarSet("i",trQuestVarGet("blarg"));</Command>
<Command>while(trQuestVarGet("vroom")>=trQuestVarGet("i")) {</Command>
<Command>trQuestVarSet("convarea", kbUnitQueryCreate("convarea"));</Command>
<Command>kbUnitQuerySetPlayerID(trQuestVarGet("convarea"), trQuestVarGet("i"));</Command>
<Command>kbUnitQuerySetUnitType(trQuestVarGet("convarea"), trQuestVarGet("zeep"));</Command>
<Command>kbUnitQuerySetPosition(trQuestVarGet("convarea"), kbGetBlockPosition(""+1*%Object%));</Command>
<Command>kbUnitQuerySetMaximumDistance(trQuestVarGet("convarea"), %Dst%);</Command>
<Command>kbUnitQuerySetAscendingSort(trQuestVarGet("convarea"), true);</Command>
<Command>kbUnitQueryResetResults(trQuestVarGet("convarea"));</Command>
<Command>trQuestVarSet("warthog", kbUnitQueryExecute(trQuestVarGet("convarea")));</Command>
<Command>while(trQuestVarGet("warthog")>0) {</Command>
<Command>trQuestVarSet("warthog", trQuestVarGet("warthog")-1);</Command>
<Command>trQuestVarSet("ffweho", kbUnitQueryGetResult(trQuestVarGet("convarea"), trQuestVarGet("warthog")));</Command>
<Command>trQuestVarSet("ffweho2", trQuestVarGet("ffweho"));</Command>
<Command>if(%Booler%==true) {</Command>
<Command>if(trQuestVarGet("ffweho2")==kbGetBlockID(""+1*%Object%)) {trQuestVarSet("ffweho2", trQuestVarGet("ffweho")+1);}}</Command>
<Command>if(trQuestVarGet("ffweho2")!=kbGetBlockID(""+1*%Object%)) {</Command>
<Command>trUnitSelectClear();</Command>
<Command>trUnitSelectByID(1*trQuestVarGet("ffweho"));</Command>
<Command>trUnitMakeInvulnerable(%Enable%);</Command>
<Command>}}</Command>
<Command>trQuestVarSet("i", trQuestVarGet("i")+1);}</Command>
<Command>xsSetContextPlayer(trQuestVarGet("lastpl"));</Command>
</Effect>

Thanks,
Code:
Random22
Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #27 on: June 16, 2008, 09:06:42 PM »

Looks good. Smiley
Logged
Random22
Member
*****
Offline Offline



Posts: 33

WWW
« Reply #28 on: June 16, 2008, 09:27:52 PM »

pftq,

Got any trigger ideas? Im almost out. I've got like 35 in the set. (10 Conditions, 25 Effects).

Do you see anything wrong with this?

Code:
<Effect name="Grant Resources For All">
<Param name="ResName" dispName="Resource" varType="resource">food</Param>
<Param name="Amount" dispName="Amount" varType="long">100</Param>
 <Command>for(i=1>8){<command>
<Command>trPlayerGrantResource(i, "%ResName%", %Ammount%)}</Command>

Thanks
 Cheesy Random22  Cheesy
Logged

-Random22^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thats Right More Random22 Signature Wink
pftq
Administrator
*****
Offline Offline



Posts: 4204

WWW
« Reply #29 on: June 17, 2008, 08:43:16 AM »

Yes - do not use variables.  Otherwise the trigger can only be used once (because you can't declare variables multiple times).

Use QV or just type it out for each player.  Also you're missing a ';'
Logged
Pages: 1 [2] 3 4 ... 6 Print 
pftq Forums  |  Game Design  |  Age of Empires III  |  Need help creating a ?Flare Unit? Effect « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines | RSS Feed Valid XHTML 1.0! Valid CSS!
Page created in 0.135 seconds with 21 queries.