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!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

minmay wrote:
bongobeat wrote:This works, except you cannot throw an item on the mouse pointer when you are one square back, in front of the wall. But a throwing weapon can be thrown when placed on the hands. But this doesnt bother.
This happens because it's marked as a secret door. If you remove secretDoor = true from the definition, you'll be able to throw items through it using the mouse.

(The only other effect of secretDoor is that it changes how the door is displayed on the automap.)
but there is not the secreDoor = true in the definition
I don't understand, sorry.

Anyway I don't use this much longer.
I use a secret door, opened and closing fastly instead of something that act like a forcefield.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
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 »

bongobeat wrote:but there is not the secreDoor = true in the definition
I don't understand, sorry.
Try adding:

Code: Select all

secretDoor = false
to the definition, see if that helps at all....
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

here I am with another silly issue :lol:

please take a look at these 2 screenshots:
the first you see reflection in the ocean
the second, I walk on the ocean tile, and the reflection .... disappears :cry:
SpoilerShow
Image
SpoilerShow
Image
I know hot this happen.
On the same map I use 3 beach_ocean (in the west, north and east)
and one water_surface in the south, followed by another beach_ocean in the very south. (this beach_ocean is to see ocean at large, when you are not underwater, because there is some bridges where you can walk on, etc... anyway we don't care about this 4th beach_ocean, because we can't walk in it.

The problem comes from the water_surface: before I placed it, the reflection on other beach_oceans was working good. It seems that the water surface interferes with the reflection of all beach_ocean.
By the way, reflection in the water_surface is working good to.

So, how can I have reflection on all beach_ocean, with keeping the water_surface?

For now I've tried to put the water_surface on the map first, then all oceans. The reflection works everywhere, but when you enter the water_surface, underwater I mean, there is no fog anymore. So this is not a good solution.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
minmay
Posts: 2777
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

You should never have multiple WaterSurfaceComponents on the same level. Remove all the WaterSurfaceComponents except one. You can still use multiple models for the ocean, but there should only be one WaterSurfaceComponent on the level.
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
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Ask a simple question, get a simple answer

Post by Mysterious »

Hi all.

I am trying to make a Potion that kills whoever drinks it eg:

Code: Select all

		{
			class = "UsableItem",
			sound = "consume_potion",
			onUseItem = function(self, champion)
				champion:setMaxHealth("-1")
           hudPrint(champion:getName() .. " Drinks the potion and is doomed.")
				return true
			end,
		},
	},
}
Why is the command: champion:setMaxHealth("-1") not working? In the references you can set health stat of any champ. Or how do I kill the Champ with what command?

Thxs in advance :)
User avatar
Isaac
Posts: 3182
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

champion:damage(1000, "pure")
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 »

Mysterious wrote:Why is the command: champion:setMaxHealth("-1") not working? In the references you can set health stat of any champ. Or how do I kill the Champ with what command?
Hey Mysterious,
try changing this line:

Code: Select all

champion:setMaxHealth("-1")
to this:

Code: Select all

champion:setHealth(0)
*You were setting the champs Max Health instead of the their actual current Health - no need to set Max Health lower to kill a champ
*Numbers do not need " " (only strings do)

Hope this helps!
EDIT: Isaac's solution^^ will also get the job done
User avatar
Isaac
Posts: 3182
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

It just depends if they should scream and show damage, or not.

**Also, for a more tailored damage amount...

Code: Select all

champion:damage(champion:getHealth(), "pure") 
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:It just depends if they should scream and show damage, or not.
They should definitely scream :P :lol:

I would also humbly suggest a short delay between drinking the potion and the champ dying and screaming...
SpoilerShow

Code: Select all

{
		class = "UsableItem",
        sound = "consume_potion",
        onUseItem = function(self, champion)
			local ord = champion:getOrdinal()
			delayedCall("potion_script", 4.0, "doomPotionEffects", ord)
			hudPrint(champion:getName() .. " drinks the Potion ...")
            return true
        end,
	},
--- paste the following function into a script entity named "potion_script"
SpoilerShow

Code: Select all

function doomPotionEffects(ordinal)
		
		local champion = party.party:getChampionByOrdinal(ordinal)
		
		if champion:isAlive() 
		and champion:getEnabled() 
		and not champion:hasCondition("petrified") then
	
			local h = champion:getHealth()
			champion:damage(h, "pure")
			--champion:playDamageSound()
			playSound("champion_die")
			party.party:playScreenEffect("damage_screen")
			hudPrint("... and suffers a horrid demise!")
		end
	end
	
	
EDIT - updated & corrected (again :oops: ) - Ta minmay 8-)
Last edited by akroma222 on Thu Mar 15, 2018 5:15 am, edited 2 times in total.
minmay
Posts: 2777
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

That code won't work properly because it tries to pass a Champion through delayedCall. You can only pass numbers, booleans, and strings through delayedCall. Pass the champion's ordinal instead and retrieve the champion with PartyComponent:getChampionByOrdinal().
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