HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

UnitDamageTargetBJ.. -BJ?

01-21-2006, 02:09 PM#1
Thunder_Eye
Collapse JASS:
call UnitDamageTargetBJ( c, t, 500.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE )
("c" and "t" are local units

how do I make it non BJ?
I tried to just remove the BJ but that didnt work.
(as you probably suspect Im really new to JASS)
01-21-2006, 02:10 PM#2
Earth-Fury
Collapse JASS:
native UnitDamageTarget takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean

Collapse JASS:
function UnitDamageTargetBJ takes unit whichUnit, unit target, real amount, attacktype whichAttack, damagetype whichDamage returns boolean
    return UnitDamageTarget(whichUnit, target, amount, true, false, whichAttack, whichDamage, WEAPON_TYPE_WHOKNOWS)
endfunction

figure it out from there.

(jass shop pro is your friend.)

edit: FYI:

BJ functions are esentally functions made to make the GUI editor look and work nicer. they serve no real purpose allot of the time.
01-21-2006, 02:19 PM#3
Thunder_Eye
So what's is fastest? BJ or not BJ?
not BJ seems like more work.
01-21-2006, 02:21 PM#4
Earth-Fury
all the BJ doas is call the native (non-bj) with some of the paramiters set to pre-defined values. making a function non-bj just for the sake of it (when you would use the same paramiters as a BJ function) is dumb. (this is presuming its a BJ function like this one, that just fills in some of the values for you.)

(and by dumb i mean time wasting. it will improve your code slightly. but if you are able to notice the milisecont, then do what you think best.)
01-21-2006, 02:31 PM#5
Thunder_Eye
Well I dont really care if its 0.1 sec faster, aslong as It doesnt leak.
Just wondered the difference.

(sry for being stupid but I'm really really new to JASS, this is the first JASS spell Im making and still there is some GUI involved :P, Im not new to WE, just new to JASS)

Also whats wrong with this?
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2Ie ) / 10 ) - ( R2Ir / 10 ) ) )

e and r are local integers,
I could make them
local integer r=R2I(*****)
but that messed up so I didnt use it.
01-21-2006, 02:35 PM#6
Earth-Fury
Quote:
Originally Posted by Thunder_Eye
Well I dont really care if its 0.1 sec faster, aslong as It doesnt leak.
Just wondered the difference.

(sry for being stupid but I'm really really new to JASS, this is the first JASS spell Im making and still there is some GUI involved :P, Im not new to WE, just new to JASS)

its ok not to know everything (unless your me. then you have no excusse.)

the stupidity of BJ functions still eludes even me... (which i am ever shamed for.)

and leaks are caused by creating things that are never destroyed. (unit groups, forces, ext.)
01-21-2006, 02:38 PM#7
Thunder_Eye
yaeh I know how to clear leaks and what things that leaks.
could you help me with the other problem?

call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2Ie ) / 10 ) - ( R2Ir / 10 ) ) )

e and r are local integers, t is a local unit.
I could make them:
local integer r=R2I(*****)
instead, but that messed the it up so I didnt use it.
01-21-2006, 02:46 PM#8
Earth-Fury
Collapse JASS:
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2Ie ) / 10 ) - ( R2Ir / 10 ) ) )

your R2I's are missing their brackets

and im pretty shure you cant define locals with functions as values :) (i may be wrong. im no JASS guru myself)

what are you trying to acheve with this?
01-21-2006, 02:50 PM#9
Thunder_Eye
brackets = ?

Well correct me if im wrong.
When you make a spell and set the units to globals, you cant make it multiinstability without arrays(atleast not in a easy way)

But if you set them to locals in a trigger, it will be MUI, I might be wrong though.
From what Ive understood each time the trigger runs it makes a local local :P.
so local c the first time the trigger runs isnt the same as
local c the second time.
01-21-2006, 03:04 PM#10
Earth-Fury
a local is a variable that is local to a function. If you set a local "I", then set its value to "5" if "udg_bool" is true, then set "udg_bool" to false, the next call to that function would not set the value of "I" to 5.

Brackets are these: (), eg: I2S(var)

multi-instanceability is best achived thru a game cache. (and some verry complicated stuff i wont get into now) now, for most "basic" triggerd spells, you can use global variable arrays.

i need sleep...
01-21-2006, 03:08 PM#11
Thunder_Eye
So this isnt MUI?

Trigger:
Spells
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Ability being cast) Equal to Clumsy
(Ability being cast) Equal to Fireball AA
(Ability being cast) Equal to Feeble Mind
Collapse Actions:emote_sad:
Set tempInteger = (Player number of (Owner of (Casting unit)))
Set tempInteger2 = (Player number of (Owner of (Target unit of ability being cast)))
Set tempCaster[tempInteger] = (Casting unit)
Set tempTarget[tempInteger] = (Target unit of ability being cast)
Set tempTargetPlace = (Target point of ability being cast)
If ((Ability being cast) Equal to Fireball AA) then do (Custom script: call Fireball()) else do (Do nothing)
If ((Ability being cast) Equal to Clumsy ) then do (Custom script: call Clumsy()) else do (Do nothing)
If ((Ability being cast) Equal to Feeble Mind ) then do (Custom script: call Feeble_Mind()) else do (Do nothing)
Custom script: call RemoveLocation(udg_tempTargetPlace)

(in the custom script section)
Collapse JASS:
function Clumsy takes nothing returns nothing
    local integer i=udg_tempInteger
    local unit u=udg_tempTarget[i]
    call SetUnitMoveSpeed( u, ( GetUnitMoveSpeed(u) / 2.00 ) )
    call PolledWait( 30.00 )
    call SetUnitMoveSpeed( u, GetUnitDefaultMoveSpeed(u) )
    set u=null
endfunction

the bracket thing didnt work,

looks like this now
Collapse JASS:
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2I(eva) ) / 10 ) - ( R2I(res) / 10 ) ) )
01-21-2006, 03:18 PM#12
Naakaloh
Quote:
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2Ie ) / 10 ) - ( R2Ir / 10 ) ) )

e and r are local integers, t is a local unit.
I could make them:
local integer r=R2I(*****)
instead, but that messed the it up so I didnt use it.

First of all, if they are integers you don't need the R2I() anyway, it just won't work. Second, if you don't have a definition at the beginning of your function for the integers like "local integer r = R2I([real])" you can't use them. Finally, as Earth-Fury said, when you use a function like R2I() you need to include the parameters in the parentheses.

In your case, assuming that e and r are reals you'd want to put them here:
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2I(e) ) / 10 ) - ( R2I(r) / 10 ) ) )

If e and r are integers all you need to do is:
call ModifyHeroSkillPoints( t, bj_MODIFYMETHOD_SUB, ( ( ( 8 + e ) / 10 ) - ( r / 10 ) ) )
01-21-2006, 03:26 PM#13
Thunder_Eye
Ok I just saw that Ive posted the wrong function :/
It isnt ModifySkillPoint,
Its ModifyHeroStat.

Collapse JASS:
    call ModifyHeroStat( bj_HEROSTAT_INT, targ, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2I(eva) ) / 10 ) - ( R2I(res) / 10 ) ) ) 

doesnt work.
01-21-2006, 04:05 PM#14
Naakaloh
Are you sure that's the line that's getting the error? It appears that you might be missing a ')' on the end although I'm not sure...

If that doesn't work try this:

call ModifyHeroStat( 2, targ, 1, 10 )
01-21-2006, 04:21 PM#15
Thunder_Eye
didn't work either, I believe its something wrong with the "targ" var.

This is the whole thing.
Trigger:
Spells
Collapse Events
Unit - A unit Finishes casting an ability
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Ability being cast) Equal to Clumsy
(Ability being cast) Equal to Fireball AA
(Ability being cast) Equal to Feeble Mind
Collapse Actions
Set tempInteger = (Player number of (Owner of (Casting unit)))
Set tempInteger2 = (Player number of (Owner of (Target unit of ability being cast)))
Set tempCaster = (Casting unit)
Set tempTarget = (Target unit of ability being cast)
If ((Ability being cast) Equal to Fireball AA) then do (Custom script: call Fireball()) else do (Do nothing)
If ((Ability being cast) Equal to Clumsy ) then do (Custom script: call Clumsy()) else do (Do nothing)
If ((Ability being cast) Equal to Feeble Mind ) then do (Custom script: call Feeble_Mind()) else do (Do nothing)

Collapse JASS:
function Feeble_Mind takes nothing returns nothing
    local integer i=udg_tempInteger
    local integer i2=udg_tempInteger2
    local unit cast=udg_tempCaster
    local unit targ=udg_tempTarget
    local integer intdefault=GetHeroStatBJ(bj_HEROSTAT_INT, targ, false)
    local real res=udg_PlayerResistance[i2]
    local real eva=udg_PlayerEvaluating_Intelligence[i]
    call ModifyHeroStat( bj_HEROSTAT_INT, targ, bj_MODIFYMETHOD_SUB, ( ( ( 8 + R2I(eva) ) / 10 ) - ( R2I(res) / 10 ) ) )
    call ModifyHeroStat( 2, targ, 1, 10 )
endfunction