Ask a simple question, get a simple answer

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
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Thanks! Shaman Staff like items implemented for the spells pack ;)

It always was a very low priority for me, but finally it can be fun to add some variety to item stats (I will share an update soon);
Concentration Spells Power ±p%
Fire Spells Power ±p%
Air Spells Power ±p%
Water Spells Power ±p%
Earth Spells Power ±p%
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Is there a way to detect the loss of a built in condition ~without constantly polling the champion to see if they still have it?
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Isaac wrote:Is there a way to detect the loss of a built in condition ~without constantly polling the champion to see if they still have it?
Could you not use the onStop hook??
SpoilerShow

Code: Select all

onStop = function(self, champion)
		print("cond stopped...")
	end,
If you went that way ... youd need to use

Code: Select all

champion:setConditionValue("customCond", 0)
in order to remove it, as

Code: Select all

champion:removeCondition("customCond")
will skip the onStop hook....
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

akroma222 wrote:Quick 2 questions:
1. What does projectile:pushForward() do??
2. What does champion:getDualClass() do??

Thanks all :D
Sorted projectile:pushForward()
-it translates the projectile forward or backward (with - values)

Still dont know what champion:getDualClass() is/does .... can we set dual classes??

Thanks guys
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

akroma222 wrote: Could you not use the onStop hook??
Except that it's not a custom condition; it's built in... I don't [knowingly] have access to the definition.

How does one detect the instant the PC stops being diseased, heals a wound, or [specifically] loses the water_breathing condition?

I dabbled with trying to build my own custom condition, but was unsuccessful at cleanly duplicating the effect; and did not want to implement a slew of custom GUI corrections.

It would be nice if all conditions each called an onRemoveCondition() hook when they expire; but the only one I've seen, is onReceiveCondition()

If only this would work:

Code: Select all

components = {
				{
				class = "Party",
				onRemoveCondition = function(self, champion, condition) print(champion:getName().." has lost:",condition) end,
				onReceiveCondition = function(self, champion, condition) print(champion:getName().." has gained:",condition) end,
				},
(But only the second hook is a real one. :()

*I will try again with crafting a custom condition to use instead of the built in one. ;)
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Code: Select all

defineCondition{
	name = "water_breathing",
	uiName = "Water Breathing",
	description = "You can breath under water.", -- sic
	icon = 20,
	beneficial = true,
	harmful = false,
	onStop = function(self, champion)
		print("water breathing lost")
	end,
}
You don't need to recreate the original condition. Just define a custom condition with the same name, uiName, description, and icon. The actual effects of standard conditions are hardcoded based on their names.
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: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

minmay wrote:You don't need to recreate the original condition. Just define a custom condition with the same name, uiName, description, and icon. The actual effects of standard conditions are hardcoded based on their names.
That's the first I've seen it be useful to us. :)

Thank you.

I had defined a custom condition, but had given it a different name, and [not being the built in version], I was having issues with the energy bar visibly refilling each tick. Later (today) I defined a separate condition that I realized would always be given in tandem with water_breathing; and so added what I needed to it instead.

Your's is a great solution. 8-) I will redefine water_breathing to at least signal when it has ended.

BTW minmay... do you know what the third [boolean] value passed into the onStart condition hook represents? [I'm asking because I do not.]

Code: Select all

onStart = function(self, champion, mystery) 
   print(mystery, "!")
   end,
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:BTW minmay... do you know what the third [boolean] value passed into the onStart condition hook represents? [I'm asking because I do not.]
It's false if the champion already has the condition in question. True if they didn't.
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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

I'm trying to make a weapon that shoots a projectile as the first action. The projectile itself (as an object) works.
But whatever I do, I can't get it to work.

Anyone an idea, why?


Code: Select all

defineObject{
	name = "water_shooter",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/revolver.fbx",
		},
		{
			class = "Item",
			uiName = "Water Shooter",
			description = "A strange mechanics makes this weapon compressing water and shooting it out in some kind of a jet.",
			gfxIndex = 332,
			weight = 1.5,
			traits = { "weapon" },
		},
		{
			class = "ItemAction",
			name = "waterbolt",
			uiName = "Water Bolt",
			cooldown = 5,
			onAttack = function(self, champion)
				champion:shootProjectile("water_bolt", 1.4, 11)
				--return true
			end,
		},
	},
}
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Because Champion:shootProjectile() is not a method that exists. See this post for making custom projectile spells.
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