Aller au contenu

Photo

Help required on a script


  • Veuillez vous connecter pour répondre
19 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 650 messages
Hi all. I have a situation, where I think I could do it myself, but it could be delicate, so I'll ask the scripting people hereB).

I had the idea of adding some placeables around the world, some trees to be exact. PC can interact with them, and if certain actions are performed, a creature boss is spawned and he needs to kill it. My problems Are:

1: This has a sandbox feeling behind it. I cannot know which tree will be first used.
2: How to update the journal, to something like "1st,2nd,3rd tree has been found".
3: And how to make it so that, when and if all are found, the PC is teleported to a special place where he learns about the trees and why they were there.

My scripting is so basic, that all I can think is setting an integrer when a boss dies, adding to it when the next one does and when and if it reaches a point, the teleport action takes place.
This might work, but I heard setting variables on death is unstable.

The one that confuses me more, is the journal. I did it before, and I know it works, that the journal can be updated when a creatue dies. However, I'd like it in this instance to be continuous, and I have no clue how to do it.
What I mean: Let's say you kill the first one, your journal says : First one killed.
                         Let's say after that you kill the second one, your journal says: First one and second killed.
Now the tricky part: If you skip the third, and kill the fourth, how can the journal say: You killed the first, second and fourth?

I hope I make sense.
If I cannot make this work, I have an alternative. I can make the script with the variables, and depending on which number we reached, update the next entry to something like 2/6 killed. Something similar to Tchos' collection quests.
In any case, it's late and maybe I don't think so clear. If anyone can help on this I'd appreciate it ^_^.

#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
In King's Festival I have a script bb_onbossdeath which can be used to do things like journal updates, variable updates, etc. when a boss dies. You just set it to be the death script of the boss. It executes the scripts bb_speakstring and bb_journal_update which look at variables on the boss and say something (like "Arghh, ye killed me!") and update the journal.

I don't understand from your description if there is a boss per tree or a boss only after the fourth tree. I'm not sure I understand why the journal would say something like "You found tree one and tree three." The player doesn't need to know which is tree one and which is tree three. So the journal should just say "You found two of the four trees."

Regards

#3
Tchos

Tchos
  • Members
  • 5 054 messages

andysks wrote...
If I cannot make this work, I have an alternative. I can make the script with the variables, and depending on which number we reached, update the next entry to something like 2/6 killed. Something similar to Tchos' collection quests.

You could in fact use my collection quest script for most of these things unaltered.  It doesn't matter what order you find the placeables in, and the final one can fire a boss-spawning script when you use it (you would have to create the spawning script).  It can either keep track of separate named trees (Tree 1, Tree 3, etc.) or simply count how many trees you've found out of the total.

What it can't do in the version you have is make each placeable fire its own script to spawn something.  That's something I should add, actually.  I'll make each one have the option to fire a script in addition to the one that fires after you collect them all.  Then each one can spawn a different creature if you want, or the same creature.

Modifié par Tchos, 11 février 2014 - 08:25 .


#4
kevL

kevL
  • Members
  • 4 061 messages

Kaldor Silverwand wrote...

I don't understand from your description if there is a boss per tree or a boss only after the fourth tree. I'm not sure I understand why the journal would say something like "You found tree one and tree three." The player doesn't need to know which is tree one and which is tree three. So the journal should just say "You found two of the four trees."

.. say the PC has to find 4 Waterdhavian creatures:

- cockatrice
- dryad
- intellect devourer
- yuan-ti

Instead of the journal having "you have found 3 of the 4 Waterdhavian creatures" it'd be nice to list the ones that are found - "you have found the cockatrice, the intellect devourer, and the yuan-ti. You still need to locate the dryad."

This is a job for tokens: "you have found <CUSTOM1001>" (or something like that) -- if tokens work in journal entries :\\ ( bob's Toolset Guide mentions they do )


notes:
1. deathscripts work fine as long as they don't get too complicated.
2. Google "nwn tokens" for more info (should work the same in NwN & 2)
3. get creative and use bitwise to keep track of which trees have been found 8|_~

#5
rjshae

rjshae
  • Members
  • 4 491 messages

andysks wrote...

The one that confuses me more, is the journal. I did it before, and I know it works, that the journal can be updated when a creatue dies. However, I'd like it in this instance to be continuous, and I have no clue how to do it.
What I mean: Let's say you kill the first one, your journal says : First one killed.
                         Let's say after that you kill the second one, your journal says: First one and second killed.
Now the tricky part: If you skip the third, and kill the fourth, how can the journal say: You killed the first, second and fourth?


There's a SetCustomToken() call that might be useful.

Sorry, I didn't see the previous reply.

Modifié par rjshae, 11 février 2014 - 08:43 .


#6
Tchos

Tchos
  • Members
  • 5 054 messages

kevL wrote...
This is a job for tokens: "you have found <CUSTOM1001>" (or something like that) -- if tokens work in journal entries : ( bob's Toolset Guide mentions they do )

They do.  My collection script uses them for that purpose.

#7
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages

kevL wrote...

Kaldor Silverwand wrote...

I don't understand from your description if there is a boss per tree or a boss only after the fourth tree. I'm not sure I understand why the journal would say something like "You found tree one and tree three." The player doesn't need to know which is tree one and which is tree three. So the journal should just say "You found two of the four trees."

.. say the PC has to find 4 Waterdhavian creatures:

- cockatrice
- dryad
- intellect devourer
- yuan-ti

Instead of the journal having "you have found 3 of the 4 Waterdhavian creatures" it'd be nice to list the ones that are found - "you have found the cockatrice, the intellect devourer, and the yuan-ti. You still need to locate the dryad."

This is a job for tokens: "you have found <CUSTOM1001>" (or something like that) -- if tokens work in journal entries : ( bob's Toolset Guide mentions they do )


If the trees are uniquely named, sure.  Though from the alternative solution proposed I was guessing they were not. Incidentally, if there are 4 trees it would only take 26 journal entries to describe all possibilities from 0 to 4.  An alternative if tokens don't work for some reason. Although with 5 named trees there would be 122 journal entries required and for 6 named trees there would be 722 journal entries required. So it wouldn't scale above 4.

Regards

Modifié par Kaldor Silverwand, 11 février 2014 - 08:54 .


#8
andysks

andysks
  • Members
  • 1 650 messages
Kaldor, as KevL said, the reason I want them to be named, and not simply 3/6, is because as the PC progresses in the world, the tree will spawn more powerful mini boss. So, because it has this sandbox idea behind it, if I see on my journal that I killed the 1st and 3rd, I might go and search on areas before the 3rd for the 2nd, where I was lower level.

Tchos', the scripts won't have a problem spawn their own creatures, since there is a mini convo before the spawning, and the spawning takes place from the convo itself. Do I just need to track the creatures, as you did with the goblins, instead of placeables picked?
Also, will that worke better if each placeable is named diferently?

Modifié par andysks, 12 février 2014 - 02:40 .


#9
Tchos

Tchos
  • Members
  • 5 054 messages
The placeables can be named just like the goblins were. It uses the same principle. You just mark it that you want to use 1 each of 4 different kinds of placeables, instead of 4 of the same kind of placeables.

I don't know about the conversation, though. You hadn't mentioned a conversation before.

#10
andysks

andysks
  • Members
  • 1 650 messages
Maybe I didn't write it clear. The actions performed, is actually through a convo.
Example: (DM) Blah-balh weird looking tree.
(PC) Cut a piece of the bark
Leave it be.

If you cut a piece, the mini boss spawns. I guess I could make it exactly like your goblins. Instead though of marking the tree as found, I mark the boss as dead, and the quest has something in the end like a list of all bosses, and 1/1 on the ones killed. The creatures use the exact same variables and system generally as the placeables? Or do they need some OnDeath script as well, the same way the placeables need an OnUsed? This could put me on a pickle lets say, since I deleted your beta to free some space on my PC the previous week :).

#11
Tchos

Tchos
  • Members
  • 5 054 messages
Well, my scripts wouldn't work for the trees, if you're using a conversation, but yes, it would work if you tracked the bosses' deaths. It doesn't matter what you write in the journal, though, so you could write "Found the ash tree" if you killed the ash tree's boss, for example. They use mostly the same variables (they're all commented), but in their case you put the variables on the creatures, and give them the corresponding OnDeath script instead of the OnUsed script, yes.

#12
kamal_

kamal_
  • Members
  • 5 250 messages
Just a note. As far as I know, there isn't any way to refer to trees (not tree placeables, trees) via script. I was working on something for someone, and it didn't seem possible.

#13
andysks

andysks
  • Members
  • 1 650 messages
I figured as well kamal. Good thing there are some nice tree placeables.

#14
Morbane

Morbane
  • Members
  • 1 883 messages
isnt there a placeable tree pack on the vault?

#15
andysks

andysks
  • Members
  • 1 650 messages
I don't know. I use PJ's 2da, which has some trees as well. One from Witcher, some from Dragonlance placeables... some more I don't remember now, plus the stock ones are not bad of course :).

#16
Dann-J

Dann-J
  • Members
  • 3 161 messages
You can put an invisible collision box or ball around a speedtree, and hang conversations or scripts off it. The downside is that the tree won't highlight with the Z key, although placing a sparkly effect at that location might be enough of a hint. There's no way of destroying the speedtree if necessary though.

#17
Morbane

Morbane
  • Members
  • 1 883 messages
ok im into the fire water...

but ending a post with :).

made me think of something like this :)::.. . . <drool>

nah im not over doing it lol

#18
Morbane

Morbane
  • Members
  • 1 883 messages
DM: your Con went up and your Str, but your Int is now 3

Modifié par Morbane, 13 février 2014 - 12:15 .


#19
Morbane

Morbane
  • Members
  • 1 883 messages
Dwarf: I attack the bar stool

DM: thats not the halfling's fault

Dwarf: <belch> barmaid! we need a bit of an clean up here... <belch>

:blink:

Modifié par Morbane, 13 février 2014 - 12:19 .


#20
rjshae

rjshae
  • Members
  • 4 491 messages
Okay, who let the dwarf into the liquor cabinet?

Something I've done is to put a scaled stump at the base of the tree so that it lines up reasonably well with the bottom. When the tree fades as the PC approaches, the stump appears and it can then be used as the selectable object.

Modifié par rjshae, 13 février 2014 - 06:50 .