Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
#555026 18/09/14 04:37 AM
Joined: Sep 2014
A
stranger
OP Offline
stranger
A
Joined: Sep 2014
Hello, I am trying to get into osiris coding, and I have no idea as of where to look for syntax information. I have run into a problem with an if statement due to this. I want to check whether or not a boss have below 50% hp when his turn starts.

Code
PROC
CharacterTurnStarted(CHARACTER_Ulfred_GateKeeper_Boss)
AND
CharacterGetHitpointsPercentage(CHARACTER_Ulfred_GateKeeper_Boss)<50
THEN
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd000,TRIGGER_Ulfred_GateKeeper_BossAddPoint000,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd001,TRIGGER_Ulfred_GateKeeper_BossAddPoint001,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd002,TRIGGER_Ulfred_GateKeeper_BossAddPoint002,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd003,TRIGGER_Ulfred_GateKeeper_BossAddPoint003,"Add was Spawned");
GoalCompleted;


I get the "Syntax error: "<" unexpected". Any suggestions?

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Well for one you have the "<50" in the outside of the parentheses, so that will give you an error because the command requires both a character and an integer within that function (the parentheses). I don't think the command would recognize "<" even if it was on the inside though.

Here's an idea, not sure if this will work or not:

Code
PROC
CharacterTurnStarted(CHARACTER_Ulfred_GateKeeper_Boss)
AND
CharacterGetHitpointsPercentage(CHARACTER_Ulfred_GateKeeper_Boss,_Health)
And
IntergerMax(_Health, 50)
THEN
ETC...



Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
Code
IF
CharacterTurnStarted(CHARACTER_Ulfred_Gatekeeper_Boss)
AND
CharacterGetHitpointsPercentage(CHARACTER_Ulfred_Gatekeeper_Boss, _Health)
AND
_Health < 50
THEN
Stuff


You want to be using IF rather than PROC. You would also need a way to make sure that it only runs once.

Last edited by Rhidian; 18/09/14 12:18 PM.
Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
Would IntergerMax also work, or am I using that function completely wrong there?

Joined: Jul 2014
R
addict
Offline
addict
R
Joined: Jul 2014
IntegerMax takes two integer inputs and outputs the larger of the two into another variable.

Code
IF
CharacterLeveledUp(_Char)
AND
IntegerMax(5, 10, _output)
AND
_output < 6
THEN
PartyAddExperience(_output); //Never occurs because _output will equal 10


For the OP, this code should do what you're wanting (if GoalComplete doesn't work)
Code
IF
CharacterTurnStarted(CHARACTER_Ulfred_GateKeeper_Boss)
AND
CharacterGetHitpointsPercentage(CHARACTER_Ulfred_GateKeeper_Boss, _health)
AND
_health < 50
AND
NOT DB_UlfredTriggered(1)
THEN
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd000,TRIGGER_Ulfred_GateKeeper_BossAddPoint000,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd001,TRIGGER_Ulfred_GateKeeper_BossAddPoint001,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd002,TRIGGER_Ulfred_GateKeeper_BossAddPoint002,"Add was Spawned");
CharacterTeleportToTrigger(CHARACTER_Ulfred_GateKeeper_BossAdd003,TRIGGER_Ulfred_GateKeeper_BossAddPoint003,"Add was Spawned");
DB_UlfredTriggered(1);

Joined: Sep 2014
A
stranger
OP Offline
stranger
A
Joined: Sep 2014
Your first solution seems to work (haven't tested it extensively though), but how does the alternative to goal completed that you've provided work? Do you not need to define DB_UlfredTriggered somewhere somewhere before hand?

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
I'm pretty sure he's essentially defining the database DB_UlfredTriggered with the NOT clause. Then, when the adds spawn, the database is filled with a number. Since the IF-statement requires that there's nothing in this database, placing something into that database once the adds spawn prevents the adds from spawning over and over again.


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