Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 4 5 [6] 7 8 ... 42

Author Topic: [DFHack] Roses' Script Collection Updated 5/4/15  (Read 125235 times)

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile

I fixed an issue in addsyndrome where it would not apply a syndrome to a creature affected by another syndrome.

I set up a ping/pong interaction to simulate a self buff in combat (since DF does not support that) using these 2 inorganics :

Spoiler (click to show/hide)

So the first one provides an interaction for the unit to use on its enemy who will send back the second syndrome using addsyndrome.

I found out that the syndrome could be applied on a creature without other syndrome running but not the original unit. Testing revealed that the syndrome was really added but the CE did not take effect. So the error was coming from the assignSyndrome function.

Since trying to apply the second inorganic through autoSyndrome worked, I looked at its code and saw that it was almost the same with a couple of tweaks. So I ported it back to your script :

Spoiler (click to show/hide)

The change is that it set a couple of unk flags on the symptoms and starts the syndrome at 0 ticks instead of 1. AutoSyndrome also sets newSyndrome.flags=0 but since there is a comment about bad typecasting I left it out.

And voila, now my unit gets properly berserk in battle. You want a pull request for this?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile

How'd that comment get there? The original comment in itemsyndrome pointed towards the original function...

Roses

  • Bay Watcher
    • View Profile

I fixed an issue in addsyndrome where it would not apply a syndrome to a creature affected by another syndrome.

I set up a ping/pong interaction to simulate a self buff in combat (since DF does not support that) using these 2 inorganics :

Spoiler (click to show/hide)

So the first one provides an interaction for the unit to use on its enemy who will send back the second syndrome using addsyndrome.

I found out that the syndrome could be applied on a creature without other syndrome running but not the original unit. Testing revealed that the syndrome was really added but the CE did not take effect. So the error was coming from the assignSyndrome function.

Since trying to apply the second inorganic through autoSyndrome worked, I looked at its code and saw that it was almost the same with a couple of tweaks. So I ported it back to your script :

Spoiler (click to show/hide)

The change is that it set a couple of unk flags on the symptoms and starts the syndrome at 0 ticks instead of 1. AutoSyndrome also sets newSyndrome.flags=0 but since there is a comment about bad typecasting I left it out.

And voila, now my unit gets properly berserk in battle. You want a pull request for this?

Yeah, give me a pull request.

Also, hopefully if I can nail down my self targeting script to be a little more reliable, you won't need to have a ping pong reaction to add syndromes. Right now it doesn't do very well when you have dozens of units using reactions at the same time.
Logged

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile

How'd that comment get there? The original comment in itemsyndrome pointed towards the original function...

It pointed to itemsyndrome that pointed to the original function, so did autosyndrome.

Yeah, give me a pull request.

Also, hopefully if I can nail down my self targeting script to be a little more reliable, you won't need to have a ping pong reaction to add syndromes. Right now it doesn't do very well when you have dozens of units using reactions at the same time.

I'm on it. (edit: Done)

Ideally the creature at the origin of the syndrome would be available to use, perhaps with events this is doable.
« Last Edit: March 06, 2014, 02:03:49 am by Boltgun »
Logged

Roses

  • Bay Watcher
    • View Profile

Ideally, yes, you would be able to say \SELF_ID or something. I worked for awhile to find a suitable method (checking attacker ids, looking into syndrome flags, etc...), the best I could come up with was reading combat reports for the most recent with the correct type (146 for used interactions that add syndromes), get the name from there and then find the unit with that name. Works great for 1v1 or even up to several fighting at once, but once you get a large group together the reports come in faster than the check is made and it stats attributing the interactions to the wrong units. I put the search for a better method on hold for now, but once there is one I have several scripts written that can handle "reflect" like abilities and other fun shenanigans.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile

Ideally, yes, you would be able to say \SELF_ID or something. I worked for awhile to find a suitable method (checking attacker ids, looking into syndrome flags, etc...), the best I could come up with was reading combat reports for the most recent with the correct type (146 for used interactions that add syndromes), get the name from there and then find the unit with that name. Works great for 1v1 or even up to several fighting at once, but once you get a large group together the reports come in faster than the check is made and it stats attributing the interactions to the wrong units. I put the search for a better method on hold for now, but once there is one I have several scripts written that can handle "reflect" like abilities and other fun shenanigans.
Actually there might to be "THE BEST WAY" to do this. But it needs more research for vmethods of "creature_interaction_effect" class. If anyone knows more about them please share the knowledge. e.g. 4-th vmethod could very well be "apply this from creature X to creature Y with params..." then we could interpose it and have it capture most interactions effects when they happen (and even cancel them if we wish to) as they happen with more information.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile

...creature_interaction_effect has vmethods?

Frick. I'd better do some research on that. I feel like I should have a long time ago.

Roses

  • Bay Watcher
    • View Profile

I'm gonna be pretty busy this next week with work stuff, hopefully I can put out an update to my personal stuff sometime this weekend before I am too busy, but Putnam, if you can figure something out with the vmethods, that would be unbelievable. I have so many ideas for spells and abilities that rely on having the casting units ID, I started to make some of them, but got disheartened when my method wasn't 100% accurate. If you don't have time to look into it before next week that is fine too, since I should have some extra time to devote to it.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile

Not entirely sure how to actually check out these methods (<_<), but the fourth vmethod there looks promising.

Roses

  • Bay Watcher
    • View Profile

That does look promising. I figure the game has to keep track of that information (it seems foolish that it wouldn't).
Logged

Roses

  • Bay Watcher
    • View Profile

Major Overhaul:

-Changed all scripts to take advantage of the new selected.lua.
--Removed all built in selection criteria from scripts
--Removed out of date examples (new examples will be coming soon, can also be found in images)
-Combined changefixed and changepercent to one script
-Renamed storm.lua to spawnflow.lua
-Added changeattributes.lua to allow fixed and percentage changes
-Added todo.txt which shows future plans for scripts

NOTE: Currently the self check for selected.lua does not work very well. I suggest not using the self@, silence@, or reflect@ arguments

EDIT: See the first post for a detailed description of what selected.lua can do. It should now work for anyones scripts, not just mine.
« Last Edit: March 10, 2014, 04:15:21 pm by Roses »
Logged

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: DFHack Spells (linked to DFHack script collection) Overhaul
« Reply #86 on: March 13, 2014, 01:43:27 am »

Nice, the scripts are a lot simpler now.  :D
Logged

Roses

  • Bay Watcher
    • View Profile

Not entirely sure how to actually check out these methods (<_<), but the fourth vmethod there looks promising.

Alright, I've got some time to investigate these vmethods. Did you have any luck Putnam?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack Spells (linked to DFHack script collection) Overhaul
« Reply #88 on: March 18, 2014, 05:00:25 pm »

Well, I don't know how to investigate vmethods that much and I kinda forgot about it (if I hadn't, I'd have asked Quietust et al about that by now), so no, no luck.

Roses

  • Bay Watcher
    • View Profile
Re: DFHack Spells (linked to DFHack script collection) Overhaul
« Reply #89 on: March 18, 2014, 08:48:26 pm »

Alrighty. I'm not sure how to investigate the vmethods either, so I will ask around and see what I can come up with.
Logged
Pages: 1 ... 4 5 [6] 7 8 ... 42