Author Topic: How to set up critters to be agressive? (Attack player on sight)(Solved)  (Read 2231 times)

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
Sorry for many questions, but I try to dump them together, bc I will read answer only tomorrow prob. If you feel it's too long or tiresome to answer, no problems, I'll figure it out sooner or later ;)

Q1:
I placed a few kind of rats on my map, but they do nothing, until the player does not attack them. I tried checking other maps, but the values listed by mapper were no different. I even made a rat a dialog and added the dialog@r_Alert script, but that did not work either.

So, how to solve this?

Q2:
Also, is there a way to change the loot form a monster? I used the Ctrl+Click to put some shotgun shells into a rat's loot, but I can't edit the quantity. It's like always 20. I edited the map file, and found the container for the item, but did not see anything related to quantity. (However I could add more items into the loot which I couldn't with Ctrl+Click from Mapper.)

Q3:
Are there any docs on how to use scripts? I can understand most of the script code, they are pretty straightforward, but I don't understand their call process, events, etc. yet.
So far if I understand correctly, the Script value in Mapper means the script file, (scriptname.fos) and the Function value means a function in this file, called when initializing/spawning the NPC?

Q4:
If I want to make a map location personal, so only the player can see it (like first quest, getting a tent), only he can access it, and noone can stumble into him, while going around the world map at that location. How do I do that?
« Last Edit: August 02, 2015, 02:38:12 pm by Slowhand »

Offline Lexx

  • Rotator
  • Mexican Apple Thief
Re: How to set up critters to be agressive? (Attack player on sight)
« Reply #1 on: July 31, 2015, 09:22:27 pm »
For 2238 we made a special mob script. Example can be found in the Klamath map. Check out the rats or geckos.


If you add an item to a critter, then go into its inventory, click on the item and adjust the quantity in the popup menu (usually left side of the screen. It's huge, can't miss it).
« Last Edit: July 31, 2015, 09:24:05 pm by Lexx »

Offline Ghosthack

  • Rotator
  • Bytecruncher
Re: How to set up critters to be agressive? (Attack player on sight)
« Reply #2 on: August 01, 2015, 02:39:29 pm »
Q3:
Are there any docs on how to use scripts? I can understand most of the script code, they are pretty straightforward, but I don't understand their call process, events, etc. yet.
So far if I understand correctly, the Script value in Mapper means the script file, (scriptname.fos) and the Function value means a function in this file, called when initializing/spawning the NPC?
There is no coherent guide unfortunately, the best way is to look at the source and see how it works. You are right about the init script thing, the same applies to items placed in mapper with script string.

Q4:
If I want to make a map location personal, so only the player can see it (like first quest, getting a tent), only he can access it, and noone can stumble into him, while going around the world map at that location. How do I do that?
CreateLocation(uint locationPid, uint posX, uint posY, Critter@ player); is probably what you want. if last parameter is null, it will be public, IIRC.

Having a look at how TryCreateTent works is probably also a good idea:

https://github.com/rotators/fo2238/blob/master/Server/scripts/map_tent.fos#L563-L644