Developement: Quick Question, Quick Answer
Moderator: PPS-Leaders
Re: Developement: Quick Question, Quick Answer
hehe
http://www.xkcd.com/
A webcomic of romance, sarcasm, math, and language.
A webcomic of romance, sarcasm, math, and language.
Re: Developement: Quick Question, Quick Answer
XML-Question: How can I catch the event, when a pawn died? The following attempt doesn't work.
I tried to adapt the code from theTimeMachine.oxw (here the timemachine effect is stopped when you successfully kill a bot), but missed something, since no text is displayed when I destroy the pawn created above.
I have to admit that I don't undestand the example in the wiki.
What is meant by <TriggerBase ... />? Why is an additional <EventListener ... /> needed?
Code: Select all
<EventTrigger name="PawnDied1" >
<events>
<trigger>
<Pawn health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000>
<attached>
<Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
</attached>
<collisionShapes>
<BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
</collisionShapes>
</Pawn>
</trigger>
</events>
</EventTrigger>
Code: Select all
<SimpleNotification message="Display some text.">
<events>
<trigger>
<EventListener event=PawnDied1 />
</trigger>
</events>
</SimpleNotification>
Code: Select all
<EventTrigger invert="true">
<events>
<trigger>
<TriggerBase ... />
<EventListener ... />
</trigger>
</events>
</EventTrigger>
Fail. Fail again. Fail better.
Re: Developement: Quick Question, Quick Answer
Hum, it't quite a while since I worked with events...
There's a test level "events.oxw" which shows some basic event stuff with comments. I hope that explains the general ideas behind the event system.
Well I guess TriggerBase is just a generic name for any trigger. DistanceTrigger, EventTrigger, etc.
EventListener is not needed, the example shows that the same event can be triggered by two sources independently, the trigger and an event listener. You can use only a trigger or only a listener... or both... or 2 triggers and 5 listeners
Now to your other question, I don't know why this doesn't work, it looks ok. However you don't need EventTrigger and EventListener in this simple case, simply passing the event from the Pawn to SimpleMessage should be enough:
But I'm not exactly sure how SimpleNotification works... maybe you have to include the notification framework?
See the timemachine level for details, there's this line:
There's a test level "events.oxw" which shows some basic event stuff with comments. I hope that explains the general ideas behind the event system.
Ah wow, don't worry if you don't understand it, I didn't even know we have a wiki entry for thisThe Jo wrote:I have to admit that I don't undestand the example in the wiki.
What is meant by <TriggerBase ... />? Why is an additional <EventListener ... /> needed?
Well I guess TriggerBase is just a generic name for any trigger. DistanceTrigger, EventTrigger, etc.
EventListener is not needed, the example shows that the same event can be triggered by two sources independently, the trigger and an event listener. You can use only a trigger or only a listener... or both... or 2 triggers and 5 listeners
Now to your other question, I don't know why this doesn't work, it looks ok. However you don't need EventTrigger and EventListener in this simple case, simply passing the event from the Pawn to SimpleMessage should be enough:
Code: Select all
<SimpleNotification message="Display some text.">
<events>
<trigger>
<Pawn health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000>
...
</Pawn>
</trigger>
</events>
</SimpleNotification>
See the timemachine level for details, there's this line:
Code: Select all
<?lua include("includes/notifications.oxi") ?>
Fabian 'x3n' Landau, Orxonox developer
Re: Developement: Quick Question, Quick Answer
Is it easily possible to detach a worldentity from its parent and attach it to another parent?
Context:
I would like to perform this transition when a TetrisBrick (which consists of many TetrisStones which are attached to the TetrisBrick) touches the ground or any other obstacle.
The stones which had been attached to the brick should now be attached to the TetrisCenterpoint which would allow me to reuse some of the old code.
So far I tried to perform this via WorldEnity::detach() and the WorldEnity::attach() function.
detach() throws "cannot detach an object that is not a child"
Is it necessary first to detach all objects attached to a TetrisStone (a model, some cameras and problably more) in order to perform this transition manually via detach() or is there any practical solution?
Context:
I would like to perform this transition when a TetrisBrick (which consists of many TetrisStones which are attached to the TetrisBrick) touches the ground or any other obstacle.
The stones which had been attached to the brick should now be attached to the TetrisCenterpoint which would allow me to reuse some of the old code.
So far I tried to perform this via WorldEnity::detach() and the WorldEnity::attach() function.
detach() throws "cannot detach an object that is not a child"
Is it necessary first to detach all objects attached to a TetrisStone (a model, some cameras and problably more) in order to perform this transition manually via detach() or is there any practical solution?
Fail. Fail again. Fail better.
Re: Developement: Quick Question, Quick Answer
hey jo
try this:
try this:
Code: Select all
WorldEntity.h:
void detachFromParent()
void attachToParent(WorldEntity* parent)
Fabian 'x3n' Landau, Orxonox developer
Who is online
Users browsing this forum: No registered users and 1 guest