alambik
Sorceror
Switch & Levers interface
Here are two files for your switch and levers. By implementing them, you can make an action on anything (Item, Addon, Multi, Mobile...).
First file is a switch. You can easily transform it into a lever for example.
The other file is an interface allowing to define the actions on the target when switching on or off.
Here how to implement new actions:
- Add a the "switchable" intervace to the targeted object class
Example: a lift built as an addon.
- Implement the 2 following methods corresponding to the actions to do:
- Add the switch ingame
- Add the created target object
Example:
- In the properties of the switch, make the "Target" field pointing on the created target object you just added
Some example of implementation:
A lift that go up/down
A light that switch on/off
A remote bomb
A trap activator/deactivator
Advantages:
- You can see the switch.
- You can activate something even if it's very very far away.
Here are two files for your switch and levers. By implementing them, you can make an action on anything (Item, Addon, Multi, Mobile...).
First file is a switch. You can easily transform it into a lever for example.
The other file is an interface allowing to define the actions on the target when switching on or off.
Here how to implement new actions:
- Add a the "switchable" intervace to the targeted object class
Example: a lift built as an addon.
Code:
public class Lift : BaseAddon , Switchable
{
- Implement the 2 following methods corresponding to the actions to do:
Code:
bool On(Mobile from)
...
bool Off(Mobile from)
...
- Add the switch ingame
Code:
[add switch
- Add the created target object
Example:
Code:
[add lift
- In the properties of the switch, make the "Target" field pointing on the created target object you just added
Some example of implementation:
A lift that go up/down
A light that switch on/off
A remote bomb
A trap activator/deactivator
Advantages:
- You can see the switch.
- You can activate something even if it's very very far away.