wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 02-28-2010, 10:14 AM   #1
ray_sloth
User
 
Join Date: Feb 2010
Posts: 11

ray_sloth has little to show at this moment (0)

Default I need help with adding a unit to a variable.

I honestly have no idea how this question is posed, but I'm trying to create an item and give it to a specific hero unit upon the hero unit's creation. If I wanted to assign this specific unit to a variable, how the heck do I do that? alot of the tutorials that I've stumbled across on google have simply told me "Just add the unit to the variable.".

I suppose this is two questions in one thread.

Question one: How do you assign a unit that hasn't been added to the map (I mean physically placed there.)

Question two: Is there an easier way to do this outside of triggers


Little frustrated cause google sucks at finding a decent tutorial (found a bunch of world of warcraft websites) and the methods I've tried for the past two days straight haven't worked. (my eyes hurt)
ray_sloth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-28-2010, 12:22 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

First, create the unit.
Then, set the variable to "last crated unit".
__________________
Anitarf is offline   Reply With Quote
Old 02-28-2010, 01:27 PM   #3
ray_sloth
User
 
Join Date: Feb 2010
Posts: 11

ray_sloth has little to show at this moment (0)

Default

thanks so much for the answer!

Errrr, wait a moment, are you asking me to create a unit through a trigger?

I already have the unit created in the object editor. It's purchasable from a... shop/thing.







Argh!!! My brain is fried! I keep hitting the "Add Reply" button when I finish my post edit!!!!



edit: Anitarf, where'd you goooooooooooooooooooooooooooooooooooooooooooooo?! ;_;

Last edited by ray_sloth : 02-28-2010 at 02:45 PM.
ray_sloth is offline   Reply With Quote
Old 02-28-2010, 03:22 PM   #4
Deaod
User
 
Join Date: Jan 2007
Posts: 542

Submissions (11)

Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)Deaod is a jewel in the rough (192)

Default

Theres an event called "A Unit sells a unit". Just fiddle with that. From what i gathered you dont even need a variable.
__________________
Deaod is offline   Reply With Quote
Old 02-28-2010, 03:56 PM   #5
ray_sloth
User
 
Join Date: Feb 2010
Posts: 11

ray_sloth has little to show at this moment (0)

Default

Oh cool, thank you Deaod for that info. I did a search based off of that and it turns out I can associate that event with a condition of "Unit - type of (selling unit)) Equal to Mygivenbuildingthatcreatestheunit"

Cheers.

Gonna test it right now.


edit: I tested the aforementioned event and condition with the action: Hero - create specifieditem and give it to (Last created unit)

and it didn't work. I tried a few other combinations of events/conditions/actions, but they gave the same result which was the inventory staying empty for the hero upon creation.

edit: I guess a temporary fix would be to give the hero the items after it learns it's first spell. *shrug*, i'll keep messing with this world editor. Thank you so much for this info.

Last edited by ray_sloth : 02-28-2010 at 05:32 PM.
ray_sloth is offline   Reply With Quote
Old 02-28-2010, 06:43 PM   #6
Anopob
Yay!
 
Anopob's Avatar
 
Join Date: May 2006
Posts: 870

Anopob has a spectacular aura about (120)

Default

Last created unit is only for a unit that's actually CREATED through triggers.

Since your event is about a unit selling another unit, to reference the unit being purchased (aka the mercenary/hero), use "Sold Unit".
__________________
Give +REP to people who help you with things or make good resources.
Better Ways of Requesting For Help - Race Contest #2 WIP Thread (Bone Race)
As of December 1st I have my blue rep. Yay :D
Anopob is offline   Reply With Quote
Old 02-28-2010, 09:07 PM   #7
ray_sloth
User
 
Join Date: Feb 2010
Posts: 11

ray_sloth has little to show at this moment (0)

Default

Yay! It worked, thank you for the info Anopob!
ray_sloth is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:06 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services