• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Question about [Last Created Unit]

Status
Not open for further replies.
Level 4
Joined
Jul 20, 2005
Messages
107
I've made 2 trigger. and trigger A create unit A while trigger B create unit B.

Trigger A
Event- Unit cst skill
Condition - Skill = A
Action
- Cre8 unit A for owning of unit A
- Wait 5 sec
- Remove LAST CREATED UNIT

Trigger B
Event- Unit cst skill
Condition - Skill = B
Action
- Cre8 unit A for owning of unit B
- Wait 5 sec
- Remove LAST CREATED UNIT

If i use cast skill A first, then cast skill B, Unit B will be gone but unit A is still there. is there anyway to prevant this? I know i can use variable.. but if i do so... there will a lot of them since there are a lot of skill require dummy unit.

or can some1 teach me using custom script to prevant this bug.
Will same thing happen to CASTING unit too?

Thx
 
Last edited:
Level 27
Joined
Sep 24, 2006
Messages
4,979
Trigger A
Condition - Skill = A
Action
- Cre8 unit A for owning of unit A
- Wait 5 sec
- Remove LAST CREATED UNIT

Trigger B
Event- Unit cst skill
Condition - Skill = B
Action
- Cre8 unit A for owning of unit B
- Wait 5 sec
- Remove LAST CREATED UNIT

At first,plz type out your triggers,because words like 'Cre8' and 'cst' make me a bit confused :pEvent- Unit cst skill,But i will edit your trigger so it would work,when you open the trigger editor you will see on the left the triggers and maps .. in the left corner you see your actions,events and conditions and above that you see the 'trigger comment' near this is the button with an 'X' press the X and so you enter the variable editor,then press 'create new variable' name the variable 'Unit A' and variable type 'Unit'. Then press the variable you just create and press CTRL+C and CTRL+V to copy it,only change the name of the just copied variable to 'Unit B' and voila.
Now back to the triggers.

Event- Unit casts skill
Condition - Skill = A
Action
- Create unit A for owning of unit A
- (Variable) Set unit A = Lasted created unit
- Wait 5 sec
- Remove (variable) (unit A)

Trigger B
Event- Unit casts skill
Condition - Skill = B
Action
- Create unit A for owning of unit B
- (Variable) Set unit B = Lasted created unit
- Wait 5 sec
- Remove (variable) (unit B)

That should work,i didnt know if you where familiar with variables so i explained :p
 
Level 4
Joined
Jul 20, 2005
Messages
107
I already know that.... I am asking if there is any way to fix this by not using variable... and you tell me to use variable again...

Well anyway... i've found a way to fix this thing and it doesn't require variable. Thx anyway.
 
Level 2
Joined
Jul 21, 2005
Messages
32
Put "wait 0 second" or cancel the wait action. Anyway, whats the problem if use variables? They work perfectly fine.
 
Level 4
Joined
Jul 20, 2005
Messages
107
the reason i put waiting time is because the unit need to cast a spell. If 0 waiting time, then it won't cast. And if i use variable, there will be tons of variable which i rather not do so.

So basically this is wad i do.
Add expiration time to last created unit be4 the wait event.
 
Level 27
Joined
Sep 24, 2006
Messages
4,979
I already know that.... I am asking if there is any way to fix this by not using variable... and you tell me to use variable again...

Well anyway... i've found a way to fix this thing and it doesn't require variable. Thx anyway.

Omg you filthy tricker >>Last edited by You Win : Yesterday at 08:54 AM.<< when you first posted this those words of not using variables werent in it and u didnt type out the trigger like it ment to be omg .. ur mean ..
 
Level 4
Joined
Jul 20, 2005
Messages
107
Omg you filthy tricker >>Last edited by You Win : Yesterday at 08:54 AM.<< when you first posted this those words of not using variables werent in it and u didnt type out the trigger like it ment to be omg .. ur mean ..

You sure?
Last edited by You Win : 03-04-2007 at 07:54 AM.
and you post at
03-04-2007 11:36 AM

Well anyway... sry for the trouble... and i still wanna thx you for trying to help. =)
 
Level 4
Joined
Jul 20, 2005
Messages
107
Trust me... too many variable will reduce the loading speed and might make you confuse if you put too many array. And why do i need to use variable when i don't have to?
 
Status
Not open for further replies.
Top