HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

My Problem

02-17-2007, 01:03 AM#1
TopWolf
My objective was to make it so that when a unit is summoned, its local handle variable is stored being the same as the summoner. Then when killed, I wanted the summoner to take damage equal to the maximum amount of health of the summoned unit. However I did not get the desired effects. Somehow the units are not having their "abc" set to the correct values and it becomes 0 killing all preplaced units.


Quote:
Finsished Buildings
Events
Unit - A unit Finishes construction
Unit - A unit Finishes an upgrade
Unit - A unit Cancels an upgrade
Conditions
Actions
-------- Start of Problem --------
Custom script: local unit myUnit = GetTriggerUnit()
Custom script: local integer i = udg_Counter
Custom script: call SetHandleInt(myUnit, "abc", i)
Set Counter = (Counter + 1)
-------- End of Problem --------

Quote:
Set Custom Value 2
Events
Unit - A unit Spawns a summoned unit
Conditions
Actions
-------- Start of Problem --------
Custom script: local integer i = GetHandleInt(GetSummoningUnit(), "abc")
Custom script: call SetHandleInt(GetSummonedUnit(), "abc", i)
Trigger - Add to Unit Takes Damage <gen> the event (Unit - (Summoned unit) Dies)
-------- End of Problem --------


Quote:
Unit Takes Damage 2
Events
Unit - A unit Dies
Conditions
Actions
Custom script: set udg_TempInt = GetHandleInt(GetTriggerUnit(), "abc")
Set TempGroup1 = (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to True))
Unit Group - Pick every unit in TempGroup1 and do (Actions)
Loop - Actions
Custom script: set udg_TempInt2 = GetHandleInt(GetEnumUnit(), "abc")
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A structure) Equal to False
TempInt Equal to TempInt2
Then - Actions
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (Max life of (Triggering unit)))
Else - Actions
02-17-2007, 01:10 AM#2
The)TideHunter(
I can't read any of that, please use trigger tags.
Paste the code you copied into the quote tags into trigger tags, its alot neater.

Example:

Input

[trigger]Melee Initialization
Events
Map initialization
Conditions
Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
Melee Game - Remove creeps and critters from used start locations (for all players)
Melee Game - Create starting units (for all players)
Melee Game - Run melee AI scripts (for computer players)
Melee Game - Enforce victory/defeat conditions (for all players)
[/trigger]



Output:

Trigger:
Melee Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
Melee Game - Remove creeps and critters from used start locations (for all players)
Melee Game - Create starting units (for all players)
Melee Game - Run melee AI scripts (for computer players)
Melee Game - Enforce victory/defeat conditions (for all players)
02-17-2007, 01:18 AM#3
TopWolf
Thanks for trying to help. As soon as I posted that I immediatly realized the solution to my problem. The answer lies in another trigger.