Using a global defined variable in a custom script

MaQleod

New Member
Reaction score
0
I have a global array (StartPosition[]) which gets assigned during the trigger based on the owner of the triggering unit.
during the script I run this custom script command:
call ReviveHeroLoc(OURHERO, GetRectCenter(GetPlayableMapRect()), true )

This is based on the revive hero tutorial. Instead of GetPlayableMapRect(), I want to use StartPosition[0] so the hero revives at the starting location of it's owner, but if I change it out, I get an error. How do I input a global variable into the custom script?

Jared
 
when replacing GetPlayableMapRect() in the custom script make sure to put udg_ infront of your variable name

so I believe you would want "udg_StartPosition[0]"

edit- You also dont need GetRectCenter( ) of "GetRectCenter(GetPlayableMapRect())" so..

call ReviveHeroLoc(OURHERO, udg_StartPosition[0], true )
 
but OURHERO is local, it was declared via custom script earlier in the trigger. StartPosition[] is global and is declared using the variable gui in the trigger editor.
 
[ljass]call ReviveHeroLoc(OURHERO, udg_StartPosition[0], true)[/ljass] doesn't work?

Unless you spelled one of the variables wrong, then it should work fine.

But why 0? All heroes will be revived at the same place.
 
thats the whole point of why I'm changing this. I don't want the heroes reviving in the same spot, I want them to reappear in a different spot based on the player who owns them. This is all assigned elsewhere.
I had mispelled something, but with that fixed, I learned something else:

It does need the GetRectCenter() portion or it does not return a valid structure for the coordinates for ReviveHeroLoc().
 
[ljass]call ReviveHeroLoc(OURHERO, udg_StartPosition[GetPlayerId(GetOwningPlayer(OURHERO) + 1], true)[/ljass]

That should work. StartPosition is set in GUI, correct? Otherwise, remove the + 1.

What are you talking about with GetRectCenter? StartPosition is a location, isn't it?
 
It is a region, but the compiler wouldn't accept it without GetRectCenter(). So however that function returns data, it is what ReviveHeroLoc() is looking for. I'm not sure where to find what the actual functions look like to see how they return data, so I can't say for certain why.
I had looked at GetOwningPlayer() as an option, but I was not sure what exactly it returned and how to differentiate that between the existing players, but that would have worked to with some conditionals to determine the correct starting region for the player and return the coordinates and I wouldn't have needed to use the global variable. Either way, what I have works.
 
but in what format? I can't do a boolean comparison if I don't know what I'm looking for, it will always fail.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top