BigBurrito Posted July 27, 2018 Posted July 27, 2018 (edited) Can anyone help me figure out why this is happening. I'm still learning how to manage these values. Thank you in advance. prontera,150,150,1 script Pronterian#1::Pront[1] 844,{ OnInit: getmapxy("$mapPRT"+strnpcinfo(2)+"$", $xPRT["+strnpcinfo(2)+"], $yPRT["+strnpcinfo(2)+"], UNITTYPE_NPC, "strnpcinfo(3)"); end; } I get this on my console: [Warning]: Unexpected type for argument 2. Expected number. [Debug]: Data: string value="+strnpcinfo(2)+" [Debug]: Function: getelementofarray [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: Unexpected type for argument 2. Expected number. [Debug]: Data: string value="+strnpcinfo(2)+" [Debug]: Function: getelementofarray [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: Unexpected type for argument 1. Expected variable, got C_STR. [Debug]: Data: string value="$mapPRT1$" [Debug]: Function: getmapxy [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: script: buildin_getmapxy: mapname value is not a variable. [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) Edited July 27, 2018 by BigBurrito Quote
0 Technoken Posted July 28, 2018 Posted July 28, 2018 My bad, i missed an apostrophe XD getmapxy(getd("$mapPRT"+strnpcinfo(2)+"$"), getd("$xPRT["+atoi(strnpcinfo(2))+"]"), getd("$yPRT["+atoi(strnpcinfo(2))+"]"), UNITTYPE_NPC, strnpcinfo(3)); Anyway we can help you better if you post the script or infos of what you really want to achieve. Maybe this could help too - script Pronterian -1,{ end; OnInit: donpcevent "::OnSetPCoord"; end; OnSetPCoord: .@id = atoi(strnpcinfo(2)); getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC); setd "$@PrtMap"+.@id+"$", .@map$; setd "$@PrtX"+.@id+"", .@x; setd "$@PrtY"+.@id+"", .@y; end; } prontera,150,150,1 duplicate(Pronterian) Pronterian#1 844 prontera,150,152,1 duplicate(Pronterian) Pronterian#2 844 prontera,150,154,1 duplicate(Pronterian) Pronterian#3 844 then fetch the variables with $@PrtMap1$ $@PrtX1 $@PrtY1 and so on.. PS: I haven't test the script myself 1 Quote
0 Jarek Posted July 27, 2018 Posted July 27, 2018 (edited) You have a few hidden symbols at first strnpcinfo(2) before and after 'o' Just retype this part Edited July 27, 2018 by Jarek Quote
0 crazyarashi Posted July 27, 2018 Posted July 27, 2018 (edited) getmapxy(@mapname, @mapx, @mapy, UNITTYPE_NPC, "strnpcinfo(3)"); No need to make it hard :)) Edited July 27, 2018 by crazyarashi Quote
0 BigBurrito Posted July 27, 2018 Author Posted July 27, 2018 @Jarek what do you mean? Can you point it out if you wouldn’t mind please. Thanks :D @crazyarashi that wouldn’t work for me.. since I’ll be duplicating the npc many times, and will be used in different locations, i dont want to set up one by one changing the numbers since i use these values couple of times in the middle of the script. Would be easier for me to just change the hidden npc name part and just change it to 1,2,3,4,5.... Quote
0 Technoken Posted July 27, 2018 Posted July 27, 2018 You need to use getd to fetch the reference of the variable. and since strnpcinfo(2) returns a string, you need to convert it to number using atoi command. Try getmapxy(getd("$mapPRT"+strnpcinfo(2)+"$"), getd($xPRT["+atoi(strnpcinfo(2))+"]), getd($yPRT["+atoi(strnpcinfo(2))+"]), UNITTYPE_NPC, strnpcinfo(3)); 1 Quote
0 BigBurrito Posted July 27, 2018 Author Posted July 27, 2018 @Technoken interesting. I will try once i get home. I wonder if instead of #number i use letters. Like Pronterian#A , Pronterian#B, etc? Would i need to convert too? Thanks for your response. Quote
0 BigBurrito Posted July 27, 2018 Author Posted July 27, 2018 [Warning]: Unexpected type for argument 2. Expected number. [Debug]: Data: string value="+atoi(strnpcinfo(2))+" [Debug]: Function: getelementofarray [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: Unexpected type for argument 1. Expected string. [Debug]: Data: variable name='$xPRT' index=0 [Debug]: Function: getd [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: Unexpected type for argument 2. Expected number. [Debug]: Data: string value="+atoi(strnpcinfo(2))+" [Debug]: Function: getelementofarray [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Warning]: Unexpected type for argument 1. Expected string. [Debug]: Data: variable name='$yPRT' index=0 [Debug]: Function: getd [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Error]: buildin_getmapxy: fatal error ! player not attached! [Debug]: Function: getmapxy (5 parameters): [Debug]: Data: reference name='$mapPRT1$' type=C_NAME [Debug]: Please report this!!! - script->str_data.type=C_NOP [Debug]: Data: variable name='0' index=0 [Debug]: Data: variable name='0' index=0 [Debug]: Data: number value=1 [Debug]: Data: string value="Pront[1]" [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) [Error]: buildin_getmapxy: variable '0' for mapX is not a server variable, but no player is attached! [Debug]: Source (NPC): Pronterian#1 at prontera (150,150) Got this error now. I think I'm gonna have to do it manually.. Quote
0 BigBurrito Posted July 28, 2018 Author Posted July 28, 2018 I think I've found a workaround. Can anyone confirm if this would not interfere with each other? PD: Also, I've noticed the use of prefix . (dot) However I might need to call for other npcs X and Y pos, that is why I'm doing it still with [.npcNum] ///////////NPC1 prontera,150,150,1 script Pronterian#1::Pront[1] 844,{ OnInit: set .npcNum, atoi(strnpcinfo(2)); getmapxy(.PronterianMap$, .xPRT[.npcNum], .yPRT[.npcNum], UNITTYPE_NPC, "strnpcinfo(3)"); end; } ///////////NPC2 prontera,150,152,1 script Pronterian#2::Pront[2] 844,{ OnInit: set .npcNum, atoi(strnpcinfo(2)); getmapxy(.PronterianMap$, .xPRT[.npcNum], .yPRT[.npcNum], UNITTYPE_NPC, "strnpcinfo(3)"); end; } ///////////NPC3 prontera,150,154,1 script Pronterian#3::Pront[3] 844,{ OnInit: set .npcNum, atoi(strnpcinfo(2)); getmapxy(.PronterianMap$, .xPRT[.npcNum], .yPRT[.npcNum], UNITTYPE_NPC, "strnpcinfo(3)"); end; } Quote
0 BigBurrito Posted July 29, 2018 Author Posted July 29, 2018 @Technoken Thanks man. Worked. I tried your second suggestion. Doing duplicates, but for some reason, the .@id only sets to one number for all NPCs. I check this by using mes "+.@id+"; and they all showed the same number even tho on the NPC name I assigned them different numbers. Maybe a bug? I dont really know why it happens. Quote
Question
BigBurrito
Can anyone help me figure out why this is happening. I'm still learning how to manage these values. Thank you in advance.
prontera,150,150,1 script Pronterian#1::Pront[1] 844,{ OnInit: getmapxy("$mapPRT"+strnpcinfo(2)+"$", $xPRT["+strnpcinfo(2)+"], $yPRT["+strnpcinfo(2)+"], UNITTYPE_NPC, "strnpcinfo(3)"); end; }
I get this on my console:
[Warning]: Unexpected type for argument 2. Expected number.
[Debug]: Data: string value="+strnpcinfo(2)+"
[Debug]: Function: getelementofarray
[Debug]: Source (NPC): Pronterian#1 at prontera (150,150)
[Warning]: Unexpected type for argument 2. Expected number.
[Debug]: Data: string value="+strnpcinfo(2)+"
[Debug]: Function: getelementofarray
[Debug]: Source (NPC): Pronterian#1 at prontera (150,150)
[Warning]: Unexpected type for argument 1. Expected variable, got C_STR.
[Debug]: Data: string value="$mapPRT1$"
[Debug]: Function: getmapxy
[Debug]: Source (NPC): Pronterian#1 at prontera (150,150)
[Warning]: script: buildin_getmapxy: mapname value is not a variable.
[Debug]: Source (NPC): Pronterian#1 at prontera (150,150)
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.