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 08-30-2008, 11:15 AM   #1
krambuhl
User
 
Join Date: Aug 2008
Posts: 4

krambuhl has little to show at this moment (0)

Question GetAboutToBeTrainedUnit ()

So I'm working on a training system where i can dynamically change the training time so an ability will give the player a 10 second chance to have instant training.

This is what have so far:

Trigger:
Training
Collapse Events
Unit - A unit Begins training a unit
Collapse Conditions
Triggering unit has buff War Time Equal to == True
Collapse Actions
Wait 1.00 seconds
Unit - Order (Triggering unit) to Cancel
Unit - Create 1 (Unit-type of (#######)) for (Triggering player) at (Position of (Triggering unit)) facing 0.00 degrees

where i have ######## i want to get the trained unit, except (trained Unit) gets the unit only if the training is finished. Is there a 'GetAboutToBeTrainedUnit ()' function that i am not aware of? If only in JASS im completely comfortable in that.

Thanks, Krambuhl

Last edited by Pyrogasm : 08-31-2008 at 03:58 AM.
krambuhl is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-30-2008, 11:53 AM   #2
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

There is only one way to do it...

Personal building for every unit.
DioD is offline   Reply With Quote
Old 08-30-2008, 12:41 PM   #3
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

There's a method but it's not the cleanest.

1. Give the building a spell book with the list of trainable units but DO NOT let it be able to train any
2. When it uses a training order, allow it to train a unit
3. Train that unit > If it's X then give money back
4. Disallow it from training that unit

I don't have World Editor with me at the moment, but I hope that helps. By the way, your current method encourages spam because if you cancel training, you get money back.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Old 08-31-2008, 02:00 AM   #4
aquilla
User
 
aquilla's Avatar
 
Join Date: Mar 2003
Posts: 217

Submissions (1)

aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)

Send a message via MSN to aquilla
Default

I would assume that the unit beginning the training is issued an order where the unit to trained would be its OrderId. Did you try this approach? If it is indeed so it would be fairly simple to catch the id

edit: it wouldn't be as simple to make it unexploitable
__________________
You don't care what I've listened to lately
but I'll tell you anyway,
because that's the only thing I'm good at.

Last edited by aquilla : 08-31-2008 at 02:08 AM.
aquilla is offline   Reply With Quote
Old 08-31-2008, 11:47 AM   #5
krambuhl
User
 
Join Date: Aug 2008
Posts: 4

krambuhl has little to show at this moment (0)

Default

Trigger:
Training
Collapse Events
Unit - A unit Begins training a unit
Collapse Conditions
((Triggering unit) has buff War Time ) Equal to (==) True
Collapse Actions
Unit - Order (Triggering unit) to Cancel
Unit - Create 1 (Trained unit-type) for Player 9 (Gray) at (Center of rect_in[110]) facing 0.00 degrees
Unit - Turn collision for (Last created unit) Off
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - spawn_cost[(Integer((String((Trained unit-type)))))])

I figured a way to do this, the trained unit-type doesnt take into consideration whether the unit is canceled. And i took into concideration the gold cost of the unit by setting up a array with the index of the unitId like this:

Code:
    
     set udg_spawn_type[0] = 'h000'
    set udg_spawn_cost['h000'] = 5

Thanks for the help guys, and I hope this solution can help you.
krambuhl 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 09:38 PM.


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