Jass Script Problems

  • Thread starter Thread starter Sanitarium
  • Start date Start date
S

Sanitarium

Guest
Edit: "Effect not appearing" Problem Solved-Improper Model File Path
Edit: "No damage dealt" Problem Solved-Misunderstanding of Damage Tables and UnitDamageTarget

Thanks for all the help.
 
try to use this codes
Code:
AddSpecialEffectTarget(<String model path>, <Target Unit>, <String attachment> )
and
Code:
UnitDamageTarget(<Source unit>,<target>,<demage>,false,false,null,null,null)
also your model may not have an attachment point on its origin if you have imported it.
 
Effect Problem Fixed, Damage Still Doesn't Work

Ok, I've replaced my damage line with yours...still doesn't work. The UnitDamageTarget now returns true but no damage is dealt...

First code bit pulled off the JASS Manual, the second bit is yours. I was wondering if you could explain what the purpose of the fields you set to false/null was and why it should work when they were set to false/null
Code:
native UnitDamageTarget (unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType) returns boolean
UnitDamageTarget(<Source unit>,<target>,<demage>,false,false,null,null,null)

In a bit if unrelated expirementing, I somehow fixed the Effect Problem, thanks for the help anyway
 
may be you cannot take the Caster or Target from game cache(get attached stuff) take a look at your codes if you make a mistake while attaching the caster or target couse i use this demage function and it works form me really fine
 
About those fields...

Ok, I will check GetAttached..'s again.

But I would still like to know about those fields, it seems like you would need something other than null in the damage/attack type fields...
 
boolean attack: If you make it true your unit tries to attak the target this will reset all animations that you have given to your unit and tries to play attack animation.
boolean ranged: Again it defines if the attack is ranged for other definations
attacktype attackType: I dont care about this couse i demage the unit even i typed null there. However it is for the physical attacks or a full demage according to armor type off target
damagetype damageType: same as below
weapontype weaponType: That may for the attack sound... or may be firing a missle for ranged attacks i never tried it
 
Here's the Code

Firstly, thanks for the explaination, that clears things up. It should be noted that I use altered damage tables(gameplay constants), do you know if the null for attack/damage type will sidestep these modifiers?

Well, I can't find the problem, I'll keep looking. Meanwhile, here is the code, maybe you can figure it out:
Code:
function CollisionCheck takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit m = GetAttachedUnit(t,"Unit")
    local location p = GetUnitLoc(m)
    local group g =  CreateGroup()
    local unit a = GetAttachedUnit(m,"Attacker")
    local unit u = null
    local integer s = 0
    local boolean c = false

    set g = GetUnitsInRangeOfLocAll (25, p)
    call GroupRemoveUnit(g,a)
    call GroupRemoveUnit(g,m)

    if CountUnitsInGroup(g) != 0 then
      set u = GroupPickRandomUnit(g)
      if UnitDamageTarget(a,u,I2R(GetAttachedInt(m,"Damage")),false,false,null,null,null) then
        call BJDebugMsg( "Target Damaged For: "+I2S(GetAttachedInt(m,"Damage")) )
      endif
      set c = true
    endif

    if not c then
      set s = GetAttachedInt(t,"StepsRemaining")
      if s == 0 then
        set c = true
      else
        call AttachInt(t,"StepsRemaining",s-1)
      endif
    endif

    if c then
      call CleanAttachedVars(t)
      call DestroyTimer(t)
      call DestroyEffect(GetAttachedEffect(m,"Effect"))
      call CleanAttachedVars(m)
      call ExplodeUnitBJ(m)
    endif

    call DestroyGroup(g)
    call RemoveLocation(p)
    set g = null
    set t = null
    set m = null
    set u = null
    set p = null
endfunction
Code:
function Trig_On_Attacks_Actions takes nothing returns nothing
  local unit a = GetAttacker()
  local location p = GetUnitLoc(GetAttackedUnitBJ())
  local location o = GetUnitLoc(a)
  local integer ut = GetUnitTypeId(a)
  local integer bd = UT_GetAttachedInt(ut,"BaseDamage")
  local integer nd = UT_GetAttachedInt(ut,"NumDice")
  local integer ds = UT_GetAttachedInt(ut,"DiceSides")
  local string pa  = UT_GetAttachedString(ut,"ProjectileArt")
  local real ps = UT_GetAttachedReal(ut,"ProjectileSpeed")
  local unit m = CreateUnitAtLoc( GetOwningPlayer(a),'e000',o, 0 )
  local effect fx = AddSpecialEffectTarget("Abilities\\Weapons\\SerpentWardMissile\\SerpentWardMissile.mdl", m, "origin" )
  local timer t = CreateTimer()
  local integer i = 1
  call SetUnitMoveSpeed(m, ps)
  call SetUnitPathing(m, false)
  call IssuePointOrder(m,"move",GetLocationX(p), GetLocationY(p))
 
  loop
    exitwhen i>nd
    set bd =  bd + GetRandomInt(1,ds)
    set i = i + 1
  endloop
  
  call AttachInt(m, "Damage",bd)
  call AttachObject(m,"Effect",fx)
  call AttachObject(m,"Attacker",a)
  call AttachObject(t,"Unit",m)
  call AttachInt(t,"StepsRemaining",40)
  call TimerStart (t, .05, true, function CollisionCheck)

endfunction

I know it leaks like crazy, just tryin to get it to work first. UT_Attach...'s are basically like Attach... functions except you attach to Unit Types(intgers)
 
the return values with damage functions seem to have nothing to do with the fact the unit was damaged or not

boolean attack: If you make it true your unit tries to attak the target this will reset all animations that you have given to your unit and tries to play attack animation.

Didn't know that.
boolean ranged: Again it defines if the attack is ranged for other definations
Like what?

attacktype attackType: I dont care about this couse i demage the unit even
i typed null there. However it is for the physical attacks or a full demage according to armor type off target

If you use null there it is chaos damage. It is better to use NORMAL there so it is spell damage. Attack type only involves damage done to different armor types

damagetype damageType: same as below
Far from the same, damagetype determines the damage type of the spell, if it is magical, phisical, universal. null and unknown here are extremly weird, they will damage the unit no mather the circunstances they will even damage invulnerable units

weapontype weaponType: That may for the attack sound... or may be firing a missle for ranged attacks i never tried it
Just sound, completelly worthless actually. Blizzard shouldn't have added this argument at all

When you attach plenty of stuff to the same handle it is better to use the Table functions and GetAttachmentTable there, it is faster
 
Vexorian said:
Like what?

I really dont sure about it but i may to determine if the attack is ranged may be for some spells which is effecting ranged attacks such as true shot aura ect..

Vexorian said:
Far from the same, damagetype determines the damage type of the spell, if it is magical, phisical, universal. null and unknown here are extremly weird, they will damage the unit no mather the circunstances they will even damage invulnerable units
I was meaning that just cannot expressed it well :D
 
Damage type: do you know where I could find out how each damage type effects the damage( if such a resource even exists)?

Tables: Yeah, I just recently got an updated caster system, haven't spent the time to see how you did the tables, once I do there will probably be a conversion

In regaurds to the original problem...the answer must be out there, if only I could find it.
 
Sanitarium said:
Damage type: do you know where I could find out how each damage type effects the damage( if such a resource even exists)?
AFAIK, all it does is determine if the damage is magical, physical, or universal. Unless you meant attack type...
 
No, I did meant damage type, there are other options besides those Vex listed such as Sonic, Acid, and Plant. I was wondering if anyone knew what effects these had. Perhaps they are just extentions of physical, universal, and magical?

Anyrate...

Still stumped on the UnitDamageTarget, it now works in other triggers, just not this one.
 
There are no actual differences between Fire and Cold , for example they are both magical.

I have a table in the Caster System's readme in the section about damage options
 
It works!

Well, I've found the problem, my game constants for damage had effectively disabled spell damage. This should not have been a problem because, according to Vexorian, null is chaos damage.
Vexorian said:
If you use null there it is chaos damage. It is better to use NORMAL there so it is spell damage. Attack type only involves damage done to different armor types
Interestingly enough, a value of null in the damagetype uses spell damage, not chaos. I enabled spell damage and disabled chaos damage and it now works.

Thanks for all the help.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    How often does the Trending Content box refresh?
  • The Helper The Helper:
    Also, in the last template there was a seperation between sticky threads and regular threads in the forum
  • Ghan Ghan:
    Not sure. It's probably part of a cron job.
  • The Helper The Helper:
    Hey Ghan, whatever cron job its part of its not running its been the same for days. If it does not work can we remove it?
  • The Helper The Helper:
    LOL! A tweak job!
  • The Helper The Helper:
    this is the fix I get from that yeah this is hard to control. disabling bots is pretty much necessary as ai and other bots would push really old threads to the top. reduce weight of view count. disable guest view tracking if you really want to push active threads to the top. a bit of tinkering for a few days with the weights and other settings should get you a decent trending widget box.
  • Ghan Ghan:
    I changed the settings a bit.
  • Ghan Ghan:
    Narrowed it to 7 days for the half-life and set views to 0 weight.
  • The Helper The Helper:
    I dont think Trending would work for this forum it would be better to just have the last 5 posts from anywhere
  • Ghan Ghan:
    Probably will have to give it some time to update.
  • Ghan Ghan:
    I'm guessing it is not retroactive.
  • Ghan Ghan:
    Next on the punch list: Update the server to Ubuntu 24.04.
  • The Helper The Helper:
    Mad Lads is new I see it displays original post date
  • The Helper The Helper:
    as long as it changes it is good - it is good now it updated and its new stuff
  • The Helper The Helper:
    One thing I have noticed and I dont know if it is by design but like 1 out of 3 times I come to the site the Anubis screen just hangs open, if I refresh it will go away but sometimes it hangs
  • Ghan Ghan:
    I've seen that as well.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top