Dragon Breath Rev

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

Dragon Breath Rev

Post by Emera Nova »

So I'm trying to figure out a way to make the dragons breath rev have the ability to shoot out a ball of fire that could either feed off the energy that you have or be stored up in charges on the weapon. Problem is that gun has to have its reload secondary action otherwise the gun won't fire.
How do I go about putting in this code into the gun so that it works along side the reload action?

Code: Select all

{
			class = "CastSpell",
			name = "fireball",
			uiName = "Fireball",
			cooldown = 5,
			spell = "fireball",
			energyCost = 25,
			power = 4,
			charges = 9,
			fullGfxIndex = 215,
			emptyGfxIndex = 216,
			requirements = { "concentration", 1 },
		},
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Dragon Breath Rev

Post by minmay »

Easy option: use ItemComponent:setSecondaryAction() to allow the fireball when the gun is fully reloaded, and Reload otherwise.
Slightly harder option: Come up with an interface for selecting from more than 2 item actions. Now that there is a PartyComponent.onDrawAttackPanel hook it should be easy to implement something like this.
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: Dragon Breath Rev

Post by Emera Nova »

Do I use "ItemComponent:setSecondaryAction()" inside the script for the gun somewhere or in the dungeon as a script somewhere?

Code: Select all

defineObject{
	name = "revolver",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/revolver.fbx",
		},
		{
			class = "Item",
			uiName = "Dragonbreath Revolver",
			description = "Powerful runes and enchantments are inscribed upon this weapon to keep its intricate mechanisms working.",
			gfxIndex = 332,
			gfxIndexPowerAttack = 417,
			impactSound = "impact_blunt",
			secondaryAction = "reload",
			weight = 1.5,
			traits = { "firearm" },
		},
		{
			class = "FirearmAttack",
			attackPower = 22,
			cooldown = 1.5,
			attackSound = "gun_shot_small",
			ammo = "pellet",
			clipSize = 6,
			jamChance = 12,
			requirements = { "firearms", 3 },
		},
		{
			class = "ReloadFirearm",
			uiName = "Reload",
			name = "reload",
			requirements = { "firearms", 3 },
			gameEffect = "Reloads all six chambers of the revolver."
		},
		{
			class = "CastSpell",
			name = "fireball",
			uiName = "Fireball",
			cooldown = 5,
			spell = "fireball",
			energyCost = 25,
			power = 4,
			charges = 9,
			fullGfxIndex = 215,
			emptyGfxIndex = 216,
			requirements = { "concentration", 1 },
		},
	},
}
Thats what I have down at the moment my guess is its loaded with errors xD..
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Dragon Breath Rev

Post by minmay »

Emera Nova wrote:Do I use "ItemComponent:setSecondaryAction()" inside the script for the gun somewhere or in the dungeon as a script somewhere?
For the behaviour I described you would set the secondary action to fireball when reload is used and set the secondary action to reload when firearmattack is used.
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: Dragon Breath Rev

Post by Emera Nova »

:shock: how do you do that :shock:
Post Reply