Difference between revisions of "Talk:ReferencePythonAPI"

From The Battle for Wesnoth Wiki
(chance to kill)
Line 14: Line 14:
 
== chance to kill ==
 
== chance to kill ==
  
Can I get a chance_to_kill(wesnoth.location)? And it would tell me the chance to kill the unit at the given location, using terrain modifiers and everything.. I assume, the C++ AI has something like it available. Allefant 22:39, 10 January 2006 (CET)
+
Can I get a chance_to_kill(wesnoth.location)? And it would tell me the chance to kill the unit at the given location, using terrain modifiers and everything.. I assume, the C++ AI has something like it available. [[User:Allefant|Allefant]] 22:39, 10 January 2006 (CET)

Revision as of 23:16, 10 January 2006

Feature Requests

  • Path finder, something like: wesnoth.find_path(loc1, loc2), and it would return a list of all locations in between, or just the first step.. whatever the C++ API has
Gonna wrap a_star_search (in pathfind.hpp) Ryo 19:44, 8 December 2005 (CET)
Actually it's gonna be unit.find_path() since it depends on a unit. Ryo 19:53, 8 December 2005 (CET)
Done, experimental though :) Ryo 20:09, 8 December 2005 (CET)
  • Persistent variables. Right now, the script state isn't reset, so all variables are already persistent. But for the final version, there should be real persistent variables, which can also be stored to WML, and reloaded. An AI would use it to e.g. store a path, or some other state.
Probably with the Object -> String Python conversion. Will look at that Ryo 19:44, 8 December 2005 (CET)
  • Something like wesnoth.get_possible_moves(loc) - it would return all possible moves for the unit at the given location. It seems, right now, I make a lot of mistakes because the info of wesnoth.get_src_dst or wesnoth.get_units gets outdated after I move a unit. (Not really sure about this one, better planning out of the algorithm might make this function un-necessary.)
Yes, you need to grab again the array after moving. What happens is that you get a "snapshot" copy, which isn't updated when you move a unit - thus your "obsolete" copy can contain now invalid destinations. I'm not sure of a fix for that apart getting again the array. Ryo 19:44, 8 December 2005 (CET)

chance to kill

Can I get a chance_to_kill(wesnoth.location)? And it would tell me the chance to kill the unit at the given location, using terrain modifiers and everything.. I assume, the C++ AI has something like it available. Allefant 22:39, 10 January 2006 (CET)