Jump to content
  • 0

[source request] 'monster2' command


Kurofly

Question


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Hi there;

 

That'd would very nice if I had the possibility of spawning a monster with a defined amount of HP.

I thought a bit about it and didn't find any solution other than creating a script command like:

 

  • monster2 <"map name">, <x>, <y>, <"display name">, <mob id>, <amount>, <amount of HPs>[, <"event label">];

 

If someone could make that for me, that'd be really cool  :)

Kindly let me know if anyone knows another way to do it, I didn't manage to find one myself.

 

Thanks in advance  /no1

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

doc/script_commands.txt#L7079


*getunitdata <GID>,<arrayname>;
*setunitdata <GID>,<parameter>,<new value>;

This is used to get and set special data related to the unit.
With getunitdata, the array given will be filled with the current data. In setunitdata
the indexes in the array would be used to set that data on the unit. 

Parameters (indexes) for monsters are:

	0 - size (big, small, normal)	7  - y							14 - hair style			21 - weapon			28 - LUK
	1 - level						8  - speed						15 - hair color			22 - looking dir	29 - for slave to copy master's mode
	2 - HP							9  - mode 						16 - head gear bottom	23 - STR			30 - immune from attacks state
	3 - max HP						10 - special AI state	 		17 - head gear middle	24 - AGI
	4 - master AID					11 - SC option					18 - head gear top		25 - VIT
	5 - map ID						12 - sex						19 - cloth color		26 - INT
	6 - x							13 - class (Monster ID, Job ID)	20 - shield				27 - DEX

Parameter (indexes) for homunculi are:

	0 - size (big, small, normal)	7  - map ID			14 - canmove_tick	21 - immune from attacks state
	1 - level						8  - x				15 - STR
	2 - HP							9  - y				16 - AGI
	3 - max HP						10 - hunger			17 - VIT
	4 - SP							11 - intimacy		18 - INT
	5 - max SP						12 - speed			19 - DEX
	6 - master Character ID			13 - looking dir	20 - LUK

Parameter (indexes) for pets are:

	0 - size (big, small, normal)	7  - y				14 - AGI
	1 - level						8  - hunger			15 - VIT
	2 - HP							9  - intimacy		16 - INT
	3 - max HP						10 - speed			17 - DEX
	4 - master AID					11 - looking dir	18 - LUK
	5 - map ID						12 - canmove_tick	19 - immune from attacks state
	6 - x							13 - STR

Parameter (indexes) for mercenaries are:

	0 - size (big, small, normal)	7  - kill count		14 - VIT
	1 - HP							8  - life time		15 - INT
	2 - max HP						9  - speed 			16 - DEX
	3 - master Character ID			10 - looking dir	17 - LUK
	4 - map ID						11 - canmove_tick	18 - immune from attacks state
	5 - x							12 - STR
	6 - y							13 - AGI

Parameter (indexes) for elementals are:

	0 - size (big, small, normal)	7  - x				14 - STR
	1 - HP							8  - y				15 - AGI
	2 - max HP						9  - life time		16 - VIT
	3 - SP							10 - mode			17 - INT
	4 - max SP						11 - speed			18 - DEX
	5 - master Character ID			12 - looking dir	19 - LUK
	6 - map ID						13 - canmove_tick	20 - immune from attacks state

Parameter (indexes) for NPCs are:

	0 - display		7  - looking dir
	1 - level		8  - STR
	2 - HP			9  - AGI
	3 - max HP		10 - VIT
	4 - map ID		11 - INT
	5 - x			12 - DEX
	6 - y			13 - LUK

*Notes: For mode, see doc/mob_db_mode_list.txt
	    For map ID, this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c)
	    For 'setunitdata', map name can also be passed in as a valid value instead of map ID

Example:
	// Spawn some Porings and save the Game ID.
	// - Keep in mind, when the 'monster' script command is used,
	// - all the spawned monster GID's are stored in an array
	// - called $@mobid[].
	monster "prontera",149,190,"Poring",1002,10;
	.GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!

	// Save the strong Poring's mob data in the @por_arr[] variable. (@por_arr[1] being level, @por_arr[13] being class, etc.)
	// With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
	getunitdata .GID,@por_arr;

	// Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
	setunitdata .GID,3,1000;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Oh god!

 

This means I can edit whatever data of any monster at any time and in-game!? That's awesome!

 

Thanks a lot for that, I'll definitely make use of it  /thx

 

edit: I'm sorry to have asked help for this since it's in the script commands but this command is not in my documentation. Should have looked directly on internet ^^

Edited by Kurofly
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...