Jump to content


Photo

It just occurred to me...


  • Please log in to reply
3 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 05 April 2017 - 05:43 PM

I've been using an item for the randomizing mod we're making with Imp in the other thread. Weidu code makes creatures equip the item - by class, by name, by race, but there can be other filters and regular expressions. In the game the item applies a series of Instant/Permanent effects to creatures as they spawn - individually. I've changed avatars, stats, colors this way, equipment is possible too. The Create Inventory Item opcode can spawn any kind of loot or weapon or gold. But it occurred to me that I could use the item to replace creatures completely. It would only take the Replace Self opcode, the silent option, and I could put in the percentages. That would randomize encounters automatically.

Let's say an area has an Ogre actor somewhere. I don't know if it's possible to set up an area-specific filter in Weidu, but even if it's not, this could work for default encounters everywhere. So, an Ogre spawns somewhere. This isn't the special Ogre with the belt fetish, his file should be copied separately in the end. Let's say I installed the file and gave the item to all Ogres.

 

The usual pattern of encounters is too predictable for replays. One Ogre every time, and you know where. But with this item I could replace him with another creature - and the players will encounter a Dragon, or more likely something in the same power range. Or (and) I could put a Summon Creature effect in the item so it sometimes spawns another Ogre. This doesn't require a Spell ability for the creature to activate - which obviously it can't without scripting. Simply make a Self-targeted Cast Spell effect in the item, put a Summon Creature in the spell and make Original Caster its target, and it won't crash. Puff, a creature materializes. If every Ogre comes with, say, 50% chance to spawn another Ogre, and that Ogre does too, then statistically we should have 2-3 Ogres in places. More or fewer as percentages decide. This is actually similar to "roll again" in the Dungeon Master's Guide tables.

 

But there is more. In addition to Replace and Summon, I could put Remove Creature in the same item, but higher on the list of effects. If its percentage clicks, the Ogre will just disappear and there will be no encounter in that spot.

 

Encounters don't have to be hostile. What if I want some of the creatures neutral towards the party or even friendly and help it? Easy: add a Change AI opcode, or maybe several for a range of neutrals, friendlies and charmed-like creatures (in the manner of Korax the ghoul). In addition to just making exploration more fun, what is the player going to do if this playthrough the half-ogres he was sent to kill by that wounded paladin are actually not hostile - maybe even helpful and fighting on the side of the party (GOODBUTBLUE)? Is he still going to kill them for the +1 shield? Of course, it's a small chance for these particular half-ogres, but - an interesting surprise if it happens.

 

Hostile or friendly, I might want to spice up a fraction of creatures. They may be shamans and witch doctors, they may have been enchanted or they are potion-drunk or maybe they are just tougher - individually or as a group. I would put a couple of extras down the list. If the creature carrying the item has not rolled the zero and removed itself, if it has not replaced itself... In short, if it's still there, and even after an AI change, some of the time it may cast, say, Stoneskin on itself. An Ogre with a Stoneskin should be an interesting challenge. A creature can also cast a Self-targeted spell that affects all those nearby of the same allegiance like Bless. Make it a cast-instantly spell, though it may be better to put a Cast Spell on condition in the item instead. Let the condition be that the creature sees an enemy. Bless its group? Sure. Ettercaps firing a web as soon as the party comes up to engage them? Possible too. Come to think of it, you could program quite a few behaviors this way - outside of scripts. The item will do it, and it has one shot of everything.

 

The item should be undroppable, of course, but if you want to free the slot after it's done its job, you can: make Remove Inventory Item the last effect on the list, and it will disappear. Since the effects are all Instant/Permanent, not Instant/While Equipped, they will remain.

 

Now this is obviously a presentation of a concept, just short of Power Point, and an invitation to modders to take it and make something grand with it, but I have a little demonstration. Take this ring and make someone in the party put it on - after you save the game. Just put the files in override and summon it in the game - item name "ring." What does it do? The wearer is:

 

1) 30% likely to be removed; if not,

 

2) 30% likely to be replaced with a being of power; if not,

 

3) 50% likely to put on Stoneskin and also check for all of the below:

 

4) likely to summon 0-3 bandits (40% chance for each);

 

5) 30% likely to change allegiance to NEUTRAL;

 

6) 50% likely to cast Bless around itself - and if it is now neutral, neutrals will benefit;

 

7) 100% of the time the ring will vanish.

 

I spaced out the effects for better visibility. Have fun!

 

:lol2:

Attached Files


Edited by temnix, 05 April 2017 - 05:45 PM.


#2 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 05 April 2017 - 11:49 PM

This is similar to part of what I'm working on.  Maps have trigger areas that spawn random things based mostly on Chapter and Charname's level.  Sometimes hostile, sometimes not.  The tricky thing to balance so far is XP.  If a player goes out adventuring trying to level up before moving on in the main quest, he could get screwed by RNG.  And on the other extreme, RNG could hand over so much loot that the game becomes permanent EZ mode.



#3 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 06 April 2017 - 02:01 AM

You can also directly patch creatures' effects (i.e. by using LPF "ADD_CRE_EFFECT" opcode = 146 ... END) to cast a spell that does random stuff. Last time I checked percentages do not work randomly when applied directly on a .cre so you have to outsource them to "child" spells.


Posted Image

#4 temnix

temnix
  • Member
  • 983 posts

Posted 06 April 2017 - 05:43 AM

This is similar to part of what I'm working on.  Maps have trigger areas that spawn random things based mostly on Chapter and Charname's level.  Sometimes hostile, sometimes not.  The tricky thing to balance so far is XP.  If a player goes out adventuring trying to level up before moving on in the main quest, he could get screwed by RNG.  And on the other extreme, RNG could hand over so much loot that the game becomes permanent EZ mode.

 

But that's what randomness is like - it's random. If this playthrough some maps aren't giving enough rewards, the player just needs to go somewhere else. Maybe even down to Durlag's Tower. It's not such a travesty if adventurers actually need to go to dungeons to find their experience, equipment and magic.

 

To Galactygon: same thing but better. Imp, are you reading this? We are going to need the code for Instant/Permanent patching as above instead of items.