• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to call preload the names of my variables?

Status
Not open for further replies.
Level 6
Joined
Jul 2, 2013
Messages
153
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
153
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.
 
Level 27
Joined
May 18, 2018
Messages
397
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
153
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")
 
Level 27
Joined
May 18, 2018
Messages
397
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
153
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
 
Level 27
Joined
May 18, 2018
Messages
397
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
153
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