- Joined
- Sep 12, 2008
- Messages
- 657
Hey, i made a fishing system.. but it sort of messed up when i try to use it with 2 units..
(i used every 3 seconds cast the ability),
That didnt work so well..
i have no idea why, i used Arrays as player number of trigger unit.. and such..
heres the code:
Thanks in advance.. (Note, i made it from scratch).
(Sometimes the fish'es wont move, and sometimes the caster stays paused.. )
(i used every 3 seconds cast the ability),
That didnt work so well..
i have no idea why, i used Arrays as player number of trigger unit.. and such..
heres the code:
-
Fishing Setup
-

Events
-


Time - Elapsed game time is 0.05 seconds
-
-

Conditions
-

Actions
-


Set FishCount = 1
-


-------- If you make a new fish type, dont change anything, just copy paste the same set's. --------
-


-------- then just change fish name, and fish type --------
-


Set FishUnitType[FishCount] = Shells
-


Set FishUnitTypeName[FishCount] = Shells
-


Set Fishing_Chance[FishCount] = 100
-


Set FishCount = (FishCount + 1)
-
-
-
Start Fishing
-

Events
-


Unit - A unit Starts the effect of an ability
-
-

Conditions
-


(Ability being cast) Equal to Fishing Rod
-
-

Actions
-


Set Fishing_Caster[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
-


Set Fishing_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
-


Set Fishing_RNDChance[(Player number of (Owner of (Triggering unit)))] = (Random integer number between 1 and 100)
-


For each (Integer A) from 1 to FishCount, do (Actions)
-



Loop - Actions
-




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





If - Conditions
-






Fishing_RNDChance[(Player number of (Owner of (Triggering unit)))] Less than or equal to Fishing_Chance[(Integer A)]
-
-





Then - Actions
-






Unit - Pause Fishing_Caster[(Player number of (Owner of (Triggering unit)))]
-






Set Fishing_Point2[(Player number of (Owner of (Triggering unit)))] = ((Position of (Triggering unit)) offset by 350.00 towards (Facing of (Triggering unit)) degrees)
-






Unit - Create 1 FishUnitType[(Integer A)] for Neutral Passive at Fishing_Point2[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
-






Set Fishing_Dummy[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
-






Trigger - Turn on Start Fishing Loop <gen>
-
-





Else - Actions
-
-
-
-
-
-
Start Fishing Loop
-

Events
-


Time - Every 0.50 seconds of game time
-
-

Conditions
-

Actions
-


Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Berserk) Equal to True)) and do (Actions)
-



Loop - Actions
-




Set Fishing_Point4[(Player number of (Owner of (Picked unit)))] = (Position of Fishing_Dummy[(Player number of (Owner of (Picked unit)))])
-




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





If - Conditions
-






(Distance between Fishing_Point[(Player number of (Owner of (Picked unit)))] and Fishing_Point4[(Player number of (Owner of (Picked unit)))]) Less than or equal to 150.00
-
-





Then - Actions
-






Custom script: call RemoveLocation(udg_Fishing_Point[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
-






Custom script: call RemoveLocation(udg_Fishing_Point2[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
-






Unit - Remove Fishing_Dummy[(Player number of (Owner of (Picked unit)))] from the game
-






Unit - Unpause (Picked unit)
-






Unit - Remove Berserk buff from Fishing_Caster[(Player number of (Owner of (Picked unit)))]
-






Hero - Create Shells and give it to Fishing_Caster[(Player number of (Owner of (Picked unit)))]
-






Trigger - Turn off (This trigger)
-
-





Else - Actions
-






Animation - Play Fishing_Caster[(Player number of (Owner of (Triggering unit)))]'s attack animation
-






Set Fishing_Point3[(Player number of (Owner of (Picked unit)))] = ((Position of Fishing_Dummy[(Player number of (Owner of (Picked unit)))]) offset by 25.00 towards ((Facing of Fishing_Caster[(Player number of (Owner of (Picked unit)))]) + 180.00) degrees)
-






Unit - Move Fishing_Dummy[(Player number of (Owner of (Picked unit)))] instantly to Fishing_Point3[(Player number of (Owner of (Picked unit)))]
-






Custom script: call RemoveLocation(udg_Fishing_Point3[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
-
-
-




Custom script: call RemoveLocation(udg_Fishing_Point4[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
-
-
-
-
Thanks in advance.. (Note, i made it from scratch).
(Sometimes the fish'es wont move, and sometimes the caster stays paused.. )




