HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random Reveal

04-30-2006, 03:26 AM#1
Anubis
Pretty much i want this spell to choose a field farmer which it randomly chooses from all the field farmers on the map and then to reveal that area to the player whos unit casted the spell. (like the orc far seer far sight)

This is what i have but i dont know if it is correct..

Trigger:
Random Reveal
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Random Reveal
Collapse Actions
Set Farmer = (Random unit from (Units in (Entire map) matching ((Unit-type of (Triggering unit)) Equal to FieldFarmer)))
Unit - Order (Casting unit) to Orc Far Seer - Far Sight (Position of Farmer)
04-30-2006, 03:32 AM#2
paidan_fain
Well, for one you could merge the two actions into one, replacing the need for udg_farmer.

Also, I am pretty sure that unit groups leak, in which case you will need to destroy that group as well.

Finally, the order that you give is for the unit who casts which isn't always the best thing in the world. Instead, create a dummy unit which the reveal ability, give it a 1 second life timer, and order it to cast reveal.

I believe there is a function that alllows you to set the visibility of a rect. You could use that and remove the need for a reveal ability. Just have the rect have coordinates relative to the random unit. In gui, its under the visilbility tab.
04-30-2006, 03:42 AM#3
Anubis
thnx but how would i order the unit to cast the spell at a point... for some reason the trigger that casts at a point only allows the use of the default spells.. eg Orc - Far Sight
04-30-2006, 03:48 AM#4
TaintedReality
The order is for the spell it's based off of. So if you base a spell off of Far Sight, use the Far Sight order.
04-30-2006, 03:49 AM#5
PipeDream
Yes, units in entire map will leak. Entire map might leak too if it uses GetWorldBounds(), but I think it uses the function that returns bj_mapInitialPlayableArea. You can check that with convert to custom text. Position of Farmer also leaks a point.

To order the unit to cast the appropriate spell, use the spell that you based your custom on, or if you changed the order string, to the spell with the same order string.
04-30-2006, 03:50 AM#6
paidan_fain
Well those aren't technically default spells. They are default order strings. As I stated though, you could remove the need for that. In the actions menu, look through the visibility tab. One of them there shows area to player. When you have to choose a rect, choose convert points to rect. I don't know how the gui of it looks but what you should do is set the boundaries of the rect to be offsets of the random unit's position.
04-30-2006, 03:54 AM#7
Anubis
ok so ive based it off of far sight.. would anyone be able to give me a look at what they think the trigger should look like because im not that savy on preventing leaks and such
04-30-2006, 08:14 AM#8
Captain Griffen
Trigger:
Collapse Random Reveal
Events
Unit - A unit Begins casting an ability
Collapse
Conditions
(Ability being cast) Equal to Random Reveal
Collapse
Actions
Set TempGroup = (Units in (Entire map) matching ((Unit-type of (Matching unit)) Equal to FieldFarmer)))
Set Farmer = (Random unit from TempGroup)
Set TempPoint = (Position of Farmer)
Unit - Order (Casting unit) to Orc Far Seer - Far Sight TempPoint
Custom Script: call DestroyGroup udg_TempGroup
Custom Script: call RemoveLocation udg_TempPoint
04-30-2006, 09:46 AM#9
Anubis
nah its not working yet guys any other suggestions?
04-30-2006, 10:04 AM#10
Captain Griffen
What is the ability random reveal based off?

Does the casting unit have an ability based off of far sight?
04-30-2006, 10:44 AM#11
Anubis
no the casting unit does not but i set up a function like a dummy/invisible/spellcaster unit that does.. and lol i forgot to put mana in it... now it has mana but i just tested it and it did the spell on a different unit not a field farmer
04-30-2006, 10:48 AM#12
Captain Griffen
My trigger would, if you replaced (casting unit) with the dummy unit, cast it on a field farmer. Post your current triggers.
04-30-2006, 10:54 AM#13
Anubis
ok i fixed it.. forgot the matching player rather then triggering player... But there is one more thing... its multiplayer and there are 10 players max so 1 field farmer for each so i want the ability to work on not just my own because ive tested it now and it ownly works on my controllable field farmer
04-30-2006, 11:06 AM#14
Captain Griffen
Post your current triggers, because mine what I suggested would work on all.
04-30-2006, 11:10 AM#15
Anubis
Ok here it is Spell Caster is dummy unit

Trigger:
Random Reveal
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Random Reveal
Collapse Actions
Unit - Create 1 Spell Caster for (Owner of (Casting unit)) at (Center of InvisibleBuildings <gen>) facing Default building facing degrees
Set Spellcaster = (Last created unit)
Set TempFarmers = (Units in (Entire map) matching ((Unit-type of (Matching unit)) Equal to Field Farmer))
Set Farmer = (Random unit from TempFarmers)
Set DiPoint = (Position of Farmer)
Unit - Order Spellcaster to Orc Far Seer - Far Sight DiPoint
Custom script: call DestroyGroup (udg_TempFarmers)
Custom script: call RemoveLocation (udg_DiPoint)