Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWAP_CREATURE script command #1484

Merged
merged 11 commits into from
Jun 20, 2022
Merged

SWAP_CREATURE script command #1484

merged 11 commits into from
Jun 20, 2022

Conversation

Loobinex
Copy link
Member

@Loobinex Loobinex commented May 17, 2022

SWAP_CREATURE([new_creature],[old_creature])

Where: the new creature comes from SwapCreatures in the [common] block of creatures.cfg.

If this is keeperfx.cfg

[common]
; Creatures used - note that the order is important
; Currently YOU CANNOT ADD NEW CREATURES; you can only replace existing ones
Creatures = WIZARD BARBARIAN ARCHER MONK DWARFA KNIGHT AVATAR TUNNELLER WITCH GIANT FAIRY THIEF SAMURAI HORNY SKELETON TROLL DRAGON DEMONSPAWN FLY DARK_MISTRESS SORCEROR BILE_DEMON IMP BUG VAMPIRE SPIDER HELL_HOUND GHOST TENTACLE ORC FLOATING_SPIRIT
; Creatures you can swap in place instead of one of the regular creatures.
SwapCreatures = WUBBLE

Then you can put a file called wubble.cfg in your creatrs folder or your campaign/pack specific creatures folder.
Then if you put SWAP_CREATURE(WUBBLE,HORNY) in the level script, it would load the creature specific in wubble.cfg instead of the one from horny.cfg

SWAP_CREATURE(NEW_CREATURE_A,[creature]) will now replace the [creature] with whatever is in the test_demon.cfg file
@PieterVdc PieterVdc linked an issue May 17, 2022 that may be closed by this pull request
@Loobinex Loobinex marked this pull request as ready for review May 17, 2022 21:20
@Loobinex Loobinex requested a review from PieterVdc May 17, 2022 21:20
@Loobinex Loobinex marked this pull request as draft May 17, 2022 21:43
newcrtr_desc[n].name = gameadd.crtr_conf.model[n + 1].name;
newcrtr_desc[n].num = n + 1;
n++;
if (n + 1 >= CREATURE_TYPES_MAX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be SWAP_CREATURE_TYPES_MAX instead of the normal one, also use that constant for the 128 up top, and check all new CREATURE_TYPES_MAX if they should SWAP_CREATURE_TYPES_MAX instead

@Loobinex Loobinex marked this pull request as ready for review May 19, 2022 22:07
check_and_auto_fix_stats();
creature_stats_updated(crtr_id);
//TODO SCRIPT rewrite from DD
//WARNMSG("Swapping creatures is only supported in Deeper Dungeons");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it now works this comment can go

src/game_merge.h Outdated
@@ -203,6 +203,7 @@ struct GameAdd {

struct Objects thing_objects_data[OBJECT_TYPES_COUNT];
struct ObjectsConfig object_conf;
struct CreatureModelConfig swap_creature_models[CREATURE_TYPES_MAX];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be SWAP_CREATURE_TYPES_MAX here?

do_creature_swap(ncrt_id, crtr_id);
return true;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for both do_creature_swap and swap_creature if it's not directly logic related to level scripts them selves it shouldn't really be in the lvl_script files

@Loobinex
Copy link
Member Author

The CreatureData and Creature structs do not seem to fully come from the configs.

@Loobinex Loobinex merged commit 7fe96aa into master Jun 20, 2022
@Loobinex Loobinex deleted the creature_swap branch June 20, 2022 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement SWAP_CREATURE([creature],[creature]) command
2 participants