summaryrefslogtreecommitdiffstats
path: root/example
Commit message (Collapse)AuthorAgeFilesLines
* Readded Entity:damage as lua functionabilitiesErik Schilling2013-05-125-15/+46
|
* Added a first very basic monster ai versionErik Schilling2013-05-126-28/+168
| | | | | | The ai is similar to the old c++ version. Only the target searching is executed every 10 ticks only now to prevent performance issues with too many lua calls.
* Removed the hardcoded monster AIErik Schilling2013-05-111-28/+0
|
* [Abilities] Added abilities to monstersErik Schilling2013-05-111-0/+97
| | | | | Monsters can now either receive abilities at lifetime via scripts, or via the <ability> node in the monsters node.
* [Abilities] Removed the old autoattack systemErik Schilling2013-05-084-108/+0
| | | | | As a side effect i had to remove the monster attack AI for now. I will readd this as next thing.
* [Abilities] Added a add_hit_taken bindErik Schilling2013-05-081-0/+4
| | | | This allows to display hit messages in the client for abilities
* [Abilities] Made a first example attack abilityErik Schilling2013-05-081-2/+20
|
* [Abilities] Added a useaction to the gamedataErik Schilling2013-05-081-0/+1
| | | | Only required clientside.
* [Abilities] Added support for a global cooldownErik Schilling2013-05-083-1/+11
| | | | | | | | | Each ability can now define a cooldown that prevents the player from using other abilities for a while. The time of this cooldown can be set to any attribute. The modified value of the attribute is the value of the cooldown in game ticks. The cooldown will be automatically started if the ability has `autoconsume` set to true. Otherwise a script has to call entity:cooldown_ability(ability).
* [Abilities] Added a autoconsume optionErik Schilling2013-05-081-1/+0
| | | | | | You do not need to reset the mana in the scripts if you do not want to. We will need this for attacks later since those do not nessecary have a script.
* [Abilities] Removed all except one abilityErik Schilling2013-05-082-21/+0
| | | | | Should allow easier modification without thinking of useful examples for each one
* [Abilities] Made the rechargespeed depending on attributesErik Schilling2013-05-081-3/+3
| | | | | | | | | | This allows a lot more flexibility and makes stuff like magical items a lot easier to implement. We will also use this for the attack system in the future. So a attack (abilitiy) would simply depend on some value like Agility (or a derived attribute from it). Which sets the recharge speed. The recharge speed is the modified value of the attribute per game tick.
* [Abilities] Turned special 1 into a point target for easier testingErik Schilling2013-05-082-1/+2
|
* [Abilities] Renamed set to categoryErik Schilling2013-05-081-2/+2
| | | | | | On the one hand setSetName and setName could sound misleading in the qt client patch i plan. On the otherhand i never really liked the name "set". I think category is more general and obvious.
* [Abilities] Renamed specials to abilitiesErik Schilling2013-05-085-20/+20
|
* Client-side settings are now available from settings.xml too, so ↵Przemysław Grzywacz2013-05-041-1/+4
| | | | example/settings.xml needed updates
* Maps are now configured in settings.xml tooPrzemysław Grzywacz2013-05-031-0/+1
|
* Made member function tables available as a globalsThorbjørn Lindeijer2013-05-033-11/+11
| | | | | | | | | | | | This way the scripts can add or replace existing member functions, which can be useful. As demonstration chr_money and chr_money_change are now added as Entity.money and Entity.change_money. Also fixed the banker to use ask_number instead of ask_integer (I had decided to rename this and apparently forgot the banker). Mantis-issue: 503 Reviewed-by: Ablu
* Single xml solutionPrzemysław Grzywacz2013-04-293-8/+18
| | | | Mana-mantis: #506.
* Moved functions to entity members where appropriateThorbjørn Lindeijer2013-04-1516-119/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some functions were skipped for now because they may need a new name or change of behavior. Changes: chr_warp entity:warp chr_get_inventory entity:inventory chr_inv_change entity:inv_change chr_inv_count entity:inv_count chr_get_equipment entity:equipment chr_equip_slot entity:equip_slot chr_equip_item entity:equip_item chr_unequip_slot entity:unequip_slot chr_unequip_item entity:unequip_item chr_get_level entity:level chr_get_exp entity:xp chr_give_exp entity:give_xp chr_get_rights entity:rights chr_set_hair_style entity:set_hair_style chr_get_hair_style entity:hair_style chr_set_hair_color entity:set_hair_color chr_get_hair_color entity:hair_color chr_get_kill_count entity:kill_count chr_give_special entity:give_special chr_has_special entity:has_special chr_take_special entity:take_special chr_set_special_recharge_speed entity:set_special_recharge_speed chr_get_special_recharge_speed entity:special_recharge_speed chr_set_special_mana entity:set_special_mana chr_get_special_mana entity:special_mana chr_kick entity:kick exp_for_level xp_for_level monster_get_id entity:monster_id monster_change_anger entity:change_anger monster_drop_anger entity:drop_anger monster_get_angerlist entity:angerlist being_apply_status entity:apply_status being_remove_status entity:remove_status being_has_status entity:has_status being_set_status_time entity:set_status_time being_get_status_time entity:status_time being_get_gender entity:gender being_set_gender entity:set_gender being_type entity:type being_walk entity:walk being_say entity:say being_damage entity:damage being_heal entity:heal being_get_name entity:name being_get_action entity:action being_set_action entity:set_action being_get_direction entity:direction being_set_direction entity:set_direction being_apply_attribute_modifier entity:apply_attribute_modifier being_remove_attribute_modifier entity:remove_attribute_modifier being_set_base_attribute entity:set_base_attribute being_get_modified_attribute entity:modified_attribute being_get_base_attribute entity:base_attribute being_set_walkmask entity:set_walkmask being_get_walkmask entity:walkmask being_get_mapid entity:mapid chat_message entity:message being_register entity:register chr_shake_screen entity:shake_screen chr_create_text_particle entity:show_text_particle - entity:position posX entity:x posY entity:y monster_get_name monsterclass:name item_get_name itemclass:name
* Simplified some script function namesThorbjørn Lindeijer2013-04-148-73/+71
| | | | | | | | npc_message -> say npc_choice -> ask npc_ask_integer -> ask_number npc_ask_string -> ask_string npc_trade -> trade
* Removed NPC and character parameters from NPC functionsThorbjørn Lindeijer2013-04-148-75/+72
| | | | | | | | These functions can only be used in the context of a character talking to an NPC, so these parameters can be deduced from that context rather than passing them explicitly all the time. Simplifies NPC scripting.
* Use a full user data for Entity referencesThorbjørn Lindeijer2013-04-141-1/+1
| | | | | Only moved a single script function to a member for now, will do others in a separate commit.
* Added possibility to reserve mapsErik Schilling2013-02-241-0/+5
| | | | | | | | | | | | If you set net_gameServerName you can now reserve maps in the maps.xml. There you have to add the servername - property to the <map> tag. Then the map will only be activated by that server. Also changed the activate sequence that the account server now tells the game server what maps to activate (previously the server requested all maps and the account server said yes or no). TODO: Fix general inter server map switching.
* Removed loading of script files using the statusmanagerErik Schilling2013-02-213-2/+4
| | | | | They are now required via the main.lua. Also made Harmony giving you the plague in order to allow testing.
* Monsters no longer load their script filesErik Schilling2013-02-171-1/+0
| | | | | | | | | | | Before monsters loaded their script file on *each* spawn. This is rather wrong since the script state keeps growing for each monster. However all of this was unnessecary since the main.lua can simply require the script file. If you do not want to spam the main.lua (or any other file) with all the requires: I guess we can add script binds to iterate over all monsters and add some custom properties to the monsters.xml (See Mana-Mantis #356)
* Fixed last second reordering of function parameters in last commitErik Schilling2013-02-161-5/+5
| | | | Accidently only reordered the order in the definition but not in the calls
* Moved attribute (re)calculation to the scriptsErik Schilling2013-02-042-0/+75
| | | | | | | | | | | | | | | | | | | | | | This introduces two callbacks: - on_update_derived_attribute -> Called to recalculate other derived attributes. - on_recalculate_base_attribute -> Called to recalculate a base attribute (only called for characters. However the function passed as callback can be useful for recalculating the derived attributes as well) Monsters no longer block recalculation of attributes except HP and Speed. I saw no sense to keep this. Fixed constant value in libmana-constants.lua Dropped bool type of the recalculation functions. It would be difficult to keep it while pushing all to the script engine and it was unused anyway. All in all this adds a LOT more flexibillity to projects since they can now adapt all attributes in the way they want.
* Changed Sword to Vit bonus since it has a lot derived attributesErik Schilling2013-02-041-1/+1
| | | | Only done for easier debugging
* Added emote support.Yohann Ferreira2013-02-012-20/+19
|
* Added Vulnerabilities for monstersErik Schilling2013-01-082-2/+2
| | | | | | | You can now actually use the already used node in the monsters.xml Monsters can have different vulnerabillities against elements: <vulnerabillity element="earth" factor="2.0" /> This will double damage of the element earth to this monster.
* Added script binds for getting attack informationErik Schilling2013-01-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | New binds: - Damage: - id - skill - base - delta - cth - element - type - truestrike - range - Attack: - priority - cooldown - warmup - global_cooldown - damage - on_attack - MonsterClass: - attacks - ItemClass: - attacks
* Work on (Auto)Attack system.Erik Schilling2013-01-083-61/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the implementation bjorn and I agreed to limit the number of attacks that can be used in the same tick to one. This makes a lot of stuff easier and the client cannot display two frames at the same time Things done: - Implemented setting of attacks when equipping/unequipping items - Single place where the xml attack node is parsed - Finished attack logic - Unified the attack handling of monsters and characters - Added a global cooldown after attack use (not only for next use of same attack) - Removed the temponary attributes for the monster attack values - Priorities for all attacks - Rewrote the attack core: - Attacks now have this attributes: - warmup -> time a attack needs after starting it to actually deal the damage - cooldown -> time a attack needs after dealing damage before another attack can be used - reuse -> time before the same attack can be used again - If no attack is performed at the moment the following is done: - make a list with all ready attacks - check for attack that has the necessarily range and highest priority - start this attack (inform client about it) - when warmup is finished -> trigger damage - when cooldown is finished -> allow to use other (or the same if reusetimer allows) attacks TODO: - sync client with this to allow better timed animations
* Rename AutoAttack to AttackErik Schilling2013-01-081-3/+3
|
* Enhanced special supportErik Schilling2012-04-043-27/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made the current charge being saved. - Added script binds: - chr_set_special_recharge_speed - chr_get_special_recharge_speed - chr_set_special_mana - chr_get_special_mana - get_special_info - Added special info lua class. Functions: - name - needed_mana - rechargeable - on_use - on_recharged - category Further the engine no longer sets charge to 0 after using of specials this allows more flexbilillity (like failing specials). Changes on the xml database: - recharge renamed to rechargeable (needed by client and server) - needed - the needed mana to trigger a special (server only) - rechargespeed - the defailt recharge speed in mana per tick (server only) - target - the type of target (either being or point) (server and client) I also made the lua engine pushing nil instead of a 0 light userdata when the pointer was 0. Database update needed. Change is tested. Mana-Mantis: #167, #156 Reviewed-by: bjorn.
* Converted two Lua scripts from DOS to UNIX line endingsThorbjørn Lindeijer2012-03-112-132/+132
|
* Register Lua script API functions into the global namespaceThorbjørn Lindeijer2012-03-1116-196/+196
| | | | | | | | Scripts mostly execute the Mana script API, and it seems like just unnecessary verbosity to refer to the 'mana' table all the time. This table no longer exists now. Reviewed-by: Erik Schilling
* Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer2012-03-111-7/+7
| | | | | | | | | | | | When creating an NPC, you now provide its optional talk and update functions directly rather than them being stored in a table on the Lua side and then called in response to a global callback. Also fixed an issue with a missing gender parameter to the delayed NPC creation callback used by NPCs defined on the map (found by Erik while reviewing this patch). Reviewed-by: Erik Schilling
* Removed deprecated NPC helper functionsThorbjørn Lindeijer2012-03-118-68/+68
| | | | Reviewed-by: Erik Schilling
* Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer2012-03-101-2/+0
| | | | | | | | | | | | Rather than wrapping NPC functions up in coroutines in the Lua side, they are now managed on the C++ side as "script threads", which are essentially the same thing. The main purpose is that the server can now know whether any of these long running script interactions are still active, which will probably be useful when adding the ability to reload scripts. Reviewed-by: Erik Schilling
* Added @effect commandErik Schilling2012-03-051-0/+1
| | | | | | | | | Usage: @effect <id> @effect <id> <char> @effect <id> <x> <y> Reviewed-by: Bertram.
* Made some global Lua variables localThorbjørn Lindeijer2012-03-032-47/+46
| | | | | | | | | | | We have to be careful with introducing globals now that there is only a single Lua state, so we shouldn't use globals unnecessarily. Any variable should be declared 'local' unless there is a reason to make it global. For additional safety we can also think about disallowing the use of globals entirely. This also helps to catch typos in scripts. Reviewed-by: Erik Schilling
* Use callbacks for items, monsters and status effectsThorbjørn Lindeijer2012-03-037-9/+22
| | | | | | | | | | | | | Previously, global function names were defined in the respective XML definitions of items, monsters and status effects. This was reasonable when they all had the same state, but now they're sharing the single global Lua state. Now the Lua API provides access to the ItemClass, MonsterClass and StatusEffect instances, on which callbacks for both standard and custom events can be explicitly set. Reviewed-by: Erik Schilling
* Added further missing callbacksErik Schilling2012-03-032-0/+5
| | | | Reviewed-by: bjorn.
* Converted functions called by LuaScript to callbacksThorbjørn Lindeijer2012-03-021-4/+4
| | | | | | | | | | This includes the quest reply, post reply, death notification and remove notification. Also, Script::Ref was changed from a typedef to a small class, automating initialization and making the check for validness clearer. Reviewed-by: Erik Schilling
* Use callbacks for handling character death and respawnThorbjørn Lindeijer2012-03-021-6/+11
| | | | | | | | | | | | | | | Rather than relying on the availability of global functions with certain predefined names, the Lua script now calls API functions to set which function should be called on these global events. This mechanism should make it easier to avoid name collisions in the global namespace, which is important now that there is only a single script state. For these global events this was not likely to become a problem, but this solution can also be used for callbacks on specific item or monster types, or even allow setting callbacks on certain instances. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
* A bunch of cleanups to example Lua scriptsThorbjørn Lindeijer2012-03-0210-181/+126
| | | | | | | Mostly removed bulky copyright headers and fixed indentation and line length. Reviewed-by: Yohann Ferreira Reviewed-by: Erik Schilling
* Merged all the different Lua states into oneThorbjørn Lindeijer2012-03-027-7/+9
| | | | | | | | | | | | | | | | | No more Lua state for each status effect, monster, item effect or map. All scripts are loaded into the same state. This should be more efficient overall and make it easier to implement dynamic reloading of the scripts in the future. Now, this introduces the problem of name collisions between different Lua scripts. For now this is solved by using more specific function names, like 'tick_plague' and 'tick_jump' rather than just 'tick'. The plan is however to get rid of these globals, and register these callbacks from the script, so that they can be local functions without the danger of colliding with other scripts. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
* Merged the example client and server dataThorbjørn Lindeijer2012-02-25187-1/+1
| | | | | | | | | It's easier to just talk about world data and to modify it as a whole. If there is really a need to separate it, a project can still choose to do that (and in whatever suitable way). There is no need to enforce this separation or to do it in our example. Reviewed-by: Erik Schilling
* Moved @announce permission to GM groupThorbjørn Lindeijer2012-02-051-1/+1
| | | | Reviewed-by: Erik Schilling