• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Fishing System. [Help]

Status
Not open for further replies.
Level 2
Joined
Jul 31, 2007
Messages
12
Ok im making a tribes map where you have to survive and all that stuff.
And i was gonna make a fishing system. can anyone help me or tell me how to make something like this?

Example: someone uses the ability "Fish" they sit there and wait till they catch one. and the higher ur lvl the higher the chance u have of catching a fish.
 
Level 5
Joined
Jul 11, 2007
Messages
152
Try the random integer with an ability so when the hero/unit casts the ability it triggers a random integer so say 1/4 times it triggers text saying "You caught a fish" and puts a fish in your inventory. Else for the other four text "Didn't catch anything" or whatever you want it to say.
 
Level 1
Joined
Jan 19, 2008
Messages
6
but, as Maddawn101 siad. how to make unit unmove untill caught a fish or player stop it. just loop.
example:
JASS:
local integer lv = GetUnitAbilityLevel( GetTriggerUnit(), 'A000')
// if ability of id 'A000' is the "Fishing",  lv is level of Fishing.
local boolean b = false
// use b to exit loop. when a unit/hero caught a fish, set b = true
loop
    if GetRandomInt( 1, 100 ) <= (lv+1)*5 then
         call CreateItemAtLoc( 'I000', GetUnitLoc( GetTriggerUnit() ) )
         // there, I set an item is "Fish",if Trigger unit caught it. Fishing end!
         set b = true
    endif 
    call TriggerSleepAction( 1.00 )// check it every 1.00 sec 
    exitwhen b == true
endloop

I use this menthod in maps. then, if you want stop fishing when unit has stop
cast ability, you could create a new trigger to check unit stop casting ability.
and , stop fishing.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
  • Events
    • Unit - a unit starts the effect of an ability
  • Conditions
    • Ability - ability being cast is "Fish"
  • Actions
    • For each (Integer Int) from 1 to 3, do (Actions)
      • Loop - 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 (Level of Fish for (Triggering unit))
          • Then - Actions
            • Set Int = 3
            • Item - Create Fish at (Position of (Triggering unit))
          • Else - Actions
            • Game - Display to (All players) the text: fail
            • Set Int = 1
            • Wait 1.00 seconds
Leaks a point.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Maybe "cast sleep or stun on unit" when it fishes to make it unmove?

You can either simply make the ability take time or you can pause/unpause with a trigger.

But there is 1 more problem how to make fishing allowed only near the water ?

Set Point = Target point of ability being casted
If Terrain Type at Point = bla bla // boolean conditions
Then - Your fishing actions
Else - Unit - Order (Triggering unit) to Stop
Show text to owner of triggering unit: you can't fish there !
Set (Triggering unit)'s mana to (Triggering unit)'s + Cost_Of_Ability
call RemoveLocation(udg_Point)

This requires that you put a specific terrain type inside the water !

  • Events
    • Unit - a unit starts the effect of an ability
  • Conditions
    • Ability - ability being cast is "Fish"
  • Actions
    • For each (Integer Int) from 1 to 3, do (Actions)
      • Loop - 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 (Level of Fish for (Triggering unit))
          • Then - Actions
            • Set Int = 3
            • Item - Create Fish at (Position of (Triggering unit))
          • Else - Actions
            • Game - Display to (All players) the text: fail
            • Set Int = 1
            • Wait 1.00 seconds

Why do you need a loop ?
Why do you need either of those "Set Int" ?
Why do you need that wait ?

They are all pretty useless.

Leaks a point.

Don't give em' leaky triggers, it takes the same time to write a point and remove it as it takes to write "Leaks a point" :D (yes I know its longer...).
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
You need a loop because once you start fishing (once you start casting the ability), you have to check every second if you got a fish or not. Seeing as how in GUI you only have For loops, you have to manipulate it a bit. So no, they're not useless.

And yes, it's longer. :p
Besides, people who don't fix the leaks THEMSELVES are too lazy and don't deserve a non-leaking map...
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Oh I got your loop point.
If I would be the maker I would prefer a one-chance spell but its whatever the maker wants :)
However, you still don't need those integers.

And a lot of map-makers don't even know about leaks.
I for one didn't know about them just a month or so ago.
If I would have ever finished a map (always start em'... never finish :p) it would have been probably so horribly leaking = lagging.

If you put a custom script however, the maker would probably ASK about it ("what the hell is that custom script doing?") and so we get yet another maker to know about leaks ! so its important to write them and not be lazy :)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
However, you still don't need those integers.
What integers?

And a lot of map-makers don't even know about leaks.
That's why I tell them they have to fix it. If they don't bother asking what it is or searching through the fora (or reading a damn sticky with an obvious title "THINGS THAT LEAK"), it's not my problem...
 
Status
Not open for further replies.
Top