• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Help

Status
Not open for further replies.

N41

N41

Level 7
Joined
Sep 1, 2015
Messages
148
Two things I need help with making:

1:
Blight like Effect
Wanted buildings to have ability blight growth small and blight growth large
with other custom texture without replacing original blight tile (I need original tile for WC3 Undead race).

If someone does not know above mentioned abilities; Blight growth ability is one that creates blighted ground around a building when a building completes construction (and remains even after building is lost).

2:
Paired Units
Writing this in pseudocode. Think this is more easy to understand.


/*For every Building->A there exists Unit->B with ability Invulnerable (Neutral)*/

When A is Built
{
Create B for current owner of A near A;
}

When A is repaired to Max Health
{
Change owner of A to owner of Repairing Unit
Create B for current owner of A near A;
}

When A is Damaged AND Health of A < 50% of Max Health of A
{
Change owner of A to Neutral;
Bring B near A;
Remove B;
}

When A changes owner
{
Change owner of B to new owner of A;
}

Main problem is maintaining index i.
Secondly if you have ever played Lock-and-Key a condition of Lock-Key-Lock-Key-... can arise where Building (A) can change owners rapidly depending on player moves.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
First one is kind of hard.
You have to store the original terrain style of each tile that you replace with the new one so you can go back to the original terrain when your buildings get destroyed or something like that.

In any case, when you create a building, you then create a circular terrain type change (is a GUI action) to convert it to the terrain you want.
You do have to make some check so people wont go build stuff on other terrain types though... if you want that.
When there is another building built with the dispel ability, you can remove the blight.
However, you do have to test some stuff out so the "blight" and non-"blight" wouldnt overlap.
(All abilities can be based of attribute bonus so you can remove the icon when you dont feel the need of having it shown any more.)

About the paired units.
There is a tutorial about dynamic indexing.
It is not hard to maintain "i".
You can use a unit indexer to store "i" in an array of the custom value of a unit... or you can just use the custom value of A to store the data on that... which makes it even more simple... the only drawback would be that you cant iterate over them that easily then.

So if you have to iterate over them (do an action for all A), then use dynamic indexing.
If not, then you could just use a unit indexer and attach data to those units.
 

N41

N41

Level 7
Joined
Sep 1, 2015
Messages
148
For A and B, you can just do something like set PairedUnit[A_Index] = Unit B and set PairedUnit[B_Index] = Unit A. This way, using the index of each unit, you can find out who their pair is.

Little Doubt:
  • Consider if A[1] is destroyed then B[1] is removed (already). This will cause unused array slots?
    If so..
  • Can previous slots (slots for now lost buildings) be utilized anyway? Is there need to do this?
-----
Edit:
Also can this be done in single trigger anyways? (refering to 2: Paired Units)
 
Status
Not open for further replies.
Top