Jump to content


Photo

Is it possible for a simple script to control special encounter?


  • Please log in to reply
2 replies to this topic

#1 minotaur_in_maze

minotaur_in_maze

    Modding Prima-Dona

  • Member
  • 906 posts

Posted 13 March 2010 - 08:10 AM

When coding/scripting, having to take Every Possible choice and outcome into consideration is tough to keep track of!

So I am writing the final part of my final quest - I have gotten to writing/coding the big battle sequence and have run into a snag. For this battle there is one powerful wizard who uses his mojo to summon creatures to attack the party.

Now, the way I had it written, each party member has their own type of creatured summoned (Dwarfs for Korgan for example) up and down the line. - I had just about gotten done when I stopped to Play the regular game for awhile to relax. And as I began to play I realized that in MY party were three MOD characters.

It was at THAT point I just about fell outa my chair. It occured to me that, for My mod in the final battle, if the player happened to have any MOD NPCs in party then there would be no moster spawns for them, and it might even crash the game. What's more, there are new mod released often, so even if I Could track down Every single mod NPC and get their right scripting code, odds are that My mod would still be lacking in short order.

So...

Is there any type of script I could write that would check and see if there were any OTHER than Bioware NPCs in party and if so spawn some type of creature in response? If so How would I write it? If not...

If Not I need to know because I am going to have to go back and do a major rewrite. In that event, is it possible to do something along the lines of IF (MyNPC) is in party and alive and so on, as the party travels to different places, there is a check and if conditions are right, they find a new (non joinable) character - have a conversation with him and send him to the copper cornet for a big send off later?

Thanks for the advice. Two of the three quests I have are done, but this little oversite with the last one just came to me.

Minotaur In Maze
* * * * * *
They say the world is going to Hell.

They are wrong.

The world IS Hell! Always has been, always will be; except perhaps for the five percent or so of the population who can afford differently.

And, if one must reside in Hell, it is far better to do it as a minion of the Devil than as a member of the damned.
* * * * * *
LOVE SUCKS: It makes fools and slaves of us all.
But being alone and unloved is worse.
- Nancy A. Collins "Thin Walls"
* * * * * *

#2 Miloch

Miloch

    Barbarian

  • Modder
  • 6573 posts

Posted 13 March 2010 - 09:06 AM

Is there any type of script I could write that would check and see if there were any OTHER than Bioware NPCs in party and if so spawn some type of creature in response?

Well, you *could* account for every single mod NPC, even handle them all in huge OR() blocks, but it wouldn't account for future NPCs. It'd be a lot simpler to just check the race or some other stat of each party member and spawn the creature type that way, e.g.:
IF

  See(Player2)

  Race(Player2,DWARF)

THEN

  RESPONSE #100

    ActionOverride(Player2,CreateCreature("mydwarf",[-1.-1],0))

END
Or something like that. You'd still need at least 36 blocks this way (# of party members * # of races) but that's a fairly easy copy-paste job, and a damn sight fewer blocks than accounting for every single possible NPC.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#3 minotaur_in_maze

minotaur_in_maze

    Modding Prima-Dona

  • Member
  • 906 posts

Posted 13 March 2010 - 10:54 AM

Is there any type of script I could write that would check and see if there were any OTHER than Bioware NPCs in party and if so spawn some type of creature in response?

Well, you *could* account for every single mod NPC, even handle them all in huge OR() blocks, but it wouldn't account for future NPCs. It'd be a lot simpler to just check the race or some other stat of each party member and spawn the creature type that way, e.g.:
IF
  See(Player2)
  Race(Player2,DWARF)
THEN
  RESPONSE #100
    ActionOverride(Player2,CreateCreature("mydwarf",[-1.-1],0))
END
Or something like that. You'd still need at least 36 blocks this way (# of party members * # of races) but that's a fairly easy copy-paste job, and a damn sight fewer blocks than accounting for every single possible NPC.



I MUST be catching on a little, but...

Y'know, I actually envisioned trying something like what you've described - block checks for Race rather than character, though I didn't have a Clue as to how to work it. But...

MY-MOD SPOILER ALERT BELOW:






For this scene it wouldn't work. I fudged a lil on the details when I posted this (I shouldn't have, I guess) to keep my secrets. The enemies facing the party - to be determined by Who is there with >CHARNAME< were to be spectors of the dearly departed from each of them - Patrick for Mazzy, Khalid for Jaheira and so on - which is why it suddenly came to me that I would quickly hit a wall.

My first plan was, in the event of a Mod NPC being found in the party by the game, was a script that would generate a random undead type or two.

Now though I am thinking that a complete rewrite would be more in order. Not a hard thing to do as this quest is more a series of battles (sort of like in KELSEY) that lead up to this final encounter with a Mage/Necromancer.

In thinking about it, I think something else might be better.

I thank you! :)

MiM
* * * * * *
They say the world is going to Hell.

They are wrong.

The world IS Hell! Always has been, always will be; except perhaps for the five percent or so of the population who can afford differently.

And, if one must reside in Hell, it is far better to do it as a minion of the Devil than as a member of the damned.
* * * * * *
LOVE SUCKS: It makes fools and slaves of us all.
But being alone and unloved is worse.
- Nancy A. Collins "Thin Walls"
* * * * * *