Moderator
M
Moderator
16:00, 11th Sep 2010
TriggerHappy:
Worked fine and could be useful.
TriggerHappy:
Worked fine and could be useful.
Fishing Initialization

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to |c00ffcc00F|r|c0066ffccish|r

Actions


-------- -------------------------- --------


-------- Creation of points, towards which the fishing net will move to. --------


-------- -------------------------- --------


Set F_P[1] = (Position of (Triggering unit))


Set F_P[2] = (F_P[1] offset by 200.00 towards ((Facing of (Triggering unit)) - 180.00) degrees)


Set F_P[3] = (F_P[1] offset by 200.00 towards (Facing of (Triggering unit)) degrees)


-------- -------------------------- --------


-------- Creation of the fishing net. --------


-------- -------------------------- --------


Unit - Create 1 Dummy (Fish) for (Owner of (Triggering unit)) at F_P[2] facing Default building facing degrees


-------- -------------------------- --------


-------- Special effect of the net. --------


-------- -------------------------- --------


Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Orc\Ensnare\ensnare_AirTarget.mdl


Hashtable - Save Handle Of(Last created special effect) as (Key airweb) of (Key (Last created unit)) in Fish_Hash


-------- -------------------------- --------


-------- The following action makes the fisherman look at his net, as if he is looking at it, while throwing it (realism) --------


-------- -------------------------- --------


Animation - Lock (Triggering unit)'s Head to face (Last created unit), offset by (0.00, 0.00, 90.00)


-------- -------------------------- --------


-------- Saving values for later use. --------


-------- -------------------------- --------


Hashtable - Save 500.00 as (Key hegh) of (Key (Last created unit)) in Fish_Hash


Hashtable - Save (X of F_P[3]) as (Key x) of (Key (Last created unit)) in Fish_Hash


Hashtable - Save (Y of F_P[3]) as (Key y) of (Key (Last created unit)) in Fish_Hash


Hashtable - Save Handle Of(Last created unit) as (Key dummyweb) of (Key (Triggering unit)) in Fish_Hash


Hashtable - Save Handle Of(Triggering unit) as (Key fisher) of (Key (Last created unit)) in Fish_Hash


Hashtable - Save 200.00 as (Key distance) of (Key (Triggering unit)) in Fish_Hash


-------- -------------------------- --------


-------- The fishing net dummy is added to the unit group, so that we make the effect of throwing it forward. --------


-------- -------------------------- --------


Unit Group - Add (Last created unit) to Fish_DummyGroup


-------- -------------------------- --------


Sound - Play HeadHunterMissileLaunch <gen> at 100.00% volume, attached to (Triggering unit)


-------- -------------------------- --------


-------- Lightning creation, we will imitate the fishing string. --------


-------- -------------------------- --------


Custom script: set udg_Fish_Lightning = AddLightningEx("LEAS", true, GetLocationX (udg_F_P[1]), GetLocationY(udg_F_P[1]), (GetLocationZ(udg_F_P[1])+100), GetLocationX(udg_F_P[2]), GetLocationY(udg_F_P[2]), GetLocationZ(udg_F_P[2]))


Hashtable - Save Handle OfFish_Lightning as (Key lightning) of (Key (Last created unit)) in Fish_Hash


Hashtable - Save Handle OfFish_Lightning as (Key lightning) of (Key (Triggering unit)) in Fish_Hash


-------- -------------------------- --------


-------- -------------------------- --------


Custom script: call RemoveLocation (udg_F_P[1])


Custom script: call RemoveLocation (udg_F_P[2])


Custom script: call RemoveLocation (udg_F_P[3])


-------- -------------------------- --------


-------- -------------------------- --------


Trigger - Turn on Fish Dummy Move and Light <gen>
Fish Dummy Move and Light

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Fish_DummyGroup is empty) Equal to True



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions




Unit Group - Pick every unit in Fish_DummyGroup and do (Actions)





Loop - Actions






-------- -------------------------- --------






-------- Don't worry about the custom value, it is not used on the fisherman, it is used on the dummy net. --------






-------- -------------------------- --------






Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 3)






Set Fish_Height = (3600.00 - (Power(((Real((Custom value of (Picked unit)))) - 60.00), 2.00)))






Animation - Change (Picked unit) flying height to (Fish_Height / (3600.00 / (Load (Key hegh) of (Key (Picked unit)) from Fish_Hash))) at 0.00






-------- -------------------------- --------






Set F_P[4] = (Position of (Picked unit))






Set F_P[5] = (Point((Load (Key x) of (Key (Picked unit)) from Fish_Hash), (Load (Key y) of (Key (Picked unit)) from Fish_Hash)))






Set F_P[6] = (F_P[4] offset by 8.00 towards (Angle from F_P[4] to F_P[5]) degrees)






Set F_P[7] = (Position of (Load (Key fisher) of (Key (Picked unit)) in Fish_Hash))






-------- -------------------------- --------






Unit - Move (Picked unit) instantly to F_P[6]






-------- -------------------------- --------






Set Fish_LightLoad = (Load (Key lightning) of (Key (Picked unit)) in Fish_Hash)






Set F_H = (Current flying height of (Picked unit))






Custom script: call MoveLightningEx(udg_Fish_LightLoad, true, GetLocationX(udg_F_P[7]), GetLocationY(udg_F_P[7]), (GetLocationZ(udg_F_P[7])+100), GetLocationX(udg_F_P[4]), GetLocationY(udg_F_P[4]), (GetLocationZ(udg_F_P[4])+udg_F_H))






-------- -------------------------- --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Custom value of (Picked unit)) Greater than or equal to 120







Then - Actions








-------- -------------------------- --------








Special Effect - Destroy (Load (Key airweb) of (Key (Picked unit)) in Fish_Hash)








Animation - Change (Picked unit)'s size to (150.00%, 150.00%, 150.00%) of its original size








Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\Ensnare\ensnareTarget.mdl








Hashtable - Save Handle Of(Last created special effect) as (Key airweb) of (Key (Picked unit)) in Fish_Hash








Animation - Reset (Load (Key fisher) of (Key (Picked unit)) in Fish_Hash)'s body-part facing








Animation - Queue (Load (Key fisher) of (Key (Picked unit)) in Fish_Hash)'s stand gold animation








-------- -------------------------- --------








Unit Group - Add (Load (Key fisher) of (Key (Picked unit)) in Fish_Hash) to Fish_FisherGroup








Unit Group - Remove (Picked unit) from Fish_DummyGroup








-------- -------------------------- --------








Trigger - Turn on Fishing Introduction <gen>







Else - Actions






-------- -------------------------- --------






Custom script: call RemoveLocation (udg_F_P[4])






Custom script: call RemoveLocation (udg_F_P[5])






Custom script: call RemoveLocation (udg_F_P[6])






Custom script: call RemoveLocation (udg_F_P[7])
Fishing Introduction

Events


Time - Every 1.00 seconds of game time

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Fish_FisherGroup is empty) Equal to True



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions




Unit Group - Pick every unit in Fish_FisherGroup and do (Actions)





Loop - Actions






-------- -------------------------- --------






Set F_P[8] = (Position of (Picked unit))






-------- -------------------------- --------






-------- Fishing Distance determines how far the fishing net will go. Maximum range is 1000, where it will automatically --------






-------- stop the net from being thrown forward. --------






-------- -------------------------- --------






Set Fish_FishingDistance = (Load (Key distance) of (Key (Picked unit)) from Fish_Hash)






Hashtable - Save (Fish_FishingDistance + 200.00) as (Key distance) of (Key (Picked unit)) in Fish_Hash






Set F_P[9] = (F_P[8] offset by Fish_FishingDistance towards (Facing of (Picked unit)) degrees)






-------- -------------------------- --------






-------- -------------------------- --------






-------- -------------------------- --------






Set F_WebDummyH[1] = (Load (Key dummyweb) of (Key (Picked unit)) in Fish_Hash)






-------- -------------------------- --------






-------- -------------------------- --------






Set F_WebDummy[1] = (Load (Key dummyweb) of (Key (Picked unit)) in Fish_Hash)






-------- -------------------------- --------






-------- -------------------------- --------






-------- You detect whether the fishing goes further than 5*200 (The increasing distance per second); if it does, it stops increasing. --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








Fish_FishingDistance Less than or equal to 1000.00







Then - Actions








-------- -------------------------- --------








-------- The following condition checks if the fishing net still lies in the water. --------








-------- -------------------------- --------








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










(Terrain pathing at F_P[9] of type Floatability is off) Equal to False









Then - Actions










-------- -------------------------- --------










Sound - Play Submerge1 <gen> at 100.00% volume, located at F_P[9] with Z offset 0.00










Special Effect - Create a special effect at F_P[9] using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl










Special Effect - Destroy (Last created special effect)










-------- -------------------------- --------










Unit - Move F_WebDummy[1] instantly to F_P[9]










Set Fish_LightLoad = (Load (Key lightning) of (Key (Picked unit)) in Fish_Hash)










-------- -------------------------- --------










-------- This will detect if you are fishing in deep water or not. --------










-------- NOTE: The value (2) depends on the initial cliff level of your map, so toy around with the value! --------










-------- -------------------------- --------










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












(Terrain cliff level at F_P[9]) Less than or equal to 2











Then - Actions












Custom script: call MoveLightningEx(udg_Fish_LightLoad, true, GetLocationX(udg_F_P[8]), GetLocationY(udg_F_P[8]), (GetLocationZ(udg_F_P[8])+100), GetLocationX(udg_F_P[9]), GetLocationY(udg_F_P[9]), GetLocationZ(udg_F_P[9])-25)












Hashtable - Save True as (Key deep) of (Key (Picked unit)) in Fish_Hash











Else - Actions












Custom script: call MoveLightningEx(udg_Fish_LightLoad, true, GetLocationX(udg_F_P[8]), GetLocationY(udg_F_P[8]), (GetLocationZ(udg_F_P[8])+100), GetLocationX(udg_F_P[9]), GetLocationY(udg_F_P[9]), GetLocationZ(udg_F_P[9])+75)












Hashtable - Save False as (Key deep) of (Key (Picked unit)) in Fish_Hash









Else - Actions










-------- -------------------------- --------










-------- If the point the fishing net is thrown towards is not a water area, the fishing will be aborted. --------










-------- -------------------------- --------










Unit - Order (Picked unit) to Stop










Animation - Reset (Picked unit)'s animation










Lightning - Destroy (Load (Key lightning) of (Key (Picked unit)) in Fish_Hash)










Custom script: call SimError (GetOwningPlayer(GetEnumUnit()), "That is not a valid point.", "ErrorMessage")










Unit - Kill F_WebDummy[1]










Special Effect - Destroy (Load (Key airweb) of (Key F_WebDummyH[1]) in Fish_Hash)










Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Fish_Hash










Hashtable - Clear all child hashtables of child (Key F_WebDummyH[1]) in Fish_Hash










Unit Group - Remove (Picked unit) from Fish_FisherGroup







Else - Actions








Unit - Add a (Random real number between 5.00 and 10.00) second Generic expiration timer to F_WebDummy[1]








Hashtable - Save True as (Key fishingon) of (Key (Picked unit)) in Fish_Hash








Hashtable - Save True as (Key result) of (Key F_WebDummyH[1]) in Fish_Hash








Unit Group - Remove (Picked unit) from Fish_FisherGroup






Custom script: call RemoveLocation (udg_F_P[8])






Custom script: call RemoveLocation (udg_F_P[9])
Fishing Distance Control

Events

Conditions

Actions


Set Fish_TempGroup = (Units owned by (Triggering player) matching (((Load (Key fishingon) of (Key (Matching unit)) from Fish_Hash) Not equal to True) and ((((Matching unit) is selected by (Triggering player)) Equal to True) and (((Owner of (Matching unit)) Equal to (Triggering pl


Unit Group - Pick every unit in Fish_TempGroup and do (Actions)



Loop - Actions




Custom script: local group g




Custom script: local unit u




Custom script: local integer id




Unit Group - Remove (Picked unit) from Fish_FisherGroup




Set F_WebDummyH[2] = (Load (Key dummyweb) of (Key (Picked unit)) in Fish_Hash)




Set F_WebDummy[2] = (Load (Key dummyweb) of (Key (Picked unit)) in Fish_Hash)




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Number of units in Fish_TempGroup) Equal to 1





Then - Actions






Unit - Add a (Random real number between 5.00 and 10.00) second Generic expiration timer to F_WebDummy[2]






Hashtable - Save Handle Of(Picked unit) as (Key fisher) of (Key F_WebDummyH[2]) in Fish_Hash






Hashtable - Save True as (Key result) of (Key F_WebDummyH[2]) in Fish_Hash






Hashtable - Save True as (Key fishingon) of (Key (Picked unit)) in Fish_Hash






Hashtable - Save Handle OfF_WebDummy[2] as (Key resultd) of (Key (Picked unit)) in Fish_Hash





Else - Actions






Custom script: set g = CreateGroup()






Unit - Remove F_WebDummy[2] from the game






Custom script: set u = CreateUnit (GetOwningPlayer(GetEnumUnit()), 'h000', 0, 0, 0)






Custom script: set id = GetHandleId (u)






Custom script: call ShowUnit (u, false)






Custom script: call UnitApplyTimedLife (u, 'BTLF', GetRandomReal (5, 10))






Custom script: call SaveBoolean (udg_Fish_Hash, id, StringHash("result"), true)






Custom script: call GroupAddUnit (g, GetEnumUnit())






Custom script: call SaveGroupHandle (udg_Fish_Hash, id, StringHash("egroup"), g)






Hashtable - Save True as (Key fishingon) of (Key (Picked unit)) in Fish_Hash




Custom script: set g = null




Custom script: set u = null


Custom script: call DestroyGroup (udg_Fish_TempGroup)
Fishing Result

Events


Unit - A unit Dies

Conditions


(Unit-type of (Triggering unit)) Equal to Dummy (Fish)

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Load (Key result) of (Key (Triggering unit)) from Fish_Hash) Equal to True



Then - Actions




-------- We now try to find whether the player pressed Escape, while he had 1+ units selected or only one. --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






((Key egroup) is stored as a Handle of (Key (Triggering unit)) in Fish_Hash) Equal to False





Then - Actions






-------- Depending on the water level you chose to fish at, you have two options: --------






-------- a) Fish at a low level water point, with a 100% chance to earn some gold. --------






-------- b) Fish at a deep level water point, with a 20% chance to earn Grade A items, 40% chance to earn Grade B items, 60% Grade C items. --------






Set Fish_FisherLoad = (Load (Key fisher) of (Key (Triggering unit)) in Fish_Hash)






Set Fish_FisherLoadHandle = (Load (Key fisher) of (Key (Triggering unit)) in Fish_Hash)






Animation - Reset Fish_FisherLoad's animation






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Load (Key deep) of (Key Fish_FisherLoadHandle) from Fish_Hash) Equal to True







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










(Random integer number between 1 and 100) Less than or equal to 20









Then - Actions










Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found an A grade item.", "GoodJob")










Hero - Create (Random level (Random integer number between 5 and 7) item-type) and give it to Fish_FisherLoad









Else - Actions










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












(Random integer number between 1 and 100) Less than or equal to 40











Then - Actions












Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found a B grade item.", "GoodJob")












Hero - Create (Random level (Random integer number between 3 and 5) item-type) and give it to Fish_FisherLoad











Else - Actions












If (All Conditions are True) then do (Then Actions) else do (Else Actions)













If - Conditions














(Random integer number between 1 and 100) Less than or equal to 60













Then - Actions














Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found a C grade item.", "GoodJob")














Hero - Create (Random level (Random integer number between 0 and 2) item-type) and give it to Fish_FisherLoad













Else - Actions














Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You were unlucky.", "")







Else - Actions








-------- You can change the gold received here with the amount you want. --------








Set F_Gold = (Random integer number between 10 and 500)








Player - Add F_Gold to (Owner of Fish_FisherLoad) Current gold








Floating Text - Create floating text that reads (|cffffcc00+ + ((String(F_Gold)) + |r)) above Fish_FisherLoad with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency








Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees








Floating Text - Change (Last created floating text): Disable permanence








Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds








Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds






-------- Removing used data from the caster --------






Lightning - Destroy (Load (Key lightning) of (Key Fish_FisherLoadHandle) in Fish_Hash)






Hashtable - Clear all child hashtables of child (Key Fish_FisherLoadHandle) in Fish_Hash





Else - Actions






Unit Group - Pick every unit in (Load (Key egroup) of (Key (Triggering unit)) in Fish_Hash) and do (Actions)







Loop - Actions








Animation - Reset (Picked unit)'s animation








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










(Load (Key deep) of (Key (Picked unit)) from Fish_Hash) Equal to True









Then - Actions










If (All Conditions are True) then do (Then Actions) else do (Else Actions)











If - Conditions












(Random integer number between 1 and 100) Less than or equal to 20











Then - Actions












Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found an A grade item.", "GoodJob")












Hero - Create (Random level (Random integer number between 5 and 7) item-type) and give it to (Picked unit)











Else - Actions












If (All Conditions are True) then do (Then Actions) else do (Else Actions)













If - Conditions














(Random integer number between 1 and 100) Less than or equal to 40













Then - Actions














Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found a B grade item.", "GoodJob")














Hero - Create (Random level (Random integer number between 3 and 5) item-type) and give it to (Picked unit)













Else - Actions














If (All Conditions are True) then do (Then Actions) else do (Else Actions)















If - Conditions
















(Random integer number between 1 and 100) Less than or equal to 60















Then - Actions
















Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You have found a C grade item.", "GoodJob")
















Hero - Create (Random level (Random integer number between 0 and 2) item-type) and give it to (Picked unit)















Else - Actions
















Custom script: call SimError (GetOwningPlayer(GetTriggerUnit()), "You were unlucky.", "")









Else - Actions










-------- You can change the gold received here with the amount you want. --------










Set F_Gold = (Random integer number between 10 and 500)










Player - Add F_Gold to (Owner of (Picked unit)) Current gold










Floating Text - Create floating text that reads (|cffffcc00+ + ((String(F_Gold)) + |r)) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency










Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees










Floating Text - Change (Last created floating text): Disable permanence










Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds










Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds








Lightning - Destroy (Load (Key lightning) of (Key (Picked unit)) in Fish_Hash)








Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Fish_Hash






Custom script: call DestroyGroup (LoadGroupHandle (udg_Fish_Hash, GetHandleId (GetTriggerUnit()), StringHash("egroup")))



Else - Actions


Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Fish_Hash


Unit - Remove (Triggering unit) from the game
Fishing Abandon

Events


Unit - A unit Is issued an order with no target


Unit - A unit Is issued an order targeting a point


Unit - A unit Is issued an order targeting an object

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




Or - Any (Conditions) are true





Conditions






((Triggering unit) is in Fish_FisherGroup) Equal to True






(Load (Key fishingon) of (Key (Triggering unit)) from Fish_Hash) Equal to True



Then - Actions




Set F_WebDummy[3] = (Load (Key dummyweb) of (Key (Triggering unit)) in Fish_Hash)




Set F_WebDummyH[3] = (Load (Key dummyweb) of (Key (Triggering unit)) in Fish_Hash)




Unit Group - Remove (Triggering unit) from Fish_FisherGroup




Special Effect - Destroy (Load (Key airweb) of (Key F_WebDummyH[3]) in Fish_Hash)




Unit - Kill F_WebDummy[3]




Lightning - Destroy (Load (Key lightning) of (Key (Triggering unit)) in Fish_Hash)




Hashtable - Clear all child hashtables of child (Key F_WebDummyH[3]) in Fish_Hash




Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Fish_Hash



Else - Actions