How to call preload the names of my variables?

Level 5
Joined
Jul 2, 2013
Messages
141
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 5
Joined
Jul 2, 2013
Messages
141
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.
 

Riki

Arena Moderator
Level 27
Joined
May 18, 2018
Messages
396
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 5
Joined
Jul 2, 2013
Messages
141
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")
 

Riki

Arena Moderator
Level 27
Joined
May 18, 2018
Messages
396
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 5
Joined
Jul 2, 2013
Messages
141
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
 

Riki

Arena Moderator
Level 27
Joined
May 18, 2018
Messages
396
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 5
Joined
Jul 2, 2013
Messages
141
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. ~_~
 
Top