[ian-reeds-games] Re: Inheritence doesn't like me

  • From: Craig Brett <craigbrett17@xxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Tue, 24 Dec 2013 06:37:36 +0000

Hi Al and other assorted interested people,

Yes, you can both replace existing values that are inherited from warrior, and add new things, such as skills. I think skills might be one of the only examples of that. Equipment, for example, it just makes a new set of equip_slots. So you would have to copy that from warrior if you wanted to add a new piece of equipment. And for your example, inheritence is great for modified versions of existing units, so it should suit your needs for different races!

Ok, here's the confusing thing. It works for me, sometimes. It changes from game to game. Sometimes, having a transform_message is enough to make it work, but not reliably. That by no means means I'm counting it as fixed, it isn't. I know what's upsetting it now, at least. Unfortunately, it also gets upset when it tries to change back, too.

Ian, do you have any idea why using the shared.ApplyEffect function would be upsetting the game so badly? It's when I'm calling it that the game crashes. If I comment it out, the transformation works fine, well, except that the transformed unit doesn't have the transformed effect. It also throws an exception when the effect fizzles (on the rare occasion it works). It's complaining that the collection was modified whilst it was doing an enumeration.

I might take a look into this again after Christmas. So in the mean time, Merry Christmas! Or as you guys say in the States, happy holidays!

Craig

On 23/12/2013 19:39, Allan Thompson wrote:

Hi Craig,

The example was interesting.

So if you make any changes in the new file for mounted warrior, everything not only is transfored over, but you can add to what already exists, it won’t see it as a replacement? For example the charge skill that was added. That is pretty freakin cool! Lol.

I might have confused you. I’m confused myself, lol.

So the transform_into script flag you made works for you on your computer?

When I try to use it, it causes the game to crash, and sends me a message that the game has “stopped” and if I want to wait for it to see if it will start again…which it never does.

Currently on the weer warrior weer transform skill, it has the old script which transforms it.

Then in the effect that is made active the below changes the unit back when the duration fizzles.

after_applied=change_unit_type@ { NewType: "weer wolf" }

Come to think of it, do I need to use transform_into script flag twice?? One in the skill and one in the effect like with the old ones I am talking about? Geez, I hope I explained that right.

Anyway, thank you for showing me this example of inheritance. This would have been great for the dozen or so units of a single faction that all feature a racial bonus in some skill or area and I plan on keeping this in mind in future map packs!

Thanks man,

al

*From:*ian-reeds-games-bounce@xxxxxxxxxxxxx [mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] *On Behalf Of *Craig Brett
*Sent:* Monday, December 23, 2013 1:54 PM
*To:* ian-reeds-games@xxxxxxxxxxxxx
*Subject:* [ian-reeds-games] Re: Inheritence doesn't like me

Hi Al,

I'm home from work now, so I can give you a sort of mini idea of how to do the inheritence.

First off, you'd take a normal unit. These units are not going to be anything special, just for an example. In my example, I have here a warrior.

Unit
10 // parser version
|flags
description A skilled melee fighter with additional armor and health.
add_skills attack,defend,move,use_item,take_item,give_item,drop_item,equipment
team=1
attack_health_inflict=4
health_max=30
sound=warrior
equip_slots=body|armor
equip_type=warrior
|script_flags

I know, I've extended the getting started maps a little here. Now, say, we want to make a mounted warrior, who has a few more actions, a new attack and a different sound. We could copy+paste, which is what we all used to do and worked fine. Or we could just inherit from warrior, like this.

Unit
10 // parser version
|flags
inherits=warrior
description A mounted warrior who moves faster than a normal warrior. Can also perform the awesomeful charge attack
add_skills charge
actions_max=8
sound=mounted_warrior
|script_flags

This already works. Or at least it does for me. It won't work on structures yet though. Give it a go and see if it plays nice for you. I hope this helps explain what I'm on about.

As for the script, I believe you, I just didn't know it did before. I thought you bringing it to my attention when I released the new scripts was you telling me that they still weren't working. Do you know how whoever fixed it had it working when it did? I don't know much about how to replicate this problem, at least now. Whenever I do transforms in effects, they come off fine. If it's still up there, I guess I'll take a look at the bundle you put together for Ian for when he gets around to looking at it.

Hope all's well,

Craig

On 23/12/2013 08:02, Allan Thompson wrote:

    Hi Craig,

    I appreciate that about the inheritance stuff and  I am looking
    forward to your new map pack!

    Honestly, I wouldn’t have asked if  it didn’t work. Ironically,

    Another fellow on the list actually got the old one working,
    causeing units to transform automatically back after the duration
    ended.  Oddly enough, because he got it working I am now in this
    dilemma, lol.

    Originally I had these units being forced to change thru a
    negative backlash if the player did not change back. I guess in
    the end maybe I should reconsider going back to something like
    that in order to get the new script flags into the map pack,
    because I very much prefer those, in addition if I understand them
    right, I will now be able to implement a unit  team toggle which
    is so much eaiser then the way I got it. In addition I want to
    implement the new stuff into my older map packs etc.

    So if it isn’t feasible, then so be it. I just appreciate the work
    you put  into them!

    al

    *From:*ian-reeds-games-bounce@xxxxxxxxxxxxx
    <mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx>
    [mailto:ian-reeds-games-bounce@xxxxxxxxxxxxx] *On Behalf Of *Craig
    Brett
    *Sent:* Monday, December 23, 2013 2:21 AM
    *To:* ian-reeds-games@xxxxxxxxxxxxx
    <mailto:ian-reeds-games@xxxxxxxxxxxxx>
    *Subject:* [ian-reeds-games] Re: Inheritence doesn't like me

    Hi al,




    The inheritance stuff isn't documented, you're right. I got it
    from one of the update notices emails. In it I think Ian said he
    hadn't got around to documenting this stuff yet. I think it was
    dev 28 or somewhere around that mark. Sorry, I dunno if that's
    accurate. I'm writing this on my phone, so I won't attempt to give
    my own version of documentation here, but I can try and do it
    later. And it might not be in my command and conquer maps, since I
    can't get it going for structures and they're the most obvious
    candidates for inheritance. I'm starting on a new, not so serious
    map pack and I've used it there. I'm not very far with it yet, but
    hopefully to get the first map fully done it won't take me too long.




    As for the scripts situation, if you mean the game crashing when
    certain units transform, I don't think it worked in the old
    version either, since I remember the weer warrior in particular
    wouldn't work and that was definitely using the old version of my
    scripts. I'm not sure downgrading would solve this. I'm not sure
    how well the old and new scripts would play together. I'm not sure
    whether to put the time in to make a working old version if it
    won't actually resolve your problem though.




    I hope this makes sense.




    Craig


Other related posts: