• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

How to call preload the names of my variables?

Status
Not open for further replies.
Level 6
Joined
Jul 2, 2013
Messages
156
Hello, I don't know how to call preload the names of my variables with array size. Looks like this:


Set Save[SaveCount] = Honor_P[(Player number of (Triggering player))]


Set Save[SaveCount] = PlayerEffectSave[(Player number of (Triggering player))]

And preload like this :

Custom script: call Preload("Honor: "+udg_"My variable name here")

But what exactly should my variable name with player number owner of triggering player be? LOL. Halp.
 
Level 6
Joined
Jul 2, 2013
Messages
156
Yes exactly, Don't know why you put +1 tho, anyway, I'm gonna test it now. Give u +rep Will tell ya if it doesn't work. Ty.
 
Yes exactly, Don't know why you put +1 tho, anyway, I'm gonna test it now. Give u +rep Will tell ya if it doesn't work. Ty.

The function that is called when you use "Player number of (player)" is this:

JASS:
call GetConvertedPlayerId(player)

But this function is not the one that actually executes the action, rather it calls a native function that will actually be the one to do it:

JASS:
function GetConvertedPlayerId takes player whichPlayer returns integer
    return GetPlayerId(whichPlayer) + 1
endfunction

Basically, I'm shortening the process by calling the native function directly instead of calling the BJ function (the one with the name in red).

EDIT:

I forgot to add that in native functions the first player is Player(0), that's why you must use that +1.
 
Last edited:
Level 6
Joined
Jul 2, 2013
Messages
156
I'm getting syntax vjass error on my custom script and can't test the map. It says unexpected ")"?

I must have written something wrong. Can you help out please. I'm bad with Custom scripts and jass :(

Custom script: call PreloadGenEnd("DaciaNE2\\"+udg_Pre_pname+udg_Honor_P[GetPlayerId(GetTriggeringPlayer())) +1])+udg_PlayerEffectSave[GetPlayerId(GetTriggeringPlayer())) +1])+udg_PreloadInteger+".txt")
 
I'm getting syntax vjass error on my custom script and can't test the map. It says unexpected ")"?

I must have written something wrong. Can you help out please. I'm bad with Custom scripts and jass :(

Custom script: call PreloadGenEnd("DaciaNE2\\"+udg_Pre_pname+udg_Honor_P[GetPlayerId(GetTriggeringPlayer())) +1])+udg_PlayerEffectSave[GetPlayerId(GetTriggeringPlayer())) +1])+udg_PreloadInteger+".txt")

There where some extra parentheses that should not be there. You put an additional ")" after each "GetTriggeringPlayer()" and another one after each "+1", a total of 4 parentheses that are causing that error.

Here I fixed it:

JASS:
call PreloadGenEnd("DaciaNE2\\"+udg_Pre_pname+udg_Honor_P[GetPlayerId(GetTriggeringPlayer()) +1]+udg_PlayerEffectSave[GetPlayerId(GetTriggeringPlayer()) +1]+udg_PreloadInteger+".txt")
 
Level 6
Joined
Jul 2, 2013
Messages
156
I think I'm going crazy. I checked 10 times, it's the same as your line and I still get an Error. Something like Unexpected end of line? hm
 
I think I'm going crazy. I checked 10 times, it's the same as your line and I still get an Error. Something like Unexpected end of line? hm
I had not realized that you had changed "GetTriggerPlayer()" to "GetTriggeringPlayer()".

Try it now:
JASS:
call PreloadGenEnd("DaciaNE2\\"+udg_Pre_pname+udg_Honor_P[GetPlayerId(GetTriggerPlayer()) +1]+udg_PlayerEffectSave[GetPlayerId(GetTriggerPlayer()) +1]+udg_PreloadInteger+".txt")
 
Level 6
Joined
Jul 2, 2013
Messages
156
It still gives me error, even when I changed to getconvertedPlayerID etc. the same code works on another trigger when calling for variables without array size but ALWAYS errors when I want to call my variables with array size wtf. ~_~
 
Status
Not open for further replies.
Top