HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Units in a Loop

07-20-2004, 12:15 PM#1
Yukitan
Hello everyone, I have a little trouble this time ...

I am trying to assign a Variable to a Certain unit, the loop will keep working UNTIL the Unit die, the problem is that in the same time others units will spawn and use the same Variable name and Trigger ...

I successfully made this with JASS, the problem is that I rather just use a GUI version than a JASS one. (well it's because I'm lazy)

Do you think there is any way to do this ?

I had did a kinda same system in GUI for items who will disapear after a amount of time, but I was using Arrays instead of local variable.

Or should I just add a Local varial in the loop, that way It will keep every info without overwriting the others? (sorry for my english heh)
07-20-2004, 01:53 PM#2
johnfn
I think the best you will get is a sort of hybrid version of a GUI+JASS is the best you will get (because there are no endless loops in plain GUI). Maybe something like this:

Variables
isalive - integer

Code:
trigger 1
Events:
0.01  seconds have past
Actions

Custom script - loop
custom script - exitwhen udg_isalive = 1
(do your stuff in GUI)
custom script - endloop

Trigger 2
Events:
A unit dies
Conditions
(dying unit) Equal to (your loop unit)
Actions:
set variable isalive = 1

I think thats what you want; at least thats your best bet, a sort of hybrid JASS/GUI loop until the unit dies.
07-20-2004, 02:25 PM#3
Yukitan
Quote:
Originally Posted by johnfn
I think the best you will get is a sort of hybrid version of a GUI+JASS is the best you will get (because there are no endless loops in plain GUI). Maybe something like this:

Variables
isalive - integer

Code:
trigger 1
Events:
0.01  seconds have past
Actions

Custom script - loop
custom script - exitwhen udg_isalive = 1
(do your stuff in GUI)
custom script - endloop

Trigger 2
Events:
A unit dies
Conditions
(dying unit) Equal to (your loop unit)
Actions:
set variable isalive = 1

I think thats what you want; at least thats your best bet, a sort of hybrid JASS/GUI loop until the unit dies.

Yeah that's how I (almost) made it except I put Local Variable instead of using same variable ...

I also tried earlier the "UDG" but this isn't working at all, all I got so far is that it's not working properly.

Hmm ...

The worst to me is that even via using UMSWE I can not find a way to put a Custom JASS Variable ...

Like : "Unit - Set Life Percentenge" then I have to put for example "target" but instead I will have to convert it to Custom Text because there is no way to add a custom local variable ... >.<
__________________________________________________________

Just to give you a stupid example :

Event
A Unit is Attacked

Conditions
The unit-type of Attacked Unit is equal to Footman

set udg_footman = AttackedUnit()
Trigger run => Percentage Life trigger

__________________________________________________________

Event
None

Conditions
None

set unit target
set target = udg_footman

loop
exitwhen IsUnitDeadBJ(target)
Unit - Set life of (target) to 50.00% // Unfortunately THIS is not possible, or at least I do not see how without modifying the editor again ... So I have to put this instead =>
call SetUnitLifePercentBJ(target , 50.00) // Then this is working but I'll have to use actually all the time Custom Script, basically it's almost the same as working only via "Convert to Custom Text"
endloop