Page 90 of 396
Re: Ask a simple question, get a simple answer
Posted: Thu Sep 10, 2015 11:07 pm
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
Re: Ask a simple question, get a simple answer
Posted: Thu Sep 10, 2015 11:30 pm
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.
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 8:23 am
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.
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 8:32 am
by minmay
you can pass parameters as I said, they can only be strings or numbers though
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 9:27 am
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...)
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 9:55 am
by cromcrom
Sorry about misleading people, I won't make this despicable mistake twice.
Cheers.
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 9:59 am
by THOM
no matter to be upset
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 10:01 am
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?
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 10:14 am
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 ?
Re: Ask a simple question, get a simple answer
Posted: Fri Sep 11, 2015 10:26 am
by minmay
That's a question to ask your favourite search engine.