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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Image
Thanks minmay for helping my retardedness :P
Marskilla
Posts: 16
Joined: Sun Mar 17, 2019 9:08 pm

Re: Ask a simple question, get a simple answer

Post by Marskilla »

Went there : viewtopic.php?t=7972 but I didn't found how to damage party by script.
Marskilla
Posts: 16
Joined: Sun Mar 17, 2019 9:08 pm

Re: Ask a simple question, get a simple answer

Post by Marskilla »

Marskilla wrote: Mon Apr 08, 2019 7:28 pm (...) I didn't found how to damage party by script.
Nevermind : I damaged each champion. :?

Code: Select all

party.party:getChampion(1):damage(80,"fire")
party.party:getChampion(2):damage(80,"fire")
party.party:getChampion(3):damage(80,"fire")
party.party:getChampion(4):damage(80,"fire")
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 »

Marskilla wrote: Mon Apr 08, 2019 7:28 pm Went there : viewtopic.php?t=7972 but I didn't found how to damage party by script.
The way to damage the party by script, is to the damageTile global function:

Code: Select all

damageTile(level, x, y, direction, elevation, flags, damageType, power)

Where —flags— can be the following:
https://github.com/JKos/log2doc/wiki/Ob ... amageflags
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

vanblam wrote: Sat Apr 06, 2019 6:59 am

Code: Select all

if choice3 >= 0.4 then
	  spawn("rc_ground_pebbles_04",g.level,g.x,g.y,math.random(0,3),g.elevation)
	elseif choice3 >= 0.5 then
	  spawn("rc_ground_pebbles_01",g.level,g.x,g.y,math.random(0,3),g.elevation)
	elseif choice3 >= 0.6 then
	  spawn("rc_ground_pebbles_02",g.level,g.x,g.y,math.random(0,3),g.elevation)
	elseif choice3 >= 0.7 then
	  spawn("rc_ground_pebbles_03",g.level,g.x,g.y,math.random(0,3),g.elevation)
end
So like that?
Question about this script. Is there a way to make a script that does the same thing but then for wall decorations? And if so any help on how?
oldboy87
Posts: 7
Joined: Tue Apr 09, 2019 10:33 am

Re: Ask a simple question, get a simple answer

Post by oldboy87 »

How do I kill a monster using a trigger? I feel like an idiot (complete noob when it comes to scripting) as I managed to pull it off using something simple like

function killzombie
disable:zombie()
end

and had the trigger point to the function and then disable itself, I was troubleshooting an error message (turns out I just needed to reset the editor) and in the process I had deleted the script entity. Problem is, I forget precisely what I put and now everything I try doesn't work

So yeah, just a very simple script that simply makes the monster despawn with no fanfare or anything please

Edit: Figured it out:

zombie:destroy()
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

function killzombie1()
zombie_1.monster:die()
end

Make sure you use the correct entity_ID
As you probably used "mummy"
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 »

hi there,

how can I automatically activate the controller of an objet who use combined PushableBlock and PushableBlockFloor classes?

I'm using self.go.controller:setInitialState(true) on the controller of the PushableBlockFloor but that doesn't do anything.
I can only make it work, by enabling the controller component within the editor.

The purpose is to make an object who should be floating with minimalsavestate = true, but without making an animation, and using the floating "animation" of the pushableblock.
(its basically to not have any additional animation and have the object never saved but always activated on a reload)
SpoilerShow

Code: Select all

defineObject{
	name = "mine_platform_chains_moving",
	baseObject = "base_floor_decoration",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/mine_platform.fbx",
			staticShadow = true,
			offset = vec(0, 0, 0),
		},
		{
			class = "DynamicObstacle",
			enabled = false,
		},
		{
			class = "PushableBlock",
		},
		{
			class = "PushableBlockFloor",
			name = "controller",
			onInit = function(self)
				self.go.controller:setInitialState(true)
			end,
		},
		{
			class = "Model",
			name = "chain1",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(1.5, 0, 1.5),
		},
		{
			class = "Model",
			name = "chain2",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(1.5, 0, -1.5),
		},
		{
			class = "Model",
			name = "chain3",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(-1.5, 0, 1.5),
		},
		{
			class = "Model",
			name = "chain4",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(-1.5, 0, -1.5),
		},
--[[		{
			class = "Platform",
		},]]
	},
	minimalSaveState = true,
}
My asset pack: viewtopic.php?f=22&t=9320

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

Re: Ask a simple question, get a simple answer

Post by minmay »

You don't need a component named "controller" or a PushableBlockFloorComponent. Just activate() the PushableBlockComponent:

Code: Select all

defineObject{
	name = "mine_platform_chains_moving",
	baseObject = "base_floor_decoration",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/mine_platform.fbx",
			staticShadow = true,
			offset = vec(0, 0, 0),
		},
		{
			class = "DynamicObstacle",
			enabled = false,
		},
		{
			class = "PushableBlock",
			onInit = function(self)
				self:activate()
			end,
		},
		{
			class = "Model",
			name = "chain1",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(1.5, 0, 1.5),
		},
		{
			class = "Model",
			name = "chain2",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(1.5, 0, -1.5),
		},
		{
			class = "Model",
			name = "chain3",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(-1.5, 0, 1.5),
		},
		{
			class = "Model",
			name = "chain4",
			model = "mod_assets/models/mine_platform_chain.fbx",
			staticShadow = true,
			offset = vec(-1.5, 0, -1.5),
		},
--[[		{
			class = "Platform",
		},]]
	},
	minimalSaveState = true,
}
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.
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 »

thank you :)
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply