# Help with a spell +rep

#### Weegee

##### Go Weegee!
Hi. How can i get a trigger so when a unit is attacked if he has a certain buff that he is knocked back? I already know how to do a clean Knockback trigger in GUI (if u don't believe me i could show u). The only problem I am having is finding the condition to check if the attacked unit has a certain buff. TY to helpers and I will +rep people who help :thup:

#### Accname

##### 2D-Graphics enthusiast
Code:
``((Attacked unit) has buff 'YourBuff') Equal to True``
this is what you are searching for, its a boolean -> unit -> unit has specific buff

#### [email protected]_no_Wyrm

##### New Member
Boolean comparison - attacked unit has buff (lol) equal to true

Edit : me too, too late.

#### Grymlax

##### Probably not around
It is a boolean condition.

//edit Seconds to late

#### Weegee

##### Go Weegee!
TY all since u all helped +rep to all

Edit: Ok i seem to be having problems squeezing it in there how about how do i make a number that randomly goes to a number that is between 0-25%? and if it hits 25% the activates?

#### WarToast

##### Active Member
TY all since u all helped +rep to all

Edit: Ok i seem to be having problems squeezing it in there how about how do i make a number that randomly goes to a number that is between 0-25%? and if it hits 25% the activates?
Create an integer variable. I called mine RandomNumber in this example.

Code:
``````Action
Set RandomNumber = (Random integer number between 1 and 25)

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Equal to 25
Then - Actions

Else - Actions``````

ok ty +rep

#### Accname

##### 2D-Graphics enthusiast
for 25% chance it got to be:
Code:
``````Action
Set RandomNumber = (Random integer number between 1 and 4)

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Equal to 1
Then - Actions

Else - Actions``````
or if you want you could also do it like this:
Code:
``````Action
Set RandomNumber = (Random integer number between 1 and 100)

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomNumber Less or Equal to 25
Then - Actions

Else - Actions``````

#### WarToast

##### Active Member
TY all since u all helped +rep to all

Edit: Ok i seem to be having problems squeezing it in there how about how do i make a number that randomly goes to a number that is between 0-25%? and if it hits 25% the activates?
I understood that as 1 in 25.

#### Weegee

##### Go Weegee!
k ty ill see if +rep works twice lol

It worked but there is a delay. Here's the trigger...

Code:
``````Unit - A unit Is attacked

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Attacked unit) has buff Stunned (Pause)) Equal to True
Then - Actions
Set Unit_Casted = (Attacked unit)
Set Unit_Caster = (Attacking unit)
Trigger - Turn on GUI knockback 2 <gen>
Else - Actions
Do nothing``````

Code:
``````Time - Every 0.03 seconds of game time

Actions
Unit - Move Unit_Casted instantly to ((Position of Unit_Casted) offset by 5.00 towards (Facing of Unit_Caster) degrees)
Destructible - Pick every destructible within 120.00 of (Position of Unit_Casted) and do (Destructible - Kill (Picked destructible))
Wait 0.50 seconds
Unit - Remove set_unit_Dummy from the game
Trigger - Turn off (This trigger)``````
When a Unit has this certain buff it will be knocked back but it takes to long NEED HELP +rep to who ever helps

Edit:to let u know i cant +rep u guys again for helping lol

#### Accname

##### 2D-Graphics enthusiast
I dont understand, what takes too long? is your unit not sliding fast enough or does the effect last too long?

Code:
``````Unit - Move Unit_Casted instantly to ([B](Position of Unit_Casted)[/B] offset by 5.00 towards (Facing of Unit_Caster) degrees)
Destructible - Pick every destructible within 120.00 of [B](Position of Unit_Casted)[/B] and do (Destructible - Kill (Picked destructible))``````
and you havent set 'Unit - Remove set_unit_Dummy from the game' the unit you re removing here Oo

#### [email protected]_no_Wyrm

##### New Member
you dare to use wait = not recommended.

It is not MUI....

Fixing = make some count system that'll turn da trigger off after it reached some time.
Removing dummies 4 what?
It will cause the target to move alongside the facing od the caster that may change over time. sure bout that?

@Dr.Jack
Well, it is attacking condition after all, it will clash.

#### Dr.Jack

##### That's Cap'n to you!
Clearing the leaks should help.
The fact that he using wait shouldn't disturb.
Note it is not MUI nor MPI.

#### Weegee

##### Go Weegee!
I know about that and the leaks ok ill fix those later the problem is that when a unit is stunned it like waits 2 seconds THEN it moves them i want it so it moves when they are stunned without a wait

O and for the wait trigger i know it screws it up lol ill fix it better later

Edit: for the dummy thing i forgot to remove that so forget about that i used to have a dummy lol but now i have the unit be damaged off of the skill itself

@ Accname

i need help with the leaks lol what am i supposed to do with that anyway?

#### Accname

##### 2D-Graphics enthusiast
Code:
``````Slide
Events
Time - Every 0.05 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) has buff BetÃ¤ubt (Pause)) Equal to True
Then - Actions
Set StunPoint = ((Position of (Picked unit)) offset by -5.00 towards (Facing of (Picked unit)) degrees)
Unit - Move (Picked unit) instantly to StunPoint
Custom script: call RemoveLocation (udg_StunPoint)
Else - Actions``````
i did it that way, you just got to set the unit group stunned somewhere, like
Code:
``Set Stunned = (Units in (Playable map area))``

#### Weegee

##### Go Weegee!
k thx ill try it =D

Yours works much better lol Ill give u credit in my map =D

#### Accname

##### 2D-Graphics enthusiast

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
Happy Sunday!
+1
• The Helper:
I will be out of town until Sunday evening
+1
• The Helper:
I am back! Did you miss me LOL
+1
• jonas:
where did you go?
• The Helper:
Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
+1
• The Helper:
It was a lot of fun. The RV was bad ass
• jonas:
That sounds like fun!
+1
• The Helper:
it was a blast!
• The Helper:
I am going to post the Youtube of the investigation in the forums when it is ready
+1
• jonas:
cool!
• vypur85:
Sounds cool TH.
• tom_mai78101:
I was on a Legend of Zelda marathon...
• tom_mai78101:
Am still doing it now
+1
• jonas:
which one(s) are you playing?
• jonas:
I played a little bit of the switch title two weeks ago and found it quite boring
• The Helper:
just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
+1
• The Helper:
Happy Tuesday!
• The Helper:
We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
• The Helper:
Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
+1
• Ghan:
Beep boop
+1
• The Helper:
hears robot sounds while 250 bots are on the forum lol
• The Helper:
Happy Saturday!
+1
• The Helper:
and then it was Thursday...
+2

### Members online

No members online now.