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
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Isaac wrote:
AndakRainor wrote:
Isaac wrote:Just remove the dynamicobstacle compontent, move the object, then create the dynamicobstacle component again.
(Disabling it is not sufficient.)
Well, after testing it it seems the previous position is correctly released, and as an obstacle and a pushable block it still correctly moves. What would be missing without the destruction and creation you suggest ?
If you do not remove the dynamicobstacle component, it blocks the original tile, but releases as soon as the block is pushed. If you disable it instead of removing it, the tile is freed ~until you enable it again. If you remove it, and create it again, it just works as one would expect (aside from the unexpected need for this kludge). I don't think that anything is or would be missing, but I'm not exactly sure what you mean.
In fact what I meant when I said I disabled the dynamicobstacle component is that I just disble it in the object definition, and after that I never enable it at any time. From what I see, enabling it is never needed for anything, even when the object is spawned. It just has to be there or you get an error, but it can stay disabled all the time. I will test it more and see if I really need to destroy and recreate it as you said. Whatever I find, thank you for your help :)
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

What's the difference between Champion:modifyFood(amount) and Champion:setFood(food) ?
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Zo Kath Ra wrote:What's the difference between Champion:modifyFood(amount) and Champion:setFood(food) ?
From the names of those functions, I would say modify is relative (to the current food level) while set is absolute ?
User avatar
st1nger
Posts: 19
Joined: Wed May 29, 2013 8:44 pm
Location: Germany

Re: Ask a simple question, get a simple answer

Post by st1nger »

Zo Kath Ra wrote:What's the difference between Champion:modifyFood(amount) and Champion:setFood(food) ?
setFood(500) = the value is exact 500.

modifyFood(500) = Currently + 500
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

modifyFood() seems only to add, with setFood() can define.

In script, I would imagine that one can just add modifyFood(5), and everytime it runs, it adds 5; where setFood(5), would ~set it to 5 every time.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Isaac wrote:
AndakRainor wrote:
Isaac wrote:Just remove the dynamicobstacle compontent, move the object, then create the dynamicobstacle component again.
(Disabling it is not sufficient.)
Well, after testing it it seems the previous position is correctly released, and as an obstacle and a pushable block it still correctly moves. What would be missing without the destruction and creation you suggest ?
If you do not remove the dynamicobstacle component, it blocks the original tile, but releases as soon as the block is pushed. If you disable it instead of removing it, the tile is freed ~until you enable it again. If you remove it, and create it again, it just works as one would expect (aside from the unexpected need for this kludge). I don't think that anything is or would be missing, but I'm not exactly sure what you mean.
Ok you were right something is missing XD
The block is no longer an obstacle WHILE it is moving to the next tile ! You can't pass through it when it stands, but you can when it moves... So, I will do as you said, destroy, move then recreate the component ;)
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Oh this ice block is seriously damaging my sanity !!! Now when I use

Code: Select all

local dyn = o:getComponent("dynamicobstacle")
if dyn then o:removeComponent(dyn) end
the game crashes (in removeComponent) with this error : "could not look up class name"
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

AndakRainor wrote:Oh this ice block is seriously damaging my sanity !!! Now when I use

Code: Select all

local dyn = o:getComponent("dynamicobstacle")
if dyn then o:removeComponent(dyn) end
the game crashes (in removeComponent) with this error : "could not look up class name"
RemoveComponent wants the name.

Code: Select all

o:removeComponent("dynamicobstacle")
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Thanks ! I saw GameObject:removeComponent(component) in the scripting reference so I gave it the component instead !
User avatar
st1nger
Posts: 19
Joined: Wed May 29, 2013 8:44 pm
Location: Germany

Re: Ask a simple question, get a simple answer

Post by st1nger »

hi everyone

is it possible to check if the party moves against a wall?
i want script the system from DM to damage the party.
or has anyone else these system already?
Post Reply