spawn a monster with a script

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: spawn a monster with a script

Post by FeMaiden »

i'm just trying to learn this stuff to make my mod more interesting.
but I can't make my vision come to life if I don't know how to use the tools given to me.

I don't want to have just a long line of rooms with monsters in them and then it says "you win"

if people are just gonna come back at me and say "oh your mod sucks, it's boring, there's not enough puzzles" after I spent 350 hours on it, then why bother?
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: spawn a monster with a script

Post by THOM »

You have to open the definition. It is not in the editor.

The monsterdefinitions are stored in the downloadable asset-pack.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: spawn a monster with a script

Post by FeMaiden »

love how you guys just "assumed" I knew that...like it's just elementary school...


forgive me for any sarcastic and biting commentary...i'm just frustrated


and I have the asset pack and I still don't know what to do with it, I don't know how to install it or where to put it or how to use it.
in a prevous post, someone told me its just for reference purposes and I don't install it?
but that seems misinformed.
because there are assets for LoG 1 monsters in there.

and you still have not answered my question

where is the frigging onDie hook?!

is it in the asset pack folder > assets > scripts > monsters
and then I open the lua file for the herder and modify something in there?
but I looked at the file and I saw nothing that says "onDie hook"



I saw the loot there so on a side question, could I delete the loot so that herders no longer drop food?


minmay also said to script a "delay" when my herder dies before it spawns the herder swarm so the game has time to remove the herder object.


I just thought it would be cool to make in just one area some unique herders that split into 2 smaller herders when i kill them. I also considered making a pack of "quasi-ratlings" that are actually just swarms of rats combined together to look like a ratling, so like that player enters a dungeon full of ratlings with guns and swords and knives and each ratling they kill spawns a rat swarm where it died. and then i could put a backstory that these quasi-ratlings are actually symbiotic colonies of rats that formed together to make a multicellular organism with the appearance of a ratling. and then have a ratling boss that splits into 9 swarms of rats in a 3x3 pattern that immediatley try to attack the player as soon as they kill the ratling big boss.

but maybe my idea is just stupid as it will create more combat and it seems like people don't like the combat, they just want puzzles...
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: spawn a monster with a script

Post by Dr.Disaster »

FeMaiden wrote:I just thought it would be cool to make in just one area some unique herders that split into 2 smaller herders when i kill them. I also considered making a pack of "quasi-ratlings" that are actually just swarms of rats combined together to look like a ratling, so like that player enters a dungeon full of ratlings with guns and swords and knives and each ratling they kill spawns a rat swarm where it died. and then i could put a backstory that these quasi-ratlings are actually symbiotic colonies of rats that formed together to make a multicellular organism with the appearance of a ratling. and then have a ratling boss that splits into 9 swarms of rats in a 3x3 pattern that immediatley try to attack the player as soon as they kill the ratling big boss.
Sounds interesting to me.
IIRC somebody made a similar custom slime monster for LoG 1 that started out HUGE and split/spawned more.
FeMaiden wrote:but maybe my idea is just stupid as it will create more combat and it seems like people don't like the combat, they just want puzzles...
Don't worry too much about what people "might" want. A rule of thumb says that one third combat one third puzzles one third exploring works fine. Yet there are cool mods that go against that and still do well like Peasant's Quest: Tower of Rothuxstat or The Taltraxus Engine for LoG 1.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: spawn a monster with a script

Post by FeMaiden »

thanks for the words of encouragemnt, i think.

anyhoo, I have still not figured this out, but I found a workaround just using the in game assets and triggers and stuff, and i just modified my story again to accomodate what I did.

I'll admit that my mod originally started out as 60% combat, 35% exploration, 5% puzzles, there was going to be lots of wide open areas filled with enemies....(think the desert in the main campaign)
but i'm slowly adjusting it, adding puzzles , adding traps and floor plates and hidden stuff. I try to make unexpected things happen,
but I don't want anything to seem unfair or random.

I don't want to do some junk like the player walks into an empty room and BAM a floor trigger goes off, hitting them with a fireburst. I might however, have that same floor trigger launch a fireball, giving the player the opportunity to sidestep it.

I admit, in the end, my mod might still only be maybe 20% puzzles, and 50% exploration.

one of my favorite parts of games with automaps is revealing every square. and I meticulously crafted my overworld with all the coordinates and everything lining up so when they visit every area, they can zoom out and look at their cartogpraghic success.
I even plan to tie in the final puzzle to this. the player will need to look at the fully fleshed out world map in order to determine the correct places to put the final objects to unlock the win condition.

I'm trying to add a lot of notes and backstory to explain why things are the way they are, notes to help hint at the player's true purpose, backstory about the people they work for, hints on what to do to reach the win condition, flavor text to explain why loot is in the spots it is in, metahumor, references, game tips(such as a tip explaining how to read the compass, since many players think it's broken, I myself was guilty of that but now I realize it works exactly how a compass should work) but now i'm getting writer's block...

I have a beginning and an end , and have most of my major encounters figured out, but it's all the "filler" in between. i'm also having difficulty deciding where to put all the loot. I don't want to just give them meteor armor and bane on the second map...the player needs to work for that.
so I need to put weak weapons near the start and gradually get the weapons stronger,
but this requires extensive knowledge of all the items in the game, which I mostly have, as I need to accomodate throwing weapons, firearm, missiles, light and heavy weapons builds, but I just realized Ihat I completely forgot about accessory slots. I forgot to put down any amulets, or rings and bracelets at all, so now I have to re plan my loot around that.

I also have a challenge deciding what's appropriate to put as "secret" loot like if a player solves a puzzle and opens a secret and gets loot, it should be better than average. I've been saving stat potions and books for that right now, or sometimes I give a weapon that the player might not get for a while, and if they find the secret, they will have it much earlier...

I also realized that my mod has zero pits. not one single hole for the player to fall down or use the rope to climb down, so i need to figure out how to work that in as well.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: spawn a monster with a script

Post by Isaac »

FeMaiden wrote:i'm reading the scripting reference
There is also a second script reference (A copy of the first, but it's more up to date: https://github.com/JKos/log2doc/wiki

Both references define (most of) the variables and optional hooks for each object' and they are different for each, aside from variables common to all.

party.level is a variable that will always indicate the current level of the party; just as party.x and party.y give the current x,y location for the party. Using these instead of the numerical values will have updated effects when those values change; in this case when the party moves to a new location.
The full set is: (party.level, party.x, party.y, party.facing, party.elevation) ; 'facing' is always a value of 0 to 3. Zero being up/North.
For monsters (and most everything else ~off hand), it's the same, but with the variable (in context) being 'self' instead of 'party'. eg. self.go.x, self.go.y being the object's X & Y location. That 'go' is short for game object; which perplexingly at first, does not always need to be used in all a scripting situations... but it's usually required.
Last edited by Isaac on Mon Oct 26, 2015 6:31 am, edited 3 times in total.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: spawn a monster with a script

Post by minmay »

FeMaiden wrote:I also realized that my mod has zero pits. not one single hole for the player to fall down or use the rope to climb down, so i need to figure out how to work that in as well.
why do you need to work that in? many dungeons have no pits as a deliberate design decision
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: spawn a monster with a script

Post by Isaac »

I'm always disappointed when there are no pits; (and no secrets). :mrgreen:
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: spawn a monster with a script

Post by FeMaiden »

lol, I guess I don't have to work in pits, but I want to have the rope item and have places for the player to use it.
but you are right, I don't "need" to work it in.
I'll only put it in if it fits in logically with the theme of my levels...

I will have secrets :)
Post Reply