Jump to content
  • 0
Like it~*

Mode clone don't work

Question

Hello. I've been trying to create a copy of players for representation in the Hall of Fame all day, but I can not. The only way I imagined doing this is through the "clone" command. Look at the structure:

*clone("<map name>", <x>, <y>, "<event>", <char id>{, <master_id>{, <mode>{, <flag>, <duration>}}})

As it will only be a "representation" of the player, I would like the clone to be immobile, not to attack and not to move. But it is not working. What is wrong? My script.

prontera,158,168,2	script	HALL	4W_M_01,{
clone "prontera", 157, 167, "HALL::OnMobDead", 150005,0,0x0; //{, <master_id>{, <mode>{, <flag>, <duration>}}})
close;
OnMobDead:
}

The value of "mode" was taken from here in the doc folder of the emulator. Where as can be seen:

06: 0x0000 (passive, immobile, can't attack) [plants]

I also found this topic, but it did not help much.

 

@edit 

I would like to leave it like this:

 

10oicm1.jpg

Edited by Like it~*

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

not sure clone() is a good idea, because it requires the cloned player to be online, but if that's intended then try this:

.@mobGID = clone("prontera", 157, 167, "HALL::OnMobDead", 150005, 0, 0x0); // make the clone
setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ (1 | 128)); // prevent from attacking & moving 

this makes it unable to move or attack, but doesn't (and can't) prevent the player from attacking it

 

An alternative could be to use a NPC instead and change its appearance by manipulating UDT_SEX, UDT_HAIRSTYLE, UDT_HAIRCOLOR, UDT_HEADBOTTOM, UDT_HEADMIDDLE, UDT_HEADTOP, UDT_CLOTHCOLOR, UDT_SHIELD, and UDT_WEAPON, but I don't know if the Gravity client supports dynamic NPCs

Share this post


Link to post
Share on other sites
  • 0

not sure clone() is a good idea, because it requires the cloned player to be online, but if that's intended then try this:

.@mobGID = clone("prontera", 157, 167, "HALL::OnMobDead", 150005, 0, 0x0); // make the clone
setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ (1 | 128)); // prevent from attacking & moving 

this makes it unable to move or attack, but doesn't (and can't) prevent the player from attacking it

 

An alternative could be to use a NPC instead and change its appearance by manipulating UDT_SEX, UDT_HAIRSTYLE, UDT_HAIRCOLOR, UDT_HEADBOTTOM, UDT_HEADMIDDLE, UDT_HEADTOP, UDT_CLOTHCOLOR, UDT_SHIELD, and UDT_WEAPON, but I don't know if the Gravity client supports dynamic NPCs

 

If we analyze the image, we will find that all copies of the players have a crown on top of their heads, and also that these copies remain the entire month on that rug, regardless of whether the player is online, so I think they are not really a clone. However, I can not imagine any other way to do this :( I need your help ...
 
Note: I tested your script and the clone still attacks, but as we discussed above, the clone script will no longer be useful.

Share this post


Link to post
Share on other sites
  • 0

Try making a template npc and then cloning it with a duplicate() header and in OnInit use setunitdata to change its appearance

Share this post


Link to post
Share on other sites
  • 0
On 2017-6-7 at 4:49 PM, meko said:

Try making a template npc and then cloning it with a duplicate() header and in OnInit use setunitdata to change its appearance

It stayed that way, but it still does not work.

-	script	HALL	FAKE_NPC,{
	OnInit:
	query_sql( "select sex, class, hair, hair_color, char_id from `char` where online = 1 order by name asc limit 128", .@sex, .@class, .@hairstyle, .@haircolor, .@haircolor);
	query_sql( "select clothes_color, name, char_id from `char` where online = 1 order by name asc limit 128", .@cloth, .@name$, .@char_id );
	//monster <"map name">, <x>, <y>, <"display name">, <mob id>, <amount>[, <"event label">];
	.@mobGID = monster ("prontera", 157, 167, ".@name$", 2266, 1);
	// prevent from attacking & moving
	setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ (1 | 128));
	setunitdata(.@mobGID, UDT_SCOPTION, 1);
	setunitdata(.@mobGID, UDT_MASTERCID, .@char_id);
	setunitdata(.@mobGID, UDT_LOOKDIR, 0);
	//appearance
	setunitdata(.@mobGID, UDT_SEX, .@sex);   
	setunitdata(.@mobGID, UDT_CLASS, .@class);    
	setunitdata(.@mobGID, UDT_HAIRSTYLE, .@hairstyle);
	setunitdata(.@mobGID, UDT_HAIRCOLOR, .@haircolor);
	setunitdata(.@mobGID, UDT_HEADTOP, 2235);
	setunitdata(.@mobGID, UDT_CLOTHCOLOR,.@cloth);
	end;
}

Map-server errors:

[Debug]: Source (NPC): HALL (invisible/not on a map)
[Warning]: buildin_setunitdata: Invalid data type '(null)' for mob unit.
[Debug]: Source (NPC): HALL (invisible/not on a map)
[Error]: status_set_viewdata (MOB): No view data for class 4065
[Error]: buildin_setunitdata: Invalid value 150005 for argument #3. (min: 0, max: 8)
[Debug]: Source (NPC): HALL (invisible/not on a map)

 

Share this post


Link to post
Share on other sites
  • 0

this error stems from you putting a space between "monster" and the parentheses; to get a return value you need parentheses right after the command.. your .@mobGID var never gets assigned because of the way you call the monster command (statement vs function)

Share this post


Link to post
Share on other sites
  • 0
On 2017-6-10 at 1:27 AM, meko said:

this error stems from you putting a space between "monster" and the parentheses; to get a return value you need parentheses right after the command.. your .@mobGID var never gets assigned because of the way you call the monster command (statement vs function)

I took the space out and even then there are still errors and nothing changes in the appearance of the monster.

-	script	HALL	FAKE_NPC,{
	OnInit:
	query_sql( "select sex, class, hair, hair_color, char_id from `char` where online = 1 order by name asc limit 128", .@sex, .@class, .@hairstyle, .@haircolor, .@haircolor);
	query_sql( "select clothes_color, name, char_id from `char` where online = 1 order by name asc limit 128", .@cloth, .@name$, .@char_id );
	//monster <"map name">, <x>, <y>, <"display name">, <mob id>, <amount>[, <"event label">];
	.@mobGID = monster("prontera", 157, 167, ".@name$", 2266, 1);
	// prevent from attacking & moving
	setunitdata(.@mobGID, UDT_MODE, getunitdata(.@mobGID, UDT_MODE) &~ (1 | 128));
	setunitdata(.@mobGID, UDT_SCOPTION, 1);
	setunitdata(.@mobGID, UDT_MASTERCID, .@char_id);
	setunitdata(.@mobGID, UDT_LOOKDIR, 0);
	//appearance
	setunitdata(.@mobGID, UDT_SEX, .@sex);   
	setunitdata(.@mobGID, UDT_CLASS, .@class);    
	setunitdata(.@mobGID, UDT_HAIRSTYLE, .@hairstyle);
	setunitdata(.@mobGID, UDT_HAIRCOLOR, .@haircolor);
	setunitdata(.@mobGID, UDT_HEADTOP, 2235);
	setunitdata(.@mobGID, UDT_CLOTHCOLOR,.@cloth);
	end;
}
[Debug]: Source (NPC): HALL (invisible/not on a map)
[Warning]: buildin_setunitdata: Character ID 0 not found for master change!
[Debug]: Source (NPC): HALL (invisible/not on a map)
[Error]: status_set_viewdata (MOB): No view data for class 0

@meko

Edited by Like it~*

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.