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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

I am trying to get this line to work - but I'm failing...

Code: Select all

delayedCall(self.go.id, 0.2, "shootProjectile", "frostbolt", 1.0, 15 )
any idea someone??

oh - I should mention that it's used inside a monster definition
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

delayedCall is like a connector. It essentially calls [first parameter].controller:[third parameter]([fourth+ parameters]) after [second parameter] seconds. If the component named "controller" is a ScriptControllerComponent rather than a ControllerComponent, it essentially calls [first parameter].script.[third parameter]([fourth+ parameters]). I didn't forget to type ':' instead of '.', it actually is an "unbound" call unlike the ControllerComponent version.
So if your object doesn't have a ScriptControllerComponent named "controller" and a ScriptComponent named "script" with a function "shootProjectile", it won't work.
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
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Ask a simple question, get a simple answer

Post by cromcrom »

function castFrostbolt()
"frostbolt", 1.0, 15 or whatever
end

delayedCall(self.go.id, 0.2, "castFrostbolt")

self.go.id if the function you call is in the same script as the delayed call.
castFrostbolt is thus the name of the function. You cannot pass parameters with this, it seems.
Hope it helps.
A trip of a thousand leagues starts with a step.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

you can pass parameters as I said, they can only be strings or numbers though
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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Thank you all.
delayedCall is still a mystery for me - with minmays explanation I'm a little bit wiser now...

cromcrom - I know that this is the way to trigger a function inside a script entity - but I doubt (without having tried it) that this would work to call inside a monster definition (it is a monster i my case that is supposed to cast a frostball...)
Last edited by THOM on Fri Sep 11, 2015 9:58 am, edited 1 time in total.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Ask a simple question, get a simple answer

Post by cromcrom »

Sorry about misleading people, I won't make this despicable mistake twice.
Cheers.
A trip of a thousand leagues starts with a step.
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

no matter to be upset
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

THOM wrote:Thank you all.
delayedCall is still a mystery for me - with minmays explanation I'm a little bit wiser now...

Isaac - I know that this is the way to trigger a function inside a script entity - but I doubt (without having tried it) that this would work to call inside a monster definition (it is a monster i my case that is supposed to cast a frostball...)
delayedCall with a monster as the target is a bad thing to do: monsters tend to die, and their object is destroyed shortly after that. Trying to execute a connector on an object that doesn't exist won't cause a crash, but it will print a warning to the console. Why not use an animation event instead?
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
Modraneth
Posts: 95
Joined: Thu Aug 27, 2015 8:27 pm
Location: Portugal

Re: Ask a simple question, get a simple answer

Post by Modraneth »

hi, its only possible to place cinematics.ivf ? im trying to place a cinematic to end my mod, but i dont know how to change the format from mp4 to ivf. someone can help please ?
Mods:
Isle of Gunger
The Bloody Path Dropped
A World of Power work in progress
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

That's a question to ask your favourite search engine.
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.
Post Reply