[ian-reeds-games] Re: for Craig: scripting suggestions

  • From: Carlos Macintosh <sleepio1@xxxxxxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Sat, 28 Feb 2015 09:26:32 -0500

yeah, about 3, I didn't realize that you could just remove effects from the unit by changing the effects list on the unit. I thought that list was just read only. In the scripting guide there are some properties of things, like shared.Map, which are explicitly marked read-only. Should I then assume that anything in that list that isn't marked read-only is user-modifiable? I don't really know. Regarding 1, it would be nice to just have a list of flags similar to script flags so you could do something like

function override_causers(args) {
var source=args.Source;
var skill=args.Skill;
var target=args.Target;
var flags=skill.flags;
if(target.ScriptFlags.get("reflect_damage") {
 reflectDamage=flags.get("health_inflict")
target.Points.get("health")=target.Points.get("health")-reflectDamage;
}
}
I know this is probably super wrong, but you get the idea. It'd just be easier to have all the flags readily available, instead of adding like 25 extra properties to everything to account for each of the possible flags.


On 2/28/2015 9:14 AM, Craig Brett (Redacted sender craigbrett17@xxxxxxx for DMARC) wrote:
Hey Carlos,

I think I'd want to check with Ian first before implementing some of these, but they seem reasonable. Some thoughts though.

1. Seems reasonable to do, I think, but I'm not sure whether should be just exposing more properties for scripters, rather than making you guys dig through the raw flags and reconstructing things yourself. I'd consider it though. 2. Yes, I think this should be doable. Though if you want permanent effects to change stats, aren't there ways of doing that with equipped weapons anyway? I'm not sure - most of the map packs I play don't use items. 3. You can already remove effects by simply removing an item from the effects list, or array in JS, of a unit. I'm not sure if this triggers the after_effect_removed logic, though. 4. This would be good. Complicated, but good. This code doesn't necessarily all live in one place, so I'm not sure how difficult it will be to implement. But I'll have a look.

On 22/02/2015 09:13, Carlos Macintosh wrote:
Hi, I have some scripting suggestions that would really extend the power of scripting without being of too much effort I think. 1: Give map, unit, effect, skill, item and point objects a Flags list that contains all normal flags on the unit as key-value pairs. I was thinking you could just grab the keys and values from the individual files themselves. It only has to be read-only so that I can act on what the flag contains. My idea is to create a damage reflection flag that reflects damage based on the skill used on it. Skills with stronger health_inflict flags would reflect more damage. But the possibilities are endless really. 2. add on_item_equipped and on_item_unequipped events that we could tie to scripts. This would allow items to grant permanent effects when equipped, then remove the effects when unequipped. It could also be used to mod maximums of each point such as a breastplate of constitution that gave +50 extra health. 3. Create a shared.removeEffect(unit u, tile t, effect e) function that searches for the effect e on unit u and tile t, and removes it, applying the effect_removed event of course. 4. Create a unit.damageUnit(unit u, int amount, damageType t) which would deal amount damage to unit u using damage type t, factoring in protections that target unit u has, and inflict mods that source unit u has. All of these will really be beneficial in my current map pack project. Please consider allowing the engine to support these flags!







Other related posts: