[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Warcraft III Modding > Triggers & Scripts


Triggers & Scripts In this forum you may ask for help on fixing a trigger or script. But if you need help getting started with a trigger, this is not the right place — use the World Editor Help Zone.

Closed Thread
 
Thread Tools
Old 10-14-2009, 08:32 PM   #1 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
Help with Hash!

Ok,i have the following triggers in my map.I know it leaks,it is just fast made to see if it is working.I guess i do something wrong cause it doesn't work exactly as planned.Any suggestions?Here are the triggers:
BuffFelOrcTowers
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set Effect_Hash = (Last created hashtable)

MSFelOrcTowers
Events
Map initialization
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
((Triggering unit) is A structure) Equal to True
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower
Then - Actions
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\MagicSentry\MagicSentryCaster.mdl
Hashtable - Save Handle Of(Last created special effect) as (Key (Last created special effect)) of (Key (Picked unit)) in Effect_Hash
Else - Actions

RemoveBuffTowers
Events
Unit - A unit Dies
Conditions
((Triggering unit) is A structure) Equal to True
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower
Actions
Special Effect - Destroy (Load (Team number of Player 1 (Red)) of (Key (Picked unit)) in Effect_Hash)
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Effect_Hash
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Old 10-14-2009, 09:40 PM   #2 (permalink)
Registered User Marcelo Hossomi
Just "Hossomi" please x.x
 
Marcelo Hossomi's Avatar
 
Join Date: Dec 2005
Posts: 713
Marcelo Hossomi will become famous soon enough (117)Marcelo Hossomi will become famous soon enough (117)Marcelo Hossomi will become famous soon enough (117)
1. Two triggers have the Map Initialization event. Problem: the second depends on the first. Which of them happens first? You'd better make the first one run the second.

2. The second trigger uses (Triggering Unit) in its condition while no unit triggers the event. Therefore, (Triggering unit) == null.

3. Your use of hashtables makes no sense xD You should use keys that do not depend on the effect itself - your objective is to "get" it later, isn't it? So how are you going to get them if you actually "need" it to do so?

You could use the unit's key and then a number, meaning something like:
1 of unit = effect
__________________
"All your base are belong to us"
- God
Marcelo Hossomi is offline  
Old 10-15-2009, 10:10 AM   #3 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
1st,ok i merged the first 2 triggers into one.
2nd,fixed triggering unit with picked unit.
3nd,i didn't exactly get it...an example ?
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Old 10-15-2009, 10:28 AM   #4 (permalink)
Forum Moderator Maker
I...make things
 
Maker's Avatar
Resource Moderator
 
Join Date: Mar 2006
Posts: 7,617
Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)
Hashtable - Save Handle Of(Last created special effect) as (Key effect_1) of (Key (Picked unit)) in Effect_Hash

^Use "Hashtable - Get string ID" for effect_1

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
((Triggering unit) is A structure) Equal to True
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A structure) Equal to True
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower

^Those work the same way, use the lower version.
Maker is offline  
Old 10-15-2009, 10:39 AM   #5 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
How about this?
BuffFelOrcTowers
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set Effect_Hash = (Last created hashtable)
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A structure) Equal to True
(Owner of (Picked unit)) Equal to Player 8 (Pink)
(Unit-type of (Picked unit)) Equal to Fel Orc Watch Tower
Then - Actions
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\MagicSentry\MagicSentryCaster.mdl
Hashtable - Save Handle Of(Last created special effect) as (Key Effect1) of (Key (Picked unit)) in Effect_Hash
Else - Actions

RemoveBuffTowers
Events
Unit - A unit Dies
Conditions
((Triggering unit) is A structure) Equal to True
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower
Actions
Special Effect - Destroy (Load (Key Effect1) of (Key (Picked unit)) in Effect_Hash)
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Effect_Hash
Is this ok?
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Old 10-15-2009, 10:40 AM   #6 (permalink)
Registered User Coolty44
Nevar guna give u up!
 
Coolty44's Avatar
 
Join Date: Dec 2008
Posts: 622
Coolty44 will become famous soon enough (116)Coolty44 will become famous soon enough (116)Coolty44 will become famous soon enough (116)
Edit: Stop changing things before I post!!!! ARRGG
Coolty44 is offline  
Old 10-15-2009, 10:45 AM   #7 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
Sorry^^ Didn't know you were posting,xD!
And how is this one?
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Old 10-15-2009, 01:22 PM   #8 (permalink)
Forum Moderator Maker
I...make things
 
Maker's Avatar
Resource Moderator
 
Join Date: Mar 2006
Posts: 7,617
Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)
The hashtable usage looks ok.

Set Temp_Group = (Units within 128.00 of Temp_Loc_2 matching ((((Matching unit) is alive) Equal to True) and ((((Owner of (Matching unit)) is an enemy of (Owner of (Picked unit)...

I'd pick the group like this instead of usin if/then/else.

And the
((Picked unit) is A structure) Equal to True

is redundant, since you have

(Unit-type of (Picked unit)) Equal to Fel Orc Watch Tower
Maker is offline  
Old 10-15-2009, 07:30 PM   #9 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
Ok,so this is the final trigger.
How about it?
BuffFelOrcTowers
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set Effect_Hash = (Last created hashtable)
Set BuffTGroup = (Units owned by Player 8 (Pink) of type Fel Orc Watch Tower)
Unit Group - Pick every unit in BuffTGroup and do (Actions)
Loop - Actions
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\MagicSentry\MagicSentryCaster.mdl
Hashtable - Save Handle Of(Last created special effect) as (Key Effect1) of (Key (Picked unit)) in Effect_Hash
Custom script: call DestroyGroup(udg_BuffTGroup)

RemoveBuffTowers
Events
Unit - A unit Dies
Conditions
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
(Unit-type of (Triggering unit)) Equal to Fel Orc Watch Tower
Actions
Special Effect - Destroy (Load (Key Effect1) of (Key (Picked unit)) in Effect_Hash)
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Effect_Hash
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Old 10-15-2009, 07:44 PM   #10 (permalink)
Forum Moderator Maker
I...make things
 
Maker's Avatar
Resource Moderator
 
Join Date: Mar 2006
Posts: 7,617
Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)Maker has a reputation beyond repute (2488)
Move the custom script out of the loop.

Unit Group - Pick every unit in BuffTGroup and do (Actions)
Loop - Actions
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\MagicSentry\MagicSentryCaster.mdl
Hashtable - Save Handle Of(Last created special effect) as (Key Effect1) of (Key (Picked unit)) in Effect_Hash
Custom script: call DestroyGroup(udg_BuffTGroup)


Use triggering unit instead of picked unit, forgot to mention that earlier.
Actions
Special Effect - Destroy (Load (Key Effect1) of (Key (Triggering unit)) in Effect_Hash)
Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Effect_Hash
Maker is offline  
Old 10-15-2009, 07:49 PM   #11 (permalink)
Registered User reason 3
Guess what?
 
reason 3's Avatar
 
Join Date: Aug 2009
Posts: 1,579
reason 3 is a jewel in the rough (209)reason 3 is a jewel in the rough (209)
Done and thx :),i will +rep you once i spread :P
__________________
Windows Programmer ( C, C# )
reason 3 is offline  
Closed Thread

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hash table problems Fingolfin Triggers & Scripts 4 11-02-2009 12:17 PM
[Trigger] Will hash tables help with this? tml616 Triggers & Scripts 2 07-23-2009 10:05 PM
JassNewGen with hash tables? saphiree Warcraft Editing Tools 0 07-22-2009 02:19 PM
[JASS] Hash tables, collision detection Element of Water Triggers & Scripts 8 03-04-2009 08:56 AM
Wow hash help please. doom1364 Warcraft Editing Tools 0 09-23-2005 06:08 AM

All times are GMT. The time now is 06:56 PM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle