Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
ment them.

The first one is supposed to be called search or search hidden. If possible i'd like to make it so the player can click the skill, get an aoe template and then if the aprorpriate place on the ground is clicked on something is found. With this one i haven't been able to find any good function to use except CharacterUseSkillInTrigger, which would mean that it wouldn't be an aimed aoe "attack" but rather a skill that's based on where the player is positioned.

Second one would be something called lore, which would function differently from the one found in the game. In this case the player would be able to click the skill and then click on something in the envoirment and get deeper information about the object, information that can help in quest solving. Again this haven't proved possible as there is as far as i can tell no function like "CharacterSKillUseOnObject". Again i figured i could use characterusedskillintrigger, the only problem i have with this function is that i don't know what to put in the arguments for it to work. (also what kind of trigger to use or how to activate it in the code).
I'm also having trouble with this since i can't figure out how to make common items clickeable or not part of the enviorment.

Third skill would be called track. With this skill the player can click the skill, use it on a character in the game and see where they've been. The way this would work is that you would get a trail of something, like bread, that is teleported to different triggers in the enviorment. You can then follow the bread to where the character has been and perhaps find some hidden stuff there or draw some conclusions from it. I guess this one is pretty straightforward but maybe someone in the community has some better idea of how a skill like this could work.

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
For #1, what you could do is have your skill give your character a temporary (and large) buff to Perception for 1 second/round, which should cause any hidden objects nearby to show up. Make sure to give such a skill a huge AP cost so that it can only be used outside of combat.

For #2, I believe CharacterUsedSkillInTrigger is what you're looking to use if the objects you're getting info on are stationary and won't be moving at all. If your skill is named "SKILL_Lore", for example, it might look something like this (if I recall the code correctly)

IF
CharacterUsedSkillInTrigger(_, "SKILL_Lore", _Trigger)
THEN
DisplayLore(_Trigger);

PROC
DisplayLore((TRIGGER)_Trigger)
AND
ItemIsInTrigger(_item, _Trigger)
AND
DB_ItemLoreText(_item, _text)
THEN
ItemDisplayText(_item, _text);

(I don't recall if itemisintrigger is an actual function, but you just need something that links the item to the trigger).

For #3, I'm not sure of how that can be done at all.

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
For #2, Rhidian's code should work if you register that trigger for both players and items (two separate functions).

I think #3 could work if you had a character with a set path. You'd have to set the tracking markers on the path of the character manually and then set them offstage. When you use the ability on the character, you'd put the markers you placed on stage.

If the character doesn't have a set path (e.g., is on a wander script), then I have no idea how you'd do it.

Joined: Sep 2014
Z
apprentice
Offline
apprentice
Z
Joined: Sep 2014
I'm worried Rhidian's solution will only work on global objects and you would have to have a trigger for every object. I would make a skill that targets only items, have its 'Skill Property' be Consume,100,1,[Some Potion,you can make your own]. Then have a Loreable.itemScript that on the event of that consume happening to the object, Display text on itself. Figuring out which object this is and what text to display could be rough but its surmountable. With this solution all you would need to do to an item with Lore is give it the script and you have a text ready for it.

For #3, there is a clucky solution (again with scripts). Have a trackable.charScript that every few seconds stores the character's current position in a variable. You will need a few that update so u can have multiple points. Then when a tracker uses the skill (use the consume trick on self), have another charScript that iterates thru characters finds there old positions and spawns tracks at those nearby locations. This solution might take an excessive amount of processing time but it would work.

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Originally Posted by Rhidian
For #1, what you could do is have your skill give your character a temporary (and large) buff to Perception for 1 second/round, which should cause any hidden objects nearby to show up. Make sure to give such a skill a huge AP cost so that it can only be used outside of combat.

For #2, I believe CharacterUsedSkillInTrigger is what you're looking to use if the objects you're getting info on are stationary and won't be moving at all. If your skill is named "SKILL_Lore", for example, it might look something like this (if I recall the code correctly)

IF
CharacterUsedSkillInTrigger(_, "SKILL_Lore", _Trigger)
THEN
DisplayLore(_Trigger);

PROC
DisplayLore((TRIGGER)_Trigger)
AND
ItemIsInTrigger(_item, _Trigger)
AND
DB_ItemLoreText(_item, _text)
THEN
ItemDisplayText(_item, _text);

(I don't recall if itemisintrigger is an actual function, but you just need something that links the item to the trigger).

For #3, I'm not sure of how that can be done at all.


The syntax for the characterusedskillintrigger is CharacterUsedSkillInTrigger(
CHARACTER _Character,
STRING _Skill,
STRING _SkillElement,
TRIGGER _Trigger
)

So _Skill should be the thing that's written after new entry in the skilldata.txt file? Ie if i want to check if the character uses the blind spell in the trigger i'll use "target_blind" or should i just type "blind"? _SkillElement i'm not familiar with either, is that something that can be found in the skilldata file?

As for the bump in perception, i recon you need to be able to somehow set the amount of perception needed for a certain item to show, haven't seen how to do this though but it seems like a perfect idea.






Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Originally Posted by Baardvark
For #2, Rhidian's code should work if you register that trigger for both players and items (two separate functions).

I think #3 could work if you had a character with a set path. You'd have to set the tracking markers on the path of the character manually and then set them offstage. When you use the ability on the character, you'd put the markers you placed on stage.

If the character doesn't have a set path (e.g., is on a wander script), then I have no idea how you'd do it.


Skill #3 is supposed to be a lot less complicated than that, the character you check up on can be stationary throughought the whole game but i'll just put some breadcrumbs or something where he's been previously, without having physically moved there in the actual mod.

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Perception is just a script you put on the item in the sidebar. There's "Puzzle_HiddenPerception" and "Puzzle_HiddenStoryPerception", the difference I believe being that you can add custom character display text to story perception. There's also Puzzle_InvertHiddenPerception, which makes an object disappear when you have the right perception (if you want to have a false wall for example).

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
Cool, didn't know about the scripts and how they worked. Still having problem with getting those basic CharacterUsedSkillInTrigger or CharacterAddSkill functions to work. I've got this to try and add the feather fall skill to the player when he enters the trigger:


IF
CharacterEnteredTrigger(CHARACTER_MalePlayer_000,TRIGGER_BoxTest)
THEN
CharacterAddSkill(CHARACTER_MalePlayer_000,"Teleportation_FeatherFall");

The trigger is firing if i replace character add skill with add experience or something, so i'm using the wrong arguments or something.

Joined: Jan 2015
K
journeyman
OP Offline
journeyman
K
Joined: Jan 2015
ah ok i get what i did wrong, i thought the function was based on if the player was standing in the trigger or not.

Last edited by karlgoran; 12/02/15 03:51 PM.
Joined: Sep 2014
Z
apprentice
Offline
apprentice
Z
Joined: Sep 2014
Here is a solution to Lore using an item script

Have the script Lorable.itemScript witht the following code
Code
INIT
ITEM:__Me
EXTERN FIXEDSTRING:%LoreText="NoLore"
EXTERN FLOAT:%TimeDisplayed=7.0
INT:%Unlocked=0

EVENTS
EVENT LoreRequest
ON
	OnUseItem(_,__Me)
ACTIONS
	IF "c1"
		IsEqual(%Unlocked, 1)
	THEN
		DisplayText(__Me, %LoreText, %TimeDisplayed)
	ENDIF

This will display a text when you use the item with the script attached. You can define which text is displayed by when attaching the Script to the item there is a box on the far right that will have a variable named LoreText. Change that to whatever text key you want to display (as defined in Translated String Key)


The next issue is unlocking it this can be done in a few ways. Use a skill that applies any potion on an item (is skill properties use: Consume,100,0,<Some Potion defined in potion stats>)and add the following code to the Lorable.itemScript

Code
EVENT UnlockMethod1
ON
	OnItemStatus(__Me, CONSUME)
ACTIONS
	Set(%Unlocked, 1)
	DisplayText(__Me, %LoreText, %TimeDisplayed)

This will both unlock and display the LoreText when first applied upon. However this will activate whenever someone applies a potion to the item.

Another Solution is to have the potion be put on the Character itself and whenever that character uses a Lorable item with the potion bonus on, it will unlock it. (look at stats of shouts for ways to do this nicely).

Include the following in Lorable.itemScript. <Name of Potion> should be the name of the potion u are trying to detect
Code
EVENT UnlockMethod2
VARS
	CHARACTER:_Char
ON
	OnUseItem(_Char,__Me)
ACTIONS
	IF "c1"
		CharacterHasStatus(_Char, CONSUME, "<Name of Potion>")
	THEN
		Set(%Unlocked, 1)
		DisplayText(__Me, %LoreText, %TimeDisplayed)
	ENDIF


You could also unlock them by using story scripts but that requires each Lorable to be Global - a bad practice.


An issue with the current code is each item would have to be unlocked separately. If you want all similar items to be unlocked at the same time I would advise setting a global event unique to that set of Lorable items (use another EXTERN Variable). Then check for the global event instead of the local variable Unlocked.


Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5