How to attach a struct to a unit using PUI

Roku

New Member
Reaction score
3
I just downloaded the PUI system by Cohadar, and it looks really good, the only thing is i dont really know how to use it. I want to attach struct to a unit, so i can use the properties of a given unit in another function. Would help alot if you guys could show me some examples of how to do this. So this is basicly what i would want:

JASS:
private function Act takes nothing returns nothing
    local fb c = fb.create()
    local unit caster = GetTriggerUnit()
    set c.c = caster
endfunction

private function Buffapply takes nothing returns nothing
    local fb c = fb.create()
    local unit u = c.c
    call UnitDamageTarget(u, GetSpellTargetUnit(), blablabla)
endfunction
 

Roku

New Member
Reaction score
3
I cant use the "gettriggerunit()" since the functions have different events.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
in order to use the struct from the first function in the second one you would have to use struct attachment or create a global struct.
what you did in the second function creates a new local struct and thus not passing the unit from the first function
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
I cant use the "gettriggerunit()" since the functions have different events.

Well I said for THAT you can use GetTriggerUnit().

And since two functions can't have two different evenets ( o,o ) I at least wanted to suggest it.
 

Roku

New Member
Reaction score
3
And since two functions can't have two different evenets ( o,o )

I dont know what you are talking about, the 1st function has the event "on unit spell effect" and the second function has the event "unit damaged". Im using 2 local triggers at the end, each with diferent event and action (function).
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
My god where is your problem? I already said it the last post that in THAT and I mean in the cast you suggested it, GetTriggerUnit() worked. And since you said "this is basically what I want." , I couldn't know that you use two different triggers, and events for it hmm? I mean sure I considered it with a higher probability, but I just, IN CASE, wanted to tell you that for these 2 functions worked fine with GetTriggerUnit() as well ._.

If you posted your real code instead of two simple functions it would've been clear... but you didn't, hence I don't get your problem.

You're right though that my second sentence wasn't really correct. I better said functions can't have any events and therefore I couldn't know it :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top