Adding triggers to skins at runtime

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
keidi19
Posts: 8
Joined: 24 Jan 2011, 16:49

Adding triggers to skins at runtime

Post by keidi19 »

Hi,

I'm trying to add triggers to skins that are dropped on the map in edit mode, but I'm not getting the corresponding MapInteractionEvent:

Code: Select all

var tileTriggers:Array = new Array(new Trigger(TriggerType.CLICK));
openSpace.dragInventoryItem(inventoryItem.id, inventoryItem.directions[0], wrapper, event, null, tileTriggers);
Any idea what I'm doing wrong?

Thanks,
Shahar[/code]
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

During runtime map editing you can assign triggers to tiles only (not skins).
Tile click, rollover and rollout events are fired if the tile to which the trigger is assigned is globally walkable only.
You are probably assigning a trigger to a non-walkable tile.
Paolo Bax
The SmartFoxServer Team
ffourcad
Posts: 130
Joined: 25 Feb 2010, 10:26

Post by ffourcad »

Hello,

we run into the same problem. And I don't see how to work with tile events instead of skin events.
For example, we have a bed skin, that has a click event configured in OpenSpace Editor, that make the player sleep when he clicks on it.
Problem is that he can buy new bed and change the current one. But using edit mode, we can't put skin triggers to the new bed, so when the player changes his bed, he cannot sleep by clicking it anymore.

Same problem with every changeable item wiith which we can interact (doors, tables, chairs, tv, etc...)

Moreover, using the tile events is not even possible, since this kind of object are precisely on non-walkable tiles.

What can we do about that ?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

The first bed has its skin triggers defined in the Editor. When the user, during the map editing, changes the bed, OpenSpace is adding a different tile (or supertile) to the map. The new tile should have its skin triggers already defined in the Editor, just like the first one.
In other words you don't assign skin triggers at runtime, but you define them in the Editor for all possible interchangeable items.
Paolo Bax
The SmartFoxServer Team
Post Reply