Can Defend ability deflect more missiles that just 30%???

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2010
Messages
298
So is there a way to make Footman's defend ability to deflect more than only 30% of the incoming missile attacks?
- Lets say 60%
I have tried to change it from the editor but it allows me to increase it only to 30%! :ogre_rage: :vw_wtf:
 
Level 7
Joined
Feb 9, 2010
Messages
298
Thank you very very much!!! :goblin_yeah::ogre_hurrhurr:
I didn't knew there was such a combination, are there more of 'em? Where can I find this kind of helpful things?
Thanks again it works! ;) :goblin_good_job:
+ rep 4 helpin' me!
 
Level 17
Joined
Jan 21, 2010
Messages
2,111
yes there are, but afaik, not in keyboard shortcut, instead is a right click
Try right click in object editor, then select 'auto fill level', it will enable you to write multiple level with same tooltip, but with different level, like, eg: strom bolt, 6 lv, first damage is 100, then you used the auto fill level, fill the base value with 100
Left the previous level factor be, or 1.00, same goes for level factor, let it be 0.00
The last, fill the constant factor, this will sum to your base value
So the math be like this:
lv1 = base value constant factor = damage lv 1
Lv2 = damage lv 1 constan factor = damage lv 2
Etc...
Like that, and in terrain editor, you can press ctrl page up when selecting a doodad, or destructible to raise it up, and ctrl page down to lower it
 
Level 7
Joined
Feb 9, 2010
Messages
298
I didn't get that with the right click and the object editor!! Either I'm not clicking on the right place or my WE doesn't have the right click button option...

- Oh yes I got it now, that's something I already know - well thank you anyway, I'm sure some people might find it really useful! ;)
 
Last edited:
Level 7
Joined
Feb 9, 2010
Messages
298
Help me solve my problem!
I used Footman's Defend ability to create another ability called "skeletal" - which makes the unit deflect most of the incoming piercing attacks (ex. 55% of 'em) and take only part of the damage from the attacks received (ex. 35% of the damage).
BUT there's just that - Defend is an activate/deactivate ability and I need it to be always active and not to be able for the player to deactivate it!!!
So how can I make it with or without a trigger it doesn't matter to me - give opinions or solutions. + rep for anyone who helps! ;)

-Nope Item Defend doesn't work the way I want it; it reduces the incoming damage from piercing attacks but does not deflect any of 'em! Also there's no tooltip for items and I need that too!
Something else in mind?!
 
Last edited:
For permanent defend, use this simple trigger:
  • defend
    • Events
      • Unit - A unit is issued order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit - Pause (Triggering unit)
      • Unit - Order (Triggering unit) to Human - Footman: Defend
      • Unit - Unpause (Triggering unit)
You can improve efficiency using custom scripts, but this trigger is so tiny that you can either use jass script:
JASS:
// Define globals
globals
    constant integer unitId = 'hfoo'
    constant integer defendId= 852055
    constant integer undefendId = 852056
endglobals

// Conditions
function Conditions takes nothing returns boolean
    return GetIssuedOrderId() == undefendId and GetUnitTypeId(GetTriggerUnit()) == unitId
endfunction

// Actions
function Permanent_defend takes nothing returns nothing
    call PauseUnit( GetTriggerUnit(), true )
    call IssueImmediateOrderById( GetTriggerUnit(), defendId )
    call PauseUnit( GetTriggerUnit(), false )
endfunction

//===========================================================================
function InitTrig_Permanent_Defend takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( t, Condition( function Conditions ) )
    call TriggerAddAction( t, function Permanent_defend )
    set t = null
endfunction
 
Last edited:
Level 7
Joined
Feb 9, 2010
Messages
298
Thank you spinnaker +rep for that!
Is there a way to add an ability to ability?
- What I mean is as I already have got the Defend ability as I want it to be can I make it to add +5 defense every time it is activated?! (but not cumulatively!)

=> No rysnt11 you didn't understand what I mean - I want to add +5 defense to the Defend ability not to the unit itself, so the 5 defense should appear only when the defend ability is activated, if it is deactivated the armor bonus should disappear as well until the ability is activated again!
 
Last edited:
Level 7
Joined
Feb 9, 2010
Messages
298
Done that already, I came to the same Idea... ;)
Sorry I didn't use my head enough before asking...
 
Level 7
Joined
Feb 9, 2010
Messages
298
I asked but already solved it!

1) Now can someone tell me how to make a system to cast an ability by chance?

- What I mean is: I have an ability based on "life drain" and I want to add (with trigger) "curse" ability to the "life drain" but it should only appear in some cases not always (let's say to have a chance of 40% to cast the second ability - curse).

2) Is this made with integers? If yes, please point me a good tutorial about 'em!

3) About the "curse" ability in 1) - will it be a problem for a trigger to cast the spell if it has autocast!?
 
Level 17
Joined
Jan 21, 2010
Messages
2,111
Do this:
event
Unit starts an effect of an ability
Condition
Ability being cast equal to life drain
Action
If then else (multiple function)
If condition
Random percentage less than or equal to 40.00 // use real comparison
Then
//Do your second ability here
Else
//no else, don't add a thing

Edit: 3) no as long as the main skill is not auto cast, it's works
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
1. Use the native to return a random number in a certain range ( random integer between 0 and 4 (inclusive) should do for this task). Test if the number is less than 2 and use the result in conditional flow control like an if X then structure. Inside that structure you can then run code to add the extra effect.

Proof of 40% chance...
5 numbers rolled.
0 - hit
1 - hit
2
3
4
2/5=4/10=40/100 are hits. This assumes the pesudo random number system in WC3 distributes the output equally over the whole range (not biased to any numbers in the range).

2. Integers are whole numbers. The most basic form of data a computer can process. They are 32 bit signed (with two's compliment) giving them a range of possible values of -2^31 to +2^31-1. What is important to remember is they have no decimal parts and will always truncate results (so 3/2 = 1).

Reals on the other hand are some form of floatingpoint number. This means they have a dynamic range and finite accuracy. They also have a error due to how they approximate numbers. Some people report the whole number part undergoes some form of integer conversion thus it has a range of safe use about the same as a integer although it does support decimal components.

3. It could be problimatic if it is being autocast all the time and has some form of cast cost (mana, cooldown, time etc) as it might mean it is not able to be cast at the required time. As long as you keep autocast off and cast it only using triggers there will be no problem. You will probably need a dummy unit to do the casting (otherwise it will break the channel). Remember that the triggers must issue the order to cast the base ability (or for some abilities like channel, the orderstring specified in the object editor).
 
Level 7
Joined
Feb 9, 2010
Messages
298
Ahhh you got me there, both of you I didn't get most of the things you said!

rysnt11 - This is what I don't understand!
=> Random percentage less than or equal to 40.00 // use real comparison
Then
//Do your second ability here

What is this RANDOM %-tage you are talking about?
By using the real comparison I see only percentage life or mana! No random %!
And what do you mean by "Do your second ability here"? -> I don't know how to add an ability to an ability!!! I only know how to add an ability to a unit!

Dr Super Good - Could you explain 1. in a more detailed way I'm not sure I understand all of it!
And could someone point me a Tutorial about Integers(how they work and how to use them)?!

Just to be sure everybody understood what I want:
I have a zombie unit that has the ability "Bite" (the base it Life drain - just made it to work from a short distance, not to take any mana and to cooldown longer) so to this I made the "Misfortune" ability (based of Curse - with no mana cost as well), I want to add "Misfortune" to "Bite" by a trigger and make it (Misfortune) to have only 40% chance of being cast when "Bite" is cast/used.
So this is how far I have got with the trigger:

add to Bite
Events
Unit - A unit Begins casting an ability
Conditions
(Unit-type of (Triggering unit)) Equal to Zombie
(Ability being cast) Equal to Bite (Not Ready)
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Percentage mana of (Triggering unit)) Less than or equal to 40.00
Then - Actions
Unit - Add Misfortune to (Triggering unit)
Else - Actions
Do nothing

(p.s. also could you tell me how to add in the forums everything the same way I see in the WE!)
 
Level 17
Joined
Jan 21, 2010
Messages
2,111
After the '//' is only a comment
The random percentage is found at real comparison, math - random percentage
Not use the percentage of mana, try scroll up and you'll find the 'math - random percentage'
edit: btw, not adding the ability to the unit, you want misfortune to 'casted' at bite's target, right?
Do this:
Then
Unit create 1 dummy at loc facing default building facing angle
Unit add misfortune to last created unit
Unit order last created unit to undead banshee - curse target ability being cast
Unit add 1.00 second generic expiration timer
Custom script: call removelocation(udg_loc)

Some help:
Dummy is a unit created in object editor which has no model, no pathing,ms at max, have no attack, and has max mana (1000)
Loc is a variable try pressing ctrl + b in trigger editor, create a new variable called loc, and variable type point
Or you want me to create thoose thing on a map?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
Dr Super Good - Could you explain 1. in a more detailed way I'm not sure I understand all of it!
JASS:
if GetRandomInt(0,4) < 2 then
//your 40% chance code goes here
endif
Thats all there is to it...
native GetRandomInt takes integer lowBound,integer highBound returns integer
this returns a random integer between both bounds (inclusive).
Combined with a comparator test, you get a boolean.
This boolean is then used in flow control via an "if X then" statement.
Finally you can now run some code with a % chance.

The example should be 40% but that would only be the case if a good pesudo random generator is used in the WC3 engine. I have run tests in the past and the results did appear satasfactory for even distribution thus one can safly assume it is close enough to 40%.

And could someone point me a Tutorial about Integers(how they work and how to use them)?!
No one has bothered to write a tutorial on integers as they are so simple. You learn about them in math class (like at primary school).

All you need to know to use them is that there are 4 basic opperators in JASS that can combine them.
+ which adds them (same as normal math)
- which subtracts them (same as normal math)
/ which divides the number on the left by the number on the right
* which multiplies the two numbers together.

Rules of BODMAS apply (gah wish I knew the proper name for this). This means brackets and functions are solved first followed by division and multiplication folowed by addition and subtraction. Opperations at the same tier (like / and *) are solved from left to right.

Finally, integers are subsets of reals. This means where you can provide a real argument you can also give an integer argument instead and no syntax error will be raised. This also means that the opperators for reals can accept integers but will return a real. You will need to use the R2I native to get a real into an integer but be aware that it will truncate off the decimal data.

integer /*-+ integer = integer
real /*-+ integer = real
integer /*-+ real = real
real /*-+ real = real

Be aware that using the divide opperator (/) to "divide by 0" will cause a thread crash in the JASS interpreter. This means no further code below where the division by 0 occured will be run. The game however will not crash nor will any errors be displayed (unlike SC2) so this is a common cause of faults and failures.

Integers also have a range restriction
Dr Super Good said:
They are 32 bit signed (with two's compliment) giving them a range of possible values of -2^31 to +2^31-1.
 
Level 7
Joined
Feb 9, 2010
Messages
298
rysnt11 - What is this script --> Custom script: call removelocation(udg_loc)
and Yes you are right, I don't know anything about jass, vjass or GUI, I also am a basic triggerer.

1) Here's what I've done - see the image named "Trigger".
And here's what happened - see the "Error" image.

(p.s. DSG I am sorry, I'm sure you explain something really helpful in a good way but I'm not on the level (of knowledge) to understand what you have written, I understood just a part of what you explained. Still Thank you for your willingness to be helpful! :goblin_good_job:)


2) There's something else I was just thinking - what would be better?
- to add the "curse" ability to the "Bite" ability or to add it to the regular attack of the Zombie!? --- What are your opinions about this?
 

Attachments

  • Error.jpg
    Error.jpg
    128 KB · Views: 41
  • Trigger.jpg
    Trigger.jpg
    71.4 KB · Views: 58

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
removelocation is not a valid name to call unless you have created a custom function with that name...

JASS:
native RemoveLocation takes location whichLocation returns nothing
As you can see, it is "RemoveLocation" not "removelocation". The 2 are completly different as far as the jass interpreter is concerned. It is like calling a cat a dog, it just makes no sense.

You also asked how to use integers so I explained. Next to going over fundimental maths (like 1+1=2) there is not much more to using integers in JASS. GUI integers behave somewhat like they do in JASS but with a lot more restrictions for no reason.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Eureka, it finally works!!! :grin::goblin_good_job:
Thanks to all of you!!! + rep for the 3 of you!
Thank you again for being so patient and helpful :)
 
Last edited:
Status
Not open for further replies.
Top