• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Urgent help needed from good trigger/ability makers!!

Status
Not open for further replies.
Level 6
Joined
Aug 29, 2004
Messages
159
Hi guys,

I need to make a trigger which goes something like this:

Event: A unit comes within 500 of Demon[IntegerA]
Conditions:
Actions: Create 1 Energy[Level of (Energy) for Demon[IntegerA]]
...and more code


However, there doesnt seem to be an event like i'm looking for (ie referencing to a unit-array variable). The 'Unit comes withing range' event only seems to be able to reference already existing units, or the preset 'no unit'. Is there any way to make it reference a unit which does not already exist when i make the map (ie a unit created in-game)? How do i get around this probelm

Oh and is using Demon[IntegerA] the correct way to reference a unit-array from another trigger? So in the other trigger the action is "Set Demon[(Player number of (Owner of (Casting unit)))] = Casting Unit", will Demon[IntegerA] reference to this unit in a second/subsequent trigger?

Hope that made sense :wink:
Thanks for help,
Bort
 
Level 8
Joined
Jul 9, 2004
Messages
405
i got no idea what u mean by array and stuff... cause i never use triggers that say array, but i think u mean u try to make it a variable but it doesnt work?... i dont know what u meant but you gotta use unit variables and triggers to set the unit as the variable

im so tired i cant think right though
 
Level 6
Joined
Aug 29, 2004
Messages
159
By array i mean Arrayed Variables (u know the little box u can tick when creating a variable?)

The problem is that the "Unit - Unit within range" event won't let you refer to a variable: it is only usable for units which are on the map in the editor, not units which are created during the game.

Hope that clarifies a bit
Bort
 
Level 9
Joined
Sep 8, 2004
Messages
633
Attach a variable to demon, as in

Code:
Unit is created - unit type of (triggering unit) = demon

Set Demon[1] = last created unit

Code:
unit comes withing range 500 of [demon 1]

event.

something like that?
 
Level 7
Joined
Mar 26, 2004
Messages
350
integer a refers to the "for each integer a from 1 to x" function. it won't work in events, as u can't loop events in GUI
 
Level 8
Joined
Jul 3, 2004
Messages
334
I think I have it:
Create two variables, here's what I came up with:
ItemEnergy = Item (no custom value or array)
ItemRegion = Region (no custom value or array)
Now the trigger:
Events:
Unit - A unit comes within 500.00 of Demon[1]
Actions:
Item - Create Energy at (Position of Demon[1])
Set ItemRegion = (Region(Position of(Last Created Item)),(Position of(Last Created Item))))
Set ItemEnergy = (Random item in ItemRegion)
Item = Pick every item in ItemRegion and do(Hero - Give item to Demon[1])

EDIT: You can repeat this trigger to do it to another unit. Just copy and paste this trigger, replacing Demon[1] with any other unit you want.
Now, to make it happen every time a unit enters 500.00
range of the Demon[1], leave it like this.
To make it not happen every time a unit enters 500.00 range of the Demon[1](recommended) at the end, put "Trigger - Turn off (This trigger)" at the end. Now, it should work. :)

If you want to do this with another unit, copy and paste this trigger, replacing Demon[1] with whatever other unit you want. If you do this with a regular unit, it will create the item beside the unit instead of giving it. This is not tested with units that have backpack ability.
 
Level 6
Joined
Aug 29, 2004
Messages
159
How many times do i have to say this? :x

The "Unit - Unit comes within range" trigger event WILL NOT, repeat WILL NOT refer to a variable. It will ONLY refer to a specific unit which has already been placed in the editor, not a unit which has been created during the game. No matter how many variables you make.
Unless, of course, i am missing out something very important here...

Now i managed to find a way to do basically the same thing, except it gets a LOT more complicated... it's now a Periodic Event (every 0.01 seconds) it picks all units within 500 of Demon[1] matching lots of conditions.
A lot harder than just 'Unit comes within 500 of Demon','Unit is an enemy of Demon','kill triggering unit', ay?

Bort
 
Level 2
Joined
Apr 16, 2004
Messages
10
easy fix ready?
the trigger you want to have the range condition is Trigger A
the trigger to make that trigger work is Trigger B, i dont know when you need to call trigger b to enable A that is up to you, here is the HOW

make trigger a with everything you need but, NO EVENTS

in Trigger B make this action

Trigger - Add to Untitled Trigger A <gen> the event (Unit - A unit comes within 256.00 of UnitVariable)

then you can use the variable for the unit but when it makes the event it will be the unit name and will work.

any other questions let me know, if you really need i will post a demo map here with the actual triggers

Jimmy
 
Status
Not open for further replies.
Top