Making it so enemies fight with you instead of against you.

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!
Post Reply
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Making it so enemies fight with you instead of against you.

Post by Emera Nova »

Looking to make it so you are able to have an past enemy be a help in a fight against a boss, what would I need to do scripting wise to make it attack something other than the party and for the boss to also fight it as well as the party?
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Making it so enemies fight with you instead of against y

Post by Azel »

Assume you will need some Brain hooks there. I think JKos is doing that with a Charm Monster spell.

The hook resource:
https://sites.google.com/site/jkoslog2/
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Making it so enemies fight with you instead of against y

Post by Emera Nova »

O-O took a look at the hook stuff and my god does it seem confusing.. xD Not having coded before makes stuff like this seem so impossible.. Think I may have to just scrap the idea for now.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Making it so enemies fight with you instead of against y

Post by minmay »

You don't need the hook framework to make a custom brain, you can just put your think function as the onThink() hook in the monster definition.
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.
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Making it so enemies fight with you instead of against y

Post by Emera Nova »

minmay wrote:You don't need the hook framework to make a custom brain, you can just put your think function as the onThink() hook in the monster definition.
How would you tell the monster to attack other monsters and not the player :o
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Making it so enemies fight with you instead of against y

Post by minmay »

If it's a projectile attack, just have the brain perform the corresponding action. If it's a melee attack you'll have to change the animation events and/or onAttack hook to imitate a melee attack against the other monster in some way, since monsters won't actually hit other monsters with melee attacks. It's probably easiest to spawn an invisible fragile projectile inside the other monster's capsule, since that will take care of accuracy, damage including armor, and damage/miss messages. Figuring out the capsule's position could be problematic, though (as in, I don't know if it's actually possible).
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.
Post Reply