nottud
Demigod
posted 15 June 2007 11:48 AM
EDT (US)
33 / 45
I have made it - the code is below:
<Effect name="Change name in area">
<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="name" dispName="Name" VarType="string"></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>trUnitChangeName("%name%");</Command>
<Command>}}</Command>
<Command>trQuestVarSet("i", trQuestVarGet("i")+1);}</Command>
<Command>xsSetContextPlayer(trQuestVarGet("lastpl"));</Command>
</Effect>
Take note that instead of selecting a protounit, you have to select a protounit ID. A unit ID list I made is below:
Academy 486
Acid Pool 317
Agamemnon 595
Ajax 429
Ajax Older 773
Amanra 436
Amanra Older 774
Animal Attractor 575
Anubite 385
Ape of Set 672
Archer Atlantean 712
Archer Atlantean Hero 713
Archery Range 445
Argus 757
Arkantos 430
Arkantos God 777
Arkantos God Out 345
Arkantos Boost SFX 289
Arkantosman 636
Armor Glow Small 132
Armory 365
Arrow 3
Arrow Flaming 63
Arrow Signal 210
Arrow Splash SFX 195
Athena 590
Atlantis Gate 600
Atlantis Tile 642
Atlantis Tile Dead 643
Atlantis Wall Connector 598
Atlantis Wall Long 599
Attack Revealer 15
Audrey 718
Audrey Base 301
Audrey Water 719
Audrey Water Base 302
Aurochs 460
Automaton 729
Automaton SPC 788
Avalanche 208
Avenger 473
Axe 4
Axeman 356
Baboon 413
Ball of Fire 343
Ball of fire impact 379
Ball of Fire invisible 47
Ball of Fire Prometheus 138
Ballista 141
Ballista Shot 256
Bandit Migdol 654
Barracks 361
Barracks Atlantean 711
Barrel 174
Battle Boar 400
Bear 386
Behemoth 722
Bella 800
Berry Bush 526
Bireme 696
Blood 5
Blood Cinematic 242
Blood Flow 255
Blood Gore 72
Blowing Leaves 253
Boar 389
Bolder Rolling 797
Bolder Rolling 2 561
Bolder Rolling Dead 638
Bolder Rolling Small 637
Bolder Wall 527
Bolt Scorch 159
Bolt Strike 155
Bridge 403
Broken Siege Weapons 176
Brokk 619
Bush 2
Camelry 359
Camera 25
Camera Motion Arrow 26
Camera Start 27
Campfire 111
Caravan Atlantean 705
Caravan Egyptian 558
Caravan Greek 557
Caravan Norse 393
Carcinos 626
Caribou 605
Cataphract 516
Catapult 392
Catapult Shot 43
Centaur 414
Chaos effect 296
Chariot Archer 513
Charon Ferry 660
Chicken 421
Chicken Blood 287
Chicken Exploding 685
Chieroballista 703
Chimera 417
Chiron 435
Cinematic Block 352
Cinematic Dead Bodies 52
Cinematic Dead Bodies Xpack 126
Cinematic rocks 124
Cinematic Scorch 128
Cinematic Trees 125
Cinematic Wake 277
Circe 564
Citadel Center 579
Citadel SFX 160
Clone SFX 117
Cloud 12
Colossus 423
Columns 112
Columns Broken 114
Columns Fallen 113
Construction Extra Large 19
Construction Large 18
Construction Medium 17
Construction Small 16
Conversion SFX 220
Coral Reef 50
Counter Building 702
Cow 404
Crab Blood 288
Crate 40
Crate Small 276
Crocodile 381
Crocodile of Set 675
Crossbowman 658
Crowned Crane 459
Curse SFX 157
Cyclops 373
Deconstruct Building 295
Deconstruct Unit 294
Deer 479
Destroyed Buildings Large 205
Destroyed Buildings Med 204
Destroyed Buildings Small 127
Destruction 1x1 235
Destruction 2x2 234
Destruction 3x3 223
Destruction 4x4 224
Destruction 5x5 225
Destruction 8x8 226
Destruction Citadel 263
Destruction Settlement 233
Dig Pile 633
Dock 362
Dove 142
Dryad 746
Dust Devil 108
Dust Large 62
Dust Medium 61
Dust Small 60
Dwarf 360
Dwarf Foundry 621
Dwarven Forge 523
Earth 778
Earthquake 173
Earthquake CrackA 187
Earthquake CrackB 188
Earthquake CrackC 189
Earthquake CrackD 190
Egyptian Vulture 442
Einheriar 396
Einheriar Boost SFX 209
Eitri 620
Elephant 467
Elk 606
Erebus Tree 687
Evil Cloud SFX 274
Excavation 475
Farm 363
Female 663
Fence Iron 659
Fence Stone 482
Fence Wood 483
Fenris Wolf 589
Fern 180
Fertile Plants SFX 123
Fimbulwinter SFX 163
Fimbulwinter Wolf 585
Fire Ship Atlantean 698
Fire Siphon 704
Fire Siphon Fire 332
Fireball Launch Damage Effect 307
Fire Giant 387
Fire Hades 222
Fire Object 76
Fire Object Big 215
Fire Pit 29
Fire Wood 110
Fishing Ship Atlantean 695
Fishing Ship Egyptian 544
Fishing Ship Greek 402
Fishing Ship Norse 543
Fish - Mahi 461
Fish - Perch 448
Fish - Salmon 462
Flag 384
Flag Numbered 181
Flaming Footprint 54
Flowers 178
Flying Medic 723
Flying Purple Hippo 556
Folstag Flag 669
Folstag Flag Bearer 524
Footprint Prometheanbig 350
Footprint Prometheansmall 351
Footprint Animal Large 271
Footprint Animal Small 272
Footprint Cavalry 270
Footprint Elephant 280
Footprint Giant 279
Footprint Hydra 282
Footprint Military 75
Footprint Portable Ram 283
Footprint Scarab 285
Footprint Scorpion 284
Footprint Siege 273
Footprint Villager 53
Footprint Wheel 281
Forest Fire Attack 264
Forest Fire SFX 191
Forkboy 683
Fortress 369
Fountain 109
Frost Drift 107
Frost Giant 390
Gaia Forest effect 319
Gaia Forest tree 733
Gaia Forest tree burning 768
Gaia Pool 758
GaiaCreepFlowers 293
Gargarensis 431
Garrison Flag 330
Garrison Flag Sky Passage 39
Gate 366
Gate Ram 530
Gate Ram 2 640
Gate Ram Destroyed 202
Gazelle 412
Gazelle of Set 673
General Melagius 752
Generic Corpse 183
Ghost Ship 652
Giant Duck-billed Platypus 463