~Basic Scripting and Editor Help(Easy Scripting Updated!)

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!
[SMUG]Ipecac
Posts: 28
Joined: Tue Oct 21, 2014 5:51 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by [SMUG]Ipecac »

Hi guys,

Sorry in advance, but I'm totally "level1" guy with this stuff.

I want to make floor_trigger that puts text on the screen. e.g. you walk into a room and text pops up saying "The room reeks of death." or something like that.

Do i put a trigger down and link it to a script_entity? What do I put in the script box for this simple action?

If you guys can set me on the right path here, I'll be able to extrapolate and come up with some other stuff myself.

Thanks :)
User avatar
ScroLL
Posts: 56
Joined: Tue Sep 18, 2012 12:21 pm
Location: Vermont

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by ScroLL »

Code: Select all

function reekText()
    hudPrint("The room reeks of death.")
end
Your floor trigger connects to the script entity and should use the reekText function
[SMUG]Ipecac
Posts: 28
Joined: Tue Oct 21, 2014 5:51 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by [SMUG]Ipecac »

If I put that

function reekText()
hudPrint("The room reeks of death.")
end

into the script_entity, then link the trigger to the script_entity and select --on activate, target floor_trigger, reekText()-- the text appears on the screen when the player spawns. Trigger does nothing. Am I missing something?
User avatar
SnowyOwl47
Posts: 148
Joined: Fri Sep 12, 2014 10:41 pm

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by SnowyOwl47 »

Isaac wrote:
sapientCrow wrote:ok thanks.

I do not understand why they do not allow for the ability to override some of the core rules and formulas more easily.
I do not even see a way to alter attributes or add abilities to items in the editor itself.
I don't understand why they ever would... :?

(They include the mod tools for people to mod what they like in their own maps; but I can't imagine allowing that in their official campaign. They likely balanced the game based on the predicted limits of the PCs.)

**If there is a Party hook for XP gains, then such a hack could probably work in a modded map; but I don't think (certainly don't know) if you can hook to that via console script in the running game; as would have to be done to patch the LoG2 campaign.

*** If there isn't such a hook, it's not a bad thing to ask for in a future patch or one of Petri's glögg sessions.

Once the scripting reference is made public, you could choose to add extra points at times when they level up... If you wanted a 20% xp bonus... just add 20% of their current XP after they level up; or (if possible) add the points directly after they level up, but before you've spent them.
I'm so glad party hooks still work :D
[SMUG]Ipecac
Posts: 28
Joined: Tue Oct 21, 2014 5:51 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by [SMUG]Ipecac »

Nevermind, it worked! Thanks!

I placed the trigger under an object haha
User avatar
SnowyOwl47
Posts: 148
Joined: Fri Sep 12, 2014 10:41 pm

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by SnowyOwl47 »

[SMUG]Ipecac wrote:If I put that

function reekText()
hudPrint("The room reeks of death.")
end

into the script_entity, then link the trigger to the script_entity and select --on activate, target floor_trigger, reekText()-- the text appears on the screen when the player spawns. Trigger does nothing. Am I missing something?
Make sure nothing like an item or anything is touching the floor_triggure or pressure plate or whatever your using. Once it gets activated by anything you allow it to be activated by its activated. ;)
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by zeltak »

Is there a way to add onDie trigger to a creature you spawn with a script?
User avatar
SnowyOwl47
Posts: 148
Joined: Fri Sep 12, 2014 10:41 pm

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by SnowyOwl47 »

zeltak wrote:Is there a way to add onDie trigger to a creature you spawn with a script?
Yes you add a connector:

Code: Select all

monster_name.monster:addConnector("onDie", some script, some function)
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by zeltak »

SnowyOwl47 wrote: Yes you add a connector:

Code: Select all

monster_name.monster:addConnector("onDie", some script, some function)
Thanks.
mpuppetier
Posts: 16
Joined: Tue Sep 02, 2014 11:20 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by mpuppetier »

I guys, how can i kill a monster??
i had tried

Code: Select all

function killWizard()
   wizard_1.monster:destroy();
end
also tried the methods
kill() and dieBastard() :D
and setHeath(0) ...
but the wizard still looking at me :D

-- EDIT --

I found this,

Code: Select all

function killWizard()
   wizard_1:destroy();
end
but it doesn't start the die animation...
Last edited by mpuppetier on Wed Oct 22, 2014 7:54 pm, edited 2 times in total.
Post Reply