• 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 Error

Status
Not open for further replies.
Level 3
Joined
Dec 20, 2010
Messages
48
Well, since my English is bad then I will tell you what's my problem badly . . (sorry bout that).

I'm making a map with professions.One of them is Fishing ! Here is the trigger I make :
  • Fishing
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 0 and 10) Equal to 7
            • Then - Actions
              • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Casting unit)
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Bro...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 0 and 10) Equal to 8
                • Then - Actions
                  • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 0 and 10) Equal to 2
                    • Then - Actions
                      • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
                    • Else - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've failed to ca...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Don't try to fishin...
The problem here is the player can fishing at land.(even I have made this
  • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
Can anyone give me a solutions ? + repp to you who tried or help me :ogre_haosis:
 
He can finish while on land because you're checking the casting position and not the unit's position.

Also, you have memory leaks.

These:
  • (Target point of ability being cast)
  • (Player group((Owner of (Triggering unit))))
leak.

For the location, you should store it in a point variable and then, at the end of the trigger, remove it like this:

  • Custom script: call RemoveLocation(udg_NameOfPointVariable)
The player group leaks shouldnt even be there :/
Just use the players directly.
 
I'll fix your trigger in a sec. This condition should be helpfull:
  • (Terrain type at (Center of (Playable map area))) Equal to WATERRRRRRRRRR
  • Fishing
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set p = (Target point of ability being cast)
      • Set force = (Player group(Triggering player))
      • Set i = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at p of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: elseif udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
          • Custom script: elseif udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
          • Custom script: endif
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: call DestroyForce(udg_force)
 
Last edited:
Level 3
Joined
Dec 20, 2010
Messages
48
  • Fishing
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set Fishing_Loc = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 0 and 10) Equal to 7
            • Then - Actions
              • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Casting unit)
              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Bro...
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 0 and 10) Equal to 8
                • Then - Actions
                  • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 0 and 10) Equal to 2
                    • Then - Actions
                      • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
                    • Else - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've failed to ca...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Don't try to fishin...
          • Custom script: call RemoveLocation(udg_Fishing_Loc)
I've done what magtheridon said (upper) and for spinnnaker's : I can't find the terrain type for water . . another solution please ?

I'm bad on trigger leaks please check it again and tell me what I must fix heh :ogre_haosis:
 
Level 3
Joined
Dec 20, 2010
Messages
48
I'll fix your trigger in a sec. This condition should be helpfull:
  • (Terrain type at (Center of (Playable map area))) Equal to WATERRRRRRRRRR
  • Fishing
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set p = (Target point of ability being cast)
      • Set force = (Player group(Triggering player))
      • Set i = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at p of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: elseif udg_i == 8
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
          • Custom script: elseif udg_i == 2
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_p)
      • Custom script: call DestroyForce(udg_force)

Umm . .
I've tried what you said but I can save my map because some errors.
It said Missing Endif . .
Need your help once again

Here is mine :
  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Bro...
          • Custom script: if udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
          • Custom script: if udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've failed to ca...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
 
I don't understand about the integer to creating a new one each time . .
An example please . . ?

It's because the chances of catching a fish would still be 9.0909%
If you create an integer and set it to a random integer between 0 and 10,
The chances of catching a fish would be 27.27% (Which I'm pretty sure is what you want)

If you want a 30% chance, get a random integer between 1 and 10 (not 0 and 10)

I see you fixed that now, but I was just explaining for future refference :p

Also:

  • Custom script: if udg_i == 8
->
  • Custom script: if udg_i == 8 then
:3


And:

  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Bro...
          • Custom script: if udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Sil...
          • Custom script: if udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Casting unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You've failed to ca...
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
->

  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set TempUnit = (Triggering Unit)
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to TempUnit
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: elseif udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to TempUnit
          • Game - Display to force the text: You've caught a Sil...
          • Custom script: elseif udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to TempUnit
          • Game - Display to force the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
          • Custom script: endif
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
 
Level 3
Joined
Dec 20, 2010
Messages
48
Gonna to test it

Thx be4 and wait for my Edit

Edit : This error approach again. Here is the image that show the error.And what does it mean ?
oZWeV.png
 
Last edited:
Level 3
Joined
Dec 20, 2010
Messages
48
you are using only "if" as I see on the picture.
The last 2 if should be elseif. If you change it it will be OK.

Here is mine so far . .
  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set FishingUnit = (Triggering unit)
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 0 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to FishingUnit
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: if udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to FishingUnit
          • Game - Display to force the text: You've caught a Sil...
          • Custom script: if udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to FishingUnit
          • Game - Display to force the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
          • Custom script: endif
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
Do you mean I need to change the this :
  • Custom script: if udg_i == 2 then
and
  • Custom script: else
to this ?
  • Custom script: elseif
  • Custom script: elseif
 
@RPG-Lovers You are making me a bit nervous - are you blind?
Don't you see the difference between adding 'endif' and not adding it actually? And the fact that I've used 'elseif' instand of 'if'? Maggy and I posted 849*E24 times good trigger for you and it ain't working anyways.

I post trigger last time:
Use Fishing_Loc in function (terrain pathing (...)) isntead of (Target point of ability being cast) - afterall you've created location variable for this..
Screw FishingUnit variable - you don't need this.
  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 0 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: elseif udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Sil...
          • Custom script: elseif udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
          • Custom script: endif
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
Additionaly for detecting water:
  • (Terrain pathatbility at Fishing_Loc of type Floatability is off) Equal to False
OR
  • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
For searching if water is shallow or deep you have to add additional 'Clif' condition.
 
Level 3
Joined
Dec 20, 2010
Messages
48
@RPG-Lovers You are making me a bit nervous - are you blind?
Don't you see the difference between adding 'endif' and not adding it actually? And the fact that I've used 'elseif' instand of 'if'? Maggy and I posted 849*E24 times good trigger for you and it ain't working anyways.

I post trigger last time:
Use Fishing_Loc in function (terrain pathing (...)) isntead of (Target point of ability being cast) - afterall you've created location variable for this..
Screw FishingUnit variable - you don't need this.
  • Fishing
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fishing
    • Actions
      • Set Fishing_Loc = (Target point of ability being cast)
      • Set force = (Player group((Triggering player)))
      • Set i = (Random integer number between 0 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
        • Then - Actions
          • Custom script: if udg_i == 7 then
          • Hero - Create |cff3fdcdcBronze Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Bro...
          • Custom script: elseif udg_i == 8 then
          • Hero - Create |cff3fdcdcSilver Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Sil...
          • Custom script: elseif udg_i == 2 then
          • Hero - Create |cff3fdcdcGold Carp Fish|r and give it to (Triggering unit)
          • Game - Display to force the text: You've caught a Gol...
          • Custom script: else
          • Game - Display to force the text: You've failed to ca...
          • Custom script: endif
        • Else - Actions
          • Game - Display to force the text: Don't try to fishin...
      • Custom script: call RemoveLocation(udg_Fishing_Loc)
      • Custom script: call DestroyForce(udg_force)
Additionaly for detecting water:
  • (Terrain pathatbility at Fishing_Loc of type Floatability is off) Equal to False
OR
  • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
For searching if water is shallow or deep you have to add additional 'Clif' condition.
I swear when I see it yesterday it's still if then . . .
Maybe I've forgot to click the refresh button :vw_sad:
Well, sorry . .
Gonna to test it

Edit : Tried . . .and succeed ! Thx to y'all. +repp. @spinnaker : How many reputation I need to spread to give you reputations ?
Just for info :

  • (Terrain pathatbility at Fishing_Loc of type Floatability is off) Equal to False
this one can
OR
  • (Terrain pathing at Fishing_Loc of type Amphibious Pathing is off) Not equal to True
this one can't
 
Last edited:
Status
Not open for further replies.
Top