Page 298 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Apr 06, 2019 7:20 am
by vanblam
Image
Thanks minmay for helping my retardedness :P

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 08, 2019 7:28 pm
by Marskilla
Went there : viewtopic.php?t=7972 but I didn't found how to damage party by script.

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 08, 2019 7:44 pm
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")

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 08, 2019 8:14 pm
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

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 08, 2019 10:16 pm
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?

Re: Ask a simple question, get a simple answer

Posted: Tue Apr 09, 2019 10:37 am
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()

Re: Ask a simple question, get a simple answer

Posted: Tue Apr 09, 2019 12:10 pm
by Pompidom
function killzombie1()
zombie_1.monster:die()
end

Make sure you use the correct entity_ID
As you probably used "mummy"

Re: Ask a simple question, get a simple answer

Posted: Wed Apr 10, 2019 11:27 am
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,
}

Re: Ask a simple question, get a simple answer

Posted: Wed Apr 10, 2019 7:47 pm
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,
}

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 11, 2019 8:29 am
by bongobeat
thank you :)