[ian-reeds-games] Re: after_movement script behaviour on summoning

  • From: Monkey <murtagh69.monkeys@xxxxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Tue, 21 Jul 2015 20:50:10 -0600

Oh, nice with the AOHell, I nearly missed that!
And couldn't you just make a new GMail then...?

On 7/21/15, Monkey <murtagh69.monkeys@xxxxxxxxx> wrote:

Personally, either way would be fine with me. And technically even if
you do it the first way, you can still have a separate function for
the awesome stuff haha.

And yeah, when it comes to emails from me...if you don't get a reply
from me and yet I'm replying to emails from the mailing list, then
either I didn't get your email or mine's not going through. I strongly
dislike leaving unreplied-to messages in my inbox, so if I can reply
to something I do it as soon as possible, even if it's to say I'll
take a while to send a worthwhile response.

And glad to know the last one came through! Will reply to that in a sec.

On 7/21/15, Craig Brett <dmarc-noreply@xxxxxxxxxxxxx> wrote:
Ah, I just saw that an e-mail of yours got through. Nice one!

On 21/07/2015 20:26, Craig Brett (Redacted sender craigbrett17@xxxxxxx
for DMARC) wrote:
Yes Monkey, that's exactly how the engine does it, minus some details.
And its the placing where the movement script event code triggers. And
that's how we come to what we have.

And its skills like the aura one you mentioned, or a movable particle
beam unit was more how I was thinking, where when you move it around,
things happen to either it or things around it. Which was the one
reason I thought it should happen on summons too, otherwise, the
particle beam would come into being somewhere, but not damage anything
until you move it, unless the map creator makes it happen after
creation too.

I can think of 2 ways of tackling this.

1. Have a boolean that comes through on the after_movement event that
a scripter can check. Simple. But it does mean that if you didn't want
something to happen on something being created/transformed/otherwise
put on the map you'd have to check the variable. Here's an example.

function cb_after_unit_movement(e) {
var unit = e.unit;
var fromCreation = e.afterCreation;
if (unit.ScriptFlags.get("myflag") && !fromCreation) {
// super awesome stuff happens here
}
}

It just worries me that that's an extra hoop for scripters to jump
through.

2. Leave it to scripters to also handle the flag in after_create as
well, if it's something they want to happen then. Kind of like what
Victorious was saying. Here's a quick example:

function cb_after_unit_movement(e) {
var unit = e.unit;
if (unit.ScriptFlags.get("myflag"))
doYourThing(unit);
}

function cb_after_unit_created(e) {
var unit = e.unit;
if (unit.ScriptFlags.get("myflag"))
doYourThing(unit);
}

function doYourThing(unit) {
// do cool stuff to the unit
}

The first is arguably less repetitive. I'm just not sure. I can see
merit in both. I guess it depends on what we project the uses of this
script being, whether they're things we want to happen on creation as
well as on movement in the majority of cases or not. I'm happy either
way as long as you guys are.

Monkey: Really? Wow. I thought you were taking a while to get back to
me about it! Now I know why. I'll file a help ticket with AOHell. I
really need to get a better e-mail provider. But I can't get at the
g-mail address I want, even though I own it, ironically.

On 21/07/2015 13:15, Monkey wrote:
If I understand it correctly, it creates and then places the unit. Not
sure if the engine does it the same way, but in script at least it
would look something like this.
u = shared.CreateUnit(random);
if (tile.CanHold(u)) {
shared.Map.AddUnit(u, tile.X, tile.Y);
Not sure if that answers your question though.

On 7/21/15, Victorious <dtvictorious@xxxxxxxxx> wrote:
It probably depends on how summoning works. Does it just do a simple
position switch?

Maybe separate it? So someone can decide whether logic should work
after_movement or after_summon or both.

Victorious
-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Carlos
Macintosh
Sent: Tuesday, July 21, 2015 3:03 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] Re: after_movement script behaviour on
summoning

Also, Victorious and I had an idea about multi tile unit effects so
that a
mage could, for example, set up a shield on a tile that could
extend, say, 2
squares in any direction. Any unit already or moving into range of the
shield would be protected, while if they moved out of range, they
would no
longer be protected.

On 7/20/2015 11:19 PM, Monkey wrote:
I can give you a simple example...if you put effects= and
splash_effects= in a skill file that also moves your unit, the
effects
and splash effects will occur before the unit moves. However, with
this script you can have the effects and splash effects occur after
your unit has moved instead.

On 7/20/15, Allan Thompson <allan1.thompson@xxxxxxx> wrote:
Hi Craig,
could you give an example of how this script would work? I'm not
sure
I grasp the potential the script might have.
I guess as a vote on this… Couldn't you put in a true/false script
flag so that it could affect summoning or not after it worked? That
seems the simplest way to me, while still keeping flexibility.
Al

-----Original Message-----
From: ian-reeds-games-bounce@xxxxxxxxxxxxx
[mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] On Behalf Of Craig
Brett (Redacted sender "craigbrett17@xxxxxxx" for DMARC)
Sent: Monday, July 20, 2015 7:00 PM
To: ian-reeds-games@xxxxxxxxxxxxx
Subject: [ian-reeds-games] after_movement script behaviour on
summoning

Hi all,

One of the things I'm going to be introducing in the next dev update
is an after_movement type script event. Or did I introduce it
already. I'm not sure. Sorry!

I'm not sure how scripters would expect this to behave on a summon,
though. Since, technically, summoning does move the new unit onto
the
map, so it's a movement. It's current behaviour is that a summon (or
other things that put a unit on a map) do trigger this event.
However, with it being called after_movement, should it?

Part of me thinks it shouldn't, with the caveat that if unit summons
/ creations don't cause after_movement things, scripters will have
to
handle those kinds of things themselves in addition to
after_movement, if they want something to happen when the unit is
summoned or moves, but it does ultimately give scripters more
control.

Any thoughts?

Craig















--
-Mew
__________
http://www.savethefrogs.com/



--
-Mew
__________
http://www.savethefrogs.com/

Other related posts: