Spell – rune order

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
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Spell – rune order

Post by Isaac »

Zo Kath Ra wrote:Another side note:
Clicking "Select all" above the code sample should select the entire code, but it takes me to the beginning of the thread instead.
Tested on Firefox and Chromium.
Are you limiting Javascript in your browser?
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Spell – rune order

Post by Zo Kath Ra »

Isaac wrote:
Zo Kath Ra wrote:Another side note:
Clicking "Select all" above the code sample should select the entire code, but it takes me to the beginning of the thread instead.
Tested on Firefox and Chromium.
Are you limiting Javascript in your browser?
Not that I'm aware.
The problem still occurs when I start FF with all add-ons disabled.
User avatar
.rhavin
Posts: 25
Joined: Fri Oct 13, 2017 1:10 pm
Location: Berlin
Contact:

Re: Spell – rune order

Post by .rhavin »

I really dont know why postig the above code didnt do the trick, but here is a working project:

http://doc.rhavin.de/dmf/spelltome_demo.zip
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Spell – rune order

Post by Isaac »

Zo Kath Ra wrote:
Isaac wrote:
Zo Kath Ra wrote:Another side note:
Clicking "Select all" above the code sample should select the entire code, but it takes me to the beginning of the thread instead.
Tested on Firefox and Chromium.
Are you limiting Javascript in your browser?
Not that I'm aware.
The problem still occurs when I start FF with all add-ons disabled.
It does the same for me in Firefox. My guess is that it's because of the SID parameter in the Firefox version of the page; the URL parameter (a session id?) ends in a hash sign, which works with anchor tags to allow links to specific sections of a page. The link URL is actually different for Firefox, than for Opera.
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Spell – rune order

Post by Zo Kath Ra »

.rhavin wrote:I really dont know why postig the above code didnt do the trick, but here is a working project:

http://doc.rhavin.de/dmf/spelltome_demo.zip
It works great!
The panel is perfectly responsive.
I'm still trying to understand the code, though.
User avatar
.rhavin
Posts: 25
Joined: Fri Oct 13, 2017 1:10 pm
Location: Berlin
Contact:

Re: Spell – rune order

Post by .rhavin »

Zo Kath Ra wrote:I'm still trying to understand the code, though.
Next version will add more doku ;)

BTW – can someone show me how I can put this in an external file and call it from the internal one? I want this…

Code: Select all

function showPanel()
   party.party:addConnector('onDrawGui', self.go.id, -#???#- )
end

function hidePanel()
   party.party:removeConnector('onDrawGui', self.go.id, -#???#- )
end
…inside the internal file and everything else in an external so one can just add my stuff where it is appropriate. But all my tries give me strange errors that I dont understand.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Spell – rune order

Post by Isaac »

Make your external file, and on the map place a script_entity for your external code. (With the script_entity selected) In the editor's property inspector change the setting for the script source from embedded to external. Call it as you would any other script_entity.

*Note: Scripts in objects reside in the object's script component; so to call myFunction in 'my_object', you include the script component:
my_object.script:myFunction()

**If you disable a level in the editor, its scripts do not load.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Spell – rune order

Post by akroma222 »

This is fantastic .rhavin!
I had shelved the idea of implementing a ultima underworld-ish type rune system for spell casting as my skills arent up to the task atm with Gui stuff...
So thank you for sharing your work on this system! :D
Tested the demo and things look great...
Im guessing your plan is to place the rune panels over the champion's attack panel (and implement a 'Cast' button) ?

Its almost tempting to make players collect the Rune stones to place in their Runestone collection (bag :lol: ) ... but probably not worth the hassle!

Look forward to updates :D
Akroma
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Spell – rune order

Post by Isaac »

akroma222 wrote:Its almost tempting to make players collect the Rune stones to place in their Runestone collection (bag :lol: ) ... but probably not worth the hassle!
Have you played Arx Fatalis? (That is exactly what they did.)
User avatar
.rhavin
Posts: 25
Joined: Fri Oct 13, 2017 1:10 pm
Location: Berlin
Contact:

Re: Spell – rune order

Post by .rhavin »

Well, let me surprise you what the next version already can do once I figured out how to effectively control the mouse. The current method to get the mouse position in the editor is a ridiculous complicated hack. Im currently trying to put all those nasty workarounds in one part of my script so i can easily unfuck them once Petri read my bugreport and hopefully has some spiced wine :D
akroma222 wrote:but probably not worth the hassle!
First having to unlock the runes is already a configurable feature ;)
Post Reply