Page 70 of 396
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 9:28 pm
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
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 9:29 pm
by Zo Kath Ra
What's the difference between Champion:modifyFood(amount) and Champion:setFood(food) ?
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 9:31 pm
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 ?
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 9:34 pm
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
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 9:36 pm
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.
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 11:19 pm
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
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 11:41 pm
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"
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 11:52 pm
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")
Re: Ask a simple question, get a simple answer
Posted: Thu May 28, 2015 11:59 pm
by AndakRainor
Thanks ! I saw GameObject:removeComponent(component) in the scripting reference so I gave it the component instead !
Re: Ask a simple question, get a simple answer
Posted: Fri May 29, 2015 10:44 am
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?