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
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: Ask a simple question, get a simple answer

Post by Blichew » Sun Nov 09, 2014 2:15 pm

onDie is a hook of Health componet, not the monster itself as far as I remember so you should probably look there.

:EDIT: mobile speling, lol
Last edited by Blichew on Sun Nov 09, 2014 6:16 pm, edited 1 time in total.

NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Ask a simple question, get a simple answer

Post by NutJob » Sun Nov 09, 2014 5:15 pm

The cube wrote:How to add a ondie hook to a monster spawned by a script?
Use addConnector("onDie", "yourscript","yourfunction")

Jackard
Posts: 59
Joined: Thu Oct 30, 2014 7:32 pm

Re: Ask a simple question, get a simple answer

Post by Jackard » Sun Nov 09, 2014 9:49 pm

What is the difference between swamp water, surface water, and underground water?

User avatar
Karinas23
Posts: 58
Joined: Thu Jul 24, 2014 8:57 pm

Re: Ask a simple question, get a simple answer

Post by Karinas23 » Sun Nov 09, 2014 9:52 pm

Jackard wrote:What is the difference between swamp water, surface water, and underground water?
different colour.


how do i get a spell launcher to fire a spirit relay bolt also whats the entity name i need to put in a receptor to be triggered by a spirit relay bolt

User avatar
QuintinStone
Posts: 72
Joined: Sat Nov 01, 2014 9:58 pm

Re: Ask a simple question, get a simple answer

Post by QuintinStone » Sun Nov 09, 2014 10:45 pm

Question: I thought I saw a thread where a defineObject block was posted for a single example of each object type; can anyone help me find it?

Jackard
Posts: 59
Joined: Thu Oct 30, 2014 7:32 pm

Re: Ask a simple question, get a simple answer

Post by Jackard » Sun Nov 09, 2014 11:05 pm

Karinas23 wrote:
Jackard wrote:What is the difference between swamp water, surface water, and underground water?
different colour.
They all seem to be the same color in my preview? Maybe my graphics options are not set high enough?

PPanda
Posts: 20
Joined: Tue Oct 14, 2014 9:13 am

Re: Ask a simple question, get a simple answer

Post by PPanda » Mon Nov 10, 2014 3:33 am

Karinas23 wrote:how do i get a spell launcher to fire a spirit relay bolt also whats the entity name i need to put in a receptor to be triggered by a spirit relay bolt
You have to program it to shoot via script i believe. Everything is there entity wise, you just have to script the shot.

The entity will be the spell that will trigger the receptor. aka: dark_bolt, poison_bolt, etc. Works just like keys and locks with doors.

PPanda
Posts: 20
Joined: Tue Oct 14, 2014 9:13 am

Re: Ask a simple question, get a simple answer

Post by PPanda » Mon Nov 10, 2014 3:44 am

Jackard wrote:
Karinas23 wrote:
Jackard wrote:What is the difference between swamp water, surface water, and underground water?
different colour.
They all seem to be the same color in my preview? Maybe my graphics options are not set high enough?
On the surface, they might, but hop into them. You'll see a difference.

underground water: lagoon clear on top and underneath.

surface water: blue on top, blue underneath with some limited visibility.

swamp water: blueish green on top, green underneath with fairly limited visibility.

PPanda
Posts: 20
Joined: Tue Oct 14, 2014 9:13 am

Re: Ask a simple question, get a simple answer

Post by PPanda » Mon Nov 10, 2014 7:21 am

Maybe someone can shed some light for me:

I'm trying spawn a bunch of Mobs and give each of them some custom properties. I got everything set up and ready to go, but one minor problem is stopping me from completing my script: I can't seem to use a variable in place of the actual entity ID.

ex:

Code: Select all

function makeamummy()
spawn("mummy", ........., "Mob_1")
local var = "Mob_1.monster"

Mob_1.monster:setLevel(3)    --This works
var:setLevel(3)              --This won't

end
It keeps saying that "attempt to call method 'getHealth' (a nil value) x" which to me means that it's not recognizing the variable as representing the mob ID. I've seen other scripts use a variable in place of an ID, but I seem to be missing something. I'm going to be using an array for naming the mobs, so it's important to me that I use a variable in place of the actual name so I can spam-run the same script section to make my script file smaller.

User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: Ask a simple question, get a simple answer

Post by Prozail » Mon Nov 10, 2014 8:57 am

findEntity is your friend.

Code: Select all

function makeamummy()
local var = spawn("mummy", ........., "Mob_1")

--local var = "Mob_1.monster" -- no need for this

Mob_1.monster:setLevel(3)    --This works

--var:setLevel(3)              --This won't
var.monster:setLevel(3)             

--and you can do:

local obj = findEntity("Mob_1")
obj.monster:setLevel(3)


-- also you can spawn somthing and get the unique id automatcally by not naming the object
-- local obj2 = spawn("mummy",.........)
-- and then store obj2.id



end

Post Reply