Help with Unit Enters Trigger

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
I can see the Playergroup leak, but the problem is that it doesn't give gold/lumber

Code:
Human Javelineer
    Events
        Unit - A unit enters Human Javelineer <gen>
    Conditions
    Actions
        Custom script:   local location Target
        Set Target = (Center of Starting Upgrade Center Enter <gen>)
        Unit - Remove (Entering unit) from the game
        Unit - Create 1 Javlineer (human) for (Owner of (Entering unit)) at Target facing Default building facing degrees
        Selection - Select (Last created unit) for (Owner of (Entering unit))
        Camera - Pan camera for (Owner of (Entering unit)) to Target over 0.00 seconds
        Custom script:   call RemoveLocation (Target)
        Game - Display to (All players matching ((Owner of (Entering unit)) Equal to (Matching player))) the text: You have selected t...
        Game - Display to (All players matching ((Owner of (Entering unit)) Equal to (Matching player))) the text: |cffff0000 --------...
        Player - Set (Owner of (Entering unit)) Current lumber to 5
        Player - Set (Owner of (Entering unit)) Current gold to 200


fixed it, had to move the Call Removelocation to the end
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> had to move the Call Removelocation to the end

What for? It destroyed a variable that was never used.


> Custom script: local location Target

Remove that line.

Pseudo-locals are evil incarnate anyway...

> Custom script: call RemoveLocation (Target)

Should say:
Custom script: call RemoveLocation( udg_Target )
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
I got it working by moving the remove thing to the end

>Pseudo-locals are evil incarnate anyway...

:eek: Uh-oh, why do you say that?

My whole project so far has been using them, and it's been fine
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Custom script: local location Target

This creates a local variable called "Target".

> Set Target = (Center of Starting Upgrade Center Enter <gen>)

This uses the global variable "Target".
In JASS, its name is "udg_Target".

The local you declared is never used...

Which is why removing that local is such a problem... the variable is not initialized to anything useful.
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
:banghead: :banghead: :banghead:

well I guess that means I need to do some reprogrammin

how do you set a local using customscript then
or should I just change all of the "local location Target" to "local location udg_Target"
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
well...once you had made a variable using the variable editor..there is no need to set a local variable...

Local variable is used when you are writting jass...Importing local to GUI trigger would be a hard time...

So you can remove all custom script that you use to local a variable...

>>how do you set a local using customscript
In GUI...most ...or all of the functions are using Global variable...which can be make by adding unit variable in the variable editor...

When we set local using customscript...the next action we probebly will use custom script too...since Actions in GUI trigger doesnt support locals

< Correct me if i am wrong :p >
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> change all of the "local location Target" to "local location udg_Target"

With this particular trigger, yes, that would do it.

Then again, this trigger has no MUI problems... you may just as well use your global.



> All players matching ((Owner of (Entering unit)) Equal to (Matching player))

"Player group (Owner of (Entering unit))", from "Convert player to player group".


Yes, post #6 is both confused and confusing.
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
gah, but I am using "Target" for almost any point, and this whole time I thought that it was working and MUI

Now I gotta go back and set up 80 million arrays :banghead:
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
For a single point, you certainly don't need an array. Much less that many...

The trigger in post #1 for example works just as good with a simple global.
No waiting, no problem.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
All you need to do here is change

Code:
Custom Script: local location Target

To

Code:
Custom Script: local location udg_Target

Then all of your GUI actions should work fine when you use the variable from the variable editor.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Then all of your GUI actions should work fine

Except those inside "pick every"s.
Or conditions.
And there's features if you use more than one of the same type.

Pseudo-locals are basically bugs waiting to happen.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> Except those inside "pick every"s.
Or conditions.

Oh, yeah. Forgot about those tricky ones that create a new function. :p

Conditions can be done in the form of an "If", though.
Perhaps even a custom script If.
Custom script could also be used for loops.
Though, at this point, why bother?
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
I would need to bother, just because "target" is the point variable used in everything, because I assumed I was making it local.

That means all of the triggered spells and basically all other actions

There are no "waits" in spells so will they still all be MUI? or do I need to make it Target[PlayerNumber(TriggeringPlayer)]

I dunno, it just seems to me that using a single point variable for all sorts of complicated actions, is a bug waiting to happen

FURTHERMORE, since I didn't know that I have quite a few point leaks
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
ok, for those Pseudo-Locals, will this trigger work as expected?

I've already realized the fact that I need to change a lot of triggers with loops and stuff, but I was just wondering if this type will work

Code:
Genre Set Magic
    Events
        Unit - A unit enters Magic <gen>
    Conditions
    Actions
        Custom script:   local location udg_Local
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Race[(Player number of (Owner of (Entering unit)))] Equal to Human
            Then - Actions
                Set Local = (Center of HM <gen>)
                Set Class[(Player number of (Triggering player))] = 2
                Unit - Move (Triggering unit) instantly to Local
                Camera - Pan camera for (Owner of (Triggering unit)) to Local over 0.00 seconds
                Game - Display to (All players matching ((Owner of (Entering unit)) Equal to (Matching player))) the text: You have Selected t...
                Custom script:   call RemoveLocation (udg_Local)
            Else - Actions
                Do nothing
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Test it? Ctrl+f9 ...
And yes, seems so.
But, you do not need the local custom script line there. Its just....annoying to read, see etc. Its just another useless line, in a trigger that would work without it. Why? Because of 0-wait-functions...
And another suggestion, in your first trigger. You are "remove - entering unit from game" then later you try to "set gold to player owner of entering unit". Well, wc3 is gently with you here, since, if you got no wait functions, it is ok. But remember, try have the "remove entering unit at the end". It will make more sense, logical...etc..:)
And not only, if you look at your upper trigger you use "Set gold..." not add... so... Dno if its supposed to be like that, but, just pointed it out! :)

And to the admins, mods etc... This site works like shit with the browser named OPERA... Any reason? :) I dont need to know why but just to inform you...Or it might be just "my opera". Oh, and what doesnt work properly? the buttons # etc.. the hotkeys for [code ] and [colo r] etc... [ quote ]....these doesnt work properly... :)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
It looks like it will work ok.
Just don't try to use the point in the condition, since GUI creates a separate function for each condition.
 
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