pisopower
Members-
Posts
7 -
Joined
-
Last visited
Never
pisopower's Achievements
Newbie (1/14)
0
Reputation
-
The random message is not activated with arrows, is good for me. And i have found another funcionallity, with GetScriptedNPCName i prevent to activate npcs with arrows. But, i found an error in the script of the first post, with the map index, that i have put it "1" , and is GetPlayerMap. Then here is the script ``` Function GetScriptedNpcName(Index) Dim dir dir = GetPlayerDir(Index) dim masX dim masY If dir = 1 Then masX=0 masY=1 Else If dir = 2 Then masX=-1 masY=0 Else If dir = 0 Then masX=0 masY=-1 Else If dir = 3 Then masX=1 masY=0 End If End If End If End If Dim cc cc = 1 Do While cc < 20 If GetNpcX(GetPlayerMap(Index),cc) = (GetPlayerX(Index) + masX) Then If GetNpcY(GetPlayerMap(Index),cc) = (GetPlayerY(Index) + masY) Then GetScriptedNpcName = GetNpcName(GetMapNpcNumber(GetPlayerMap(Index),cc)) cc = 20 'Exit Sub End If End If cc = cc + 1 Loop End Function Sub RandomNPCMsg(Index, NameNPC) Dim total total = GetVar("\Scripts\npcextras\RandomMsg.ini", "" & NameNPC & "" ,"total") Dim num num = rand(1,total) Dim msg msg = GetVar("\Scripts\npcextras\RandomMsg.ini", "" & NameNPC & "" ,"var" & num) Call PlayerMsg(Index,msg, WHITE) End Sub ``` The usage in ScriptedNpc(Index,Script): ``` Case 4 'RANDOM Messages Dim NameNPC NameNPC = GetScriptedNpcName(Index) Call RandomNPCMsg(Index, NameNPC) Exit Sub ``` Then put script to 4 in all random messages npcs. The "\Scripts\npcextras\RandomMsg.ini" is this (in total, total of possible messages): ``` [NPCRandom1] total=2 var1=message1 var2=message2 [NPCRandom2] total=1 var1=message1 ``` The other funcion is to prevent activate ScriptedNpc with arrow: ``` Case X If GetScriptedNpcName(Index) = "Name_of_Npc" Then Call PlayerMsg(Index,"This activated only near npc",GREEN) End If Exit Sub ```
-
(edited) sorry, i look for solution now
-
Yes, the arrow activate npc but then, a lot of scripts based on ScriptedNpc's do the same, ¿how can i control it?
-
> Your function should work, but if a scripted NPC is activated by a player's arrow or if there are several npcs near the player, it may run into some issues. Ok, very thanks [rare name admin], i go to test it
-
Hi but, if i do ``` Case 2 Call RandomNPCMsg(Index, "Larry") Exit Sub ```I must use more than 1 script slot and with > Target = Int(GetPlayerTargetNpc(Index)) > Call PlayerMsg(Index,Cstr(Target),YELLOW) > NpcName = CStr(GetNpcName(Target)) GetPlayerTargetNpc returns -1, and not have any result because any npc have -1 number. ¿Is this correct? Then if this function is fine i can post this but i wanted an opinion before, thanks
-
a ok, im not sure if not are any function to do, but, this are for a modification of random messages scripts: ``` Sub RandomNPCMsg(Index, NameNPC) Dim total total = GetVar("\Scripts\npcextras\RandomMsg.ini", "" & NameNPC & "" ,"total") Dim num num = rand(1,total) Dim msg msg = GetVar("\Scripts\npcextras\RandomMsg.ini", "" & NameNPC & "" ,"var" & num) Call PlayerMsg(Index,msg, WHITE) End Sub ``` And RandomMsg.ini : ``` [RandomNpcMsg1] total=2 var1=message1 var2=message2 ... [RandomNpcMsg2] total=1 var1=probando1 ... ``` But im seeing a fail, if a i have various npc with same name… , then i need GetScriptedNpcNum Is funny eclipse xD (The script is for have different npc random message in 1 script and 1 file, i see in tutorials some that are for only one, then for use less scripts) sorry for my english
-
Hi all, I've few days with eclipse, ¿there are any way to get name of scripted npc? I think this function, but i not know if are better way. Thanks :D ``` Function GetScriptedNpcName(Index) Dim dir dir = GetPlayerDir(Index) dim masX dim masY If dir = 1 Then masX=0 masY=1 Else If dir = 2 Then masX=-1 masY=0 Else If dir = 0 Then masX=0 masY=-1 Else If dir = 3 Then masX=1 masY=0 End If End If End If End If Dim cc cc = 1 Do While cc < 20 If GetNpcX(GetPlayerMap(Index),cc) = (GetPlayerX(Index) + masX) Then If GetNpcY(GetPlayerMap(Index),cc) = (GetPlayerY(Index) + masY) Then GetScriptedNpcName = GetNpcName(GetMapNpcNumber(1,cc)) cc = 20 'Exit Sub End If End If cc = cc + 1 Loop End Function ``` (Edit:) The line: GetScriptedNpcName = GetNpcName(GetMapNpcNumber(1,cc)) is wrong, the correct is: GetScriptedNpcName = GetNpcName(GetMapNpcNumber(GetPlayerMap(Index),cc)) down in other post is the correct script