Jump to content
  • 0

getmonsterinfo working only once


darkpatow

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  07/09/20
  • Last Seen:  

Hi there, i have a script where i summon a random monster, based on an array, and announce who killed it and which monster it was. It's working, it does summon the random monster, but when it announces the killed monster, the "getmonsterinfo" function is returning "null" (O Mini-Chefe null foi MORTO pelo guerreiro [Player Name])

.mvp_mapa$ is the string "pay_dun03"

.mvp_quant is an integer to set the number of monsters.

set .mvp_mapa$,"pay_dun03";
	set .mvp_quant,1;

.@idsalamvpmvp is an array of integers with some monters' id:

	setarray .@idsalamvpmvp[0]
					,1096	// Angeling
					,1388	// ArchAngeling
					,1295   // Barão Coruja
					,1582	// Deviling
					,1093	// Eclipse
					,1307	// Gato de Nove Caudas
					,1120	// Ghostring
					,1200	// Jirtas
					,1091	// Libélula
					,1296	// Líder Cobold
					,1299	// Líder Goblin
					,1092	// Lobo Errante
					,1090	// Mastering
					,1289	// Maya Macho
					,1283	// Quimera
					,1089	// Sapo-Cururu
					,1088	// Vocal
					;

.idsalamvp is a random integer limited to the array size.

set .idsalamvp, rand(getarraysize(.@idsalamvpmvp[0]));

Here's the part that summons and announces when the monster gets killed:

monster .mvp_mapa$,0,0,getmonsterinfo(.@idsalamvpmvp[.idsalamvp],0),.@idsalamvpmvp[.idsalamvp],.mvp_quant,"salamb::OnDeadMVP";
	end;

OnDeadMVP:
	areaannounce .mvp_mapa$,20,20,280,280, "O Mini-Chefe "+getmonsterinfo(.@idsalamvpmvp[.idsalamvp],0)+" foi MORTO pel"+(Sex?"o":"a")+" guerreir"+(Sex?"o":"a")+" "+strcharinfo(0)+"!",bc_map;

ps: I don't see why it wouldn't work with local variables but it may be relevant to mention that i have a second script just like this one, using global variables and working. I had to use local variables so i have two independent scripts.

I tried to find what could be wrong with the script but i didn't manage to fix it.

Any help will be appreciated.

Edited by darkpatow
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  216
  • Reputation:   45
  • Joined:  05/03/13
  • Last Seen:  

Hello

Here is your problem:

OnDeadMVP:
	areaannounce .mvp_mapa$,20,20,280,280, "O Mini-Chefe "+getmonsterinfo(.@idsalamvpmvp[.idsalamvp],0)+" foi MORTO pel"+(Sex?"o":"a")+" guerreir"+(Sex?"o":"a")+" "+strcharinfo(0)+"!",bc_map;
.@idsalamvpmvp

It is a temporary array, change .@ to .

Edited by Kreustoo
  • Love 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...