Jump to content
  • 0

Monster Spawning Question


eakzoi

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/04/22
  • Last Seen:  

Hello! I'll try to get straight to the point, but I highly appreciate the time and effort people put into this community, so thanks in advance regardless of the outcome in this post!

I'm trying to make a "Fake Population" system with mob_avail.yml, but I think in order to make this have a much more realistic behavior, I wanted to be able to spawn my mobs / fake players "randomly".

For example, looking at the monster spawning command that I have in hands:

prontera,0,0    monster    PlayerTest    3000,150,5000,4000,0,0,1

I wish I could something like:

prontera,0,0    monster    PlayerTest    rand(3000,3100),rand(50,200),5000,4000,0,0,1

So I want to be able to pick a random MobID from that range (3000 to 3100) and a random quantity as well.

I believe another option that would make this more reliable is to be able to make mob_avail support the option for random HairStyles, HairColors and HelmTop/Mid/Down through some randomization as well.

I would appreciate if I could get my hands on such script (not a programmer myself) and or if someone could guide me through the steps to make mob_avail to support such a feature through changing the SRC files.

Thank you!

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

I think you will have more control with this here.

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/04/22
  • Last Seen:  

Wow, thanks for the prompt response, and such a useful one too haha!

It says on the beginning of the file to add that to script.cpp OR custom folder.

I'm assuming that adding it to the .CPP file would require a server recompile or something ? If so, where exactly do I add it? Just anywhere or before / after a specific line of code?

And what would be that alternative mentioned in the file (the custom folder one, is that referring to Hercules plug-in system?)

@EDIT:
I also realized something, it's not summoning any monster with a player skin, it's summoning a Poring with a player skin. Ideally I would like to create new monsters on the mob_db (so that I can have different behaviors, levels, skills) while also randomizing their look. So if there's a way to modify that, that would be great too!

Thank you once more, and sorry for asking so many questions!

Edited by eakzoi
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  882
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@eakzoiU able to realize it by using setunitdata()

Take a look at doc/script_commands.txt

 

Rynbef~

Edited by Rynbef
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

22 hours ago, eakzoi said:

I also realized something, it's not summoning any monster with a player skin, it's summoning a Poring with a player skin. Ideally I would like to create new monsters on the mob_db (so that I can have different behaviors, levels, skills) while also randomizing their look. So if there's a way to modify that, that would be great too!

That is no problem. Just search for this line and change the MobID (1002) to ur wish.

// Using poring as monster behavior
md = mob_once_spawn_sub(NULL, m, x, y, name, 1002, "", SZ_SMALL, AI_NONE);

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/04/22
  • Last Seen:  

@WhiteEagle I noticed that I can change that, but like I said I would be changing that to only one behavior would I not ? I want to be able to select multiple from the mob_db. Having the monsters is fine, I just need a way to randomize how they look while in-game. If there's a way to change that function to get the behavior from an ID form the mob_db that would be perfect I think!

@Rynbef Not sure I get what you said but I'll try what you suggested out and update you if I had any success ?

Edited by eakzoi
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  76
  • Topics Per Day:  0.02
  • Content Count:  461
  • Reputation:   61
  • Joined:  08/28/12
  • Last Seen:  

I think, you don't understand the source change correctly.
It create a new function like summon/monster spawning.

 fakeplayer( map, x, y, name, job_id, sex, hair_style, hair_color, weapon, shield, head_top, head_mid, head_bottom, option, cloth_color );

Just make a script like this as excample:

OnInit:
  setarray .hairstyle,1,2,3,4,5,6;
  setarray .haircolor,1,2,3,4,5,6;
  and so on !!
  .size_hairstyle = getarraysize(.hairstyle);
  .size_haircolor = getarraysize(.haircolor);
  .@r = rand(.size_hairstyle);
  .@r2 = rand(.size_haircolor);
  .@i = 30;
  while (.@i <= 30) {
	fakeplayer( map, x, y, name, job_id, sex, .hairstyle[.@r], .haircolor[.@r2], weapon, shield, head_top, head_mid, head_bottom, option, cloth_color );
	.@i++;
  }
  end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/04/22
  • Last Seen:  

@WhiteEagle I understood what the function does from the beginning, but what I'm saying is that (from what I can see) the Monster Behavior is hardcoded in the Function inside the Source. It means that even if I summon 99 Players, all the 99 Players will have the exact same behavior and use the exact same skills, whereas I want to summon for example, monster 3000, 3001, 3002, 3003 each with their own behavior and stats. At least this is what seems to be the case, unless there's a way to override the monster behavior outside of the SRC code. Not to mention that all Porings (Monster ID 1002) in the game are players now lol - This is not the solution I'm looking for unfortunately. Maybe this can be done setunitdata(); like @Rynbef suggested ?

Thanks for the help nonetheless !

Edited by eakzoi
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  882
  • Reputation:   117
  • Joined:  05/23/12
  • Last Seen:  

@eakzoi How @WhiteEaglealready said. This is the solution u requested.

20 hours ago, WhiteEagle said:

I think, you don't understand the source change correctly.
It create a new function like summon/monster spawning.

 fakeplayer( map, x, y, name, job_id, sex, hair_style, hair_color, weapon, shield, head_top, head_mid, head_bottom, option, cloth_color );

Just make a script like this as excample:

OnInit:
  setarray .hairstyle,1,2,3,4,5,6;
  setarray .haircolor,1,2,3,4,5,6;
  and so on !!
  .size_hairstyle = getarraysize(.hairstyle);
  .size_haircolor = getarraysize(.haircolor);
  .@r = rand(.size_hairstyle);
  .@r2 = rand(.size_haircolor);
  .@i = 30;
  while (.@i <= 30) {
	fakeplayer( map, x, y, name, job_id, sex, .hairstyle[.@r], .haircolor[.@r2], weapon, shield, head_top, head_mid, head_bottom, option, cloth_color );
	.@i++;
  }
  end;
}

 

Fakeplayer() returns the Mob GID after spawn. U can store it in a variable and use setunitdata() to change or randomize the stats etc.

 

Rynbef~

Edited by Rynbef
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/04/22
  • Last Seen:  

Ah right, okay, I'm going to try that, thank you !

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...