temporarilty immobilize the party

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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

forget it...I guess i'm not gonna understand this. I'll just do something different.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: temporarilty immobilize the party

Post by minmay »

FeMaiden wrote:but if I change the onmove to false in the party definitions, then isnt that going to permanently disable their movements?
It's a function. You return false when you don't want the party to move, and return true when you do want to allow the party to move. That's the whole point. My example of a function that returns false is an example, not a recommendation.
FeMaiden wrote:that lua page explaining the syntax, it's using symbols i've never seen in any of these scripts like

Code: Select all

 
var ::= Name

and

Square brackets are used to index a table:

Code: Select all

	var ::= prefixexp `[´ exp `]´




what are those 2 colons followed by an equal sign? I never saw any of you guys use that in the scripts.
You are trying to skip over too many parts of the reference, and missing all the context. Read the surrounding paragraphs. Those are parts of the Lua grammar in BNF notation (or something close enough), they are not pieces of Lua code.
If you aren't familiar with the underlying programming concepts then it would be better to look for a tutorial instead; that manual is good for learning the language, but not so good for learning COMPSCI 121/221 concepts.
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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

okay, I guess what confused me is that you said to "put it in the definitions"

which i thouhgt, you mean to put it in those lua files where I've been putting my custom monster and item definitions.

I did not know you could put functions in there that can then be called on from within the game...


and yeah like I said before I only took the introductory courses, then i changed my major to accounting. you mentioned "121/221" courses. I did all the "101" courses...

I guess the question here now, is this something that can be learned from the internet or am I gonna have to get formal schooling?
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: temporarilty immobilize the party

Post by petri »

I know it can be sometimes a little frustrating for the experienced modders to explain basics to every newcomer, but frankly the Grimrock modding community is so small that every new member is important. Even simple things can take a lot of time to learn because the documentation is a bit lacking (yeah, it is mostly our fault because we haven't got time to finish the modding guides for Grimrock 2). There's a lot of knowledge on these boards, if only all that would be available somewhere in a condensed, nicely structured form.

Anyhow, there's one article for FeMaiden that could be useful. It's for Grimrock 1 which has a different syntax for setting up components, but the general concept of hooks is still the same: http://www.grimrock.net/modding_log1/scripting-hooks/

Minmay is suggesting that you add a onMove hook to the party component and have that hook call a function in one of the script entities in your dungeon. The function can then return a boolean (true or false value) and pass it to the hook. This way you can return a dynamically changing value from onMove.

The concept of hooks is a really powerful feature that you can use to extend your scripting abilities. It could be a good idea to search for this forum for examples of various scripting hooks.

A simpler solution to this particular problem is probably to use GameMode.setGameFlag() as also suggested by minmay.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: temporarilty immobilize the party

Post by minmay »

FeMaiden wrote:I guess the question here now, is this something that can be learned from the internet or am I gonna have to get formal schooling?
I don't think it requires formal schooling. Lots of people have learned to program on their own. But find some kind of tutorial or curriculum to follow, trial-and-error learning does not work with programming concepts as well as it does with, say, welding. Seriously, trust me on this, you end up with bad code that you don't understand and don't know how to debug and maybe it produces the result you want but even then you don't know how to test or maintain it and you spent way longer than you needed to writing it. (Source: I was one of the countless teenagers that tried to do that, when I could have checked out one damn library book and it probably would have taken me a week to write the thing I wanted, instead of months).
I think a good comparison is music theory; you can have no knowledge and lay out a sequence of notes and keep changing them over and over until eventually you have 30 good-sounding seconds, but it took 2 hours and you have no idea how to expand on it, OR you can take a few days to understand scales, harmony, and chord progressions and suddenly you can use those same 2 hours and write something that actually sounds like a complete song. If you're ever going to write more than the aforementioned 30 seconds, then taking the second option actually saves you time in the long run. And I think that's definitely going to be the case for most Grimrock mods, assuming you want to have puzzles and custom content in your mod (and who doesn'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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

okay then. thanks guys for your patience.

actually the

Code: Select all

GameMode.setGameFlag
thing worked perfectly, I got the game to do exactly what I wanted it to do. so there was no need to modify my mod after all.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

minmay wrote:
FeMaiden wrote:I guess the question here now, is this something that can be learned from the internet or am I gonna have to get formal schooling?
I don't think it requires formal schooling. Lots of people have learned to program on their own. But find some kind of tutorial or curriculum to follow, trial-and-error learning does not work with programming concepts as well as it does with, say, welding. Seriously, trust me on this, you end up with bad code that you don't understand and don't know how to debug and maybe it produces the result you want but even then you don't know how to test or maintain it and you spent way longer than you needed to writing it. (Source: I was one of the countless teenagers that tried to do that, when I could have checked out one damn library book and it probably would have taken me a week to write the thing I wanted, instead of months).
I think a good comparison is music theory; you can have no knowledge and lay out a sequence of notes and keep changing them over and over until eventually you have 30 good-sounding seconds, but it took 2 hours and you have no idea how to expand on it, OR you can take a few days to understand scales, harmony, and chord progressions and suddenly you can use those same 2 hours and write something that actually sounds like a complete song. If you're ever going to write more than the aforementioned 30 seconds, then taking the second option actually saves you time in the long run. And I think that's definitely going to be the case for most Grimrock mods, assuming you want to have puzzles and custom content in your mod (and who doesn't?).
the thing about "end up with bad code you don't understand and don't know how to debug", I totally agree with that. that's why i'm really trying hard not to just copy paste the scripts I find on here.
if I can't understand it, i don't use it or I try my best to learn to understand it before using it.

I wonder if I'm focusing way too much on the theatrics in my mod and not enough on the puzzles, I dunno.

if I was an autistic savant, I probably could produce music..or code with no prior knowledge, but unfortunately I'm one of the ones without any "powers". maybe my Asperger's is what makes this hard, sometimes it's like a "who's on first" sketch for me.

if you look at my original idea of teleporting the party to a staging area...really sloppy, but it did work, I made a "new mod" with only 2 map levels on it for the purposes of experminting with scripts so i don't "ruin" anything in my real project and my idea worked.
maybe I could use it in another mod.

I had a floor trigger set up and it teleported the party to another room and they were surrounded by invisible walls and couldnt move, and the room was filled to the brim with monsters and then i had the party members shout stuff like OMFG theres so many monsters! they are gonna kill us!" and then it teleported them back to the original room and the party says "phew, now that was terrifying"
I could use that as a jump scare maybe ..or to temporarily disorient the player and freak them out.

but maybe that's just a troll move, I dunno lol
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: temporarilty immobilize the party

Post by minmay »

FeMaiden wrote:if I was an autistic savant, I probably could produce music..or code with no prior knowledge, but unfortunately I'm one of the ones without any "powers".
...I think you might want to do a little more research into what autism is. It's not something people typically enjoy having.
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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

minmay wrote:
FeMaiden wrote:if I was an autistic savant, I probably could produce music..or code with no prior knowledge, but unfortunately I'm one of the ones without any "powers".
...I think you might want to do a little more research into what autism is. It's not something people typically enjoy having.
believe me, I am fully aware of what it is, because I have it.
yeah, that was a poor attempt at humor, i know...

I'll have to explain it I guess. you made a comparison that learning to script is like learning to play music, you can either hit random keys or learn music theory.
it made me think of autistic savants with a "talent" called "perfect pitch" where they can literally sit down with an instrument they never played before, play a few notes and suddenly they can play any song they have heard before, perfectly. other savants can create beautiful sculptures and works of art without ever having had any education in art at all.

another facet of the "joke" was the that they named these talents...with names like "perfect pitch" and "calendar calculating". they make them sound almost like superpowers, as in "damn dude I wish I had autism powers too".
many autistic savants have incredible mathematic skils and isn't math essential for computer programming? I wouldn't be surprised if an autistic savant could come in here and read and memorize every post on this forum and then write all the code I've been struggling with for the last 100 hours and they could probably do it in 3.

you don't want to hear about my backstory, yeah technically Asperger's is not autism, it is an autism related disorder at the bottom end of the autism spectrum, but it's enough to be disabling. My doctor can attest to that.

as well as that fact that this is probably totally inappropriate for me to be discussing here
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: temporarilty immobilize the party

Post by FeMaiden »

hey all, I'm sorry to bring this topic up again, but i used

Code: Select all

function immobilize()
   GameMode.setGameFlags("DisableMovement",true)
end
in a part of my map to stop the party from moving, but it only stops the party, it does not stop monsters nor prevent them from attacking the party.
I sidestepped this issue by just putting those monster blockers next to the trigger that freezes the party, but I came back to it and that feels sloppy.

I would not be asking this if the answer was here, but I can't find it.

where is the list of all the GameFlags like ("DisableMovement") that i can set to true and false.

they are not in the scripting reference, I can't find them and yet...everyone else seems to know them all
Post Reply