Two Scripting Issues

Post » Sat May 23, 2015 3:09 am

Hello everyone !

I have two separate issues, both script-related, but since my mod is almost finished and this is pretty much cleaning up, I thought I'd post them in one topic.

My first issue, and the simplest to explain, is... strange. There's a character that wanders around, and when you activate a certain topic, he's supposed to travel to his front door and go inside ; so I created two NPCs, and made a script to allow for him to "change areas" :

Spoiler
Begin ImperialBrotherhoodKrishta

short doonceA
short doonceB

if ( doonceA == 0 )
"ib_aw_Krishta"->AITravel, -9550, 56638, 2559
Set doonceA to 1
endif

if ( GetAIPackageDone == 1 )
if ( doonceB == 0 )
"ib_aw_Krishta"->Disable
"ib_aw_Krishta2"->Enable
PlaySound "Door Heavy Open"
Set doonceB to 1
endif
endif

end

Only once he reaches his destination, he doesn't disappear. Just stands there. Adding "AIWander 0 0 0 0" did nothing, and even deleting his initial AI package - wandering around - also didn't help. This problem is strange because of two reasons : number one, when the player changes cells, the script runs normally (the sound is heard and he is disabled) ; and number two, I'd already done a previous script in a similar situation, that WORKED. I don't understand the problem here. Here's the other script, if you're interested :

Spoiler
begin ImperialBrotherhoodFlight

short doonceA
short doonceB
short OnPCHitMe

"ib_vd_hazimir_assassin"->ForceRun

if ( doonceA == 0 )
"ib_vd_hazimir_assassin"->AITravel, -400, 763, 979
Set doonceA to 1
endif

if ( GetAIPackageDone == 1 )
if ( doonceB == 0 )
"ib_vd_hazimir_assassin"->Disable
PlaySound "Door Heavy Open"
Set InfiltratorStarted to 0
Set doonceB to 1
endif
endif

if ( OnPCHitMe == 1 )
Set OnPCHitMe to 0
SetPCCrimeLevel 0
"ib_vd_hazimir_assassin"->AITravel, -400, 763, 979
endif

if ( OnActivate == 1 )
MessageBox, "This person is fleeing."
endif

end

Next up, the second issue. This one is a real pain in the ass, because I have no idea how to work around it.

At one point in the questline, you're supposed to help rebuild buildings that have been destroyed by terrorists. So you go see an architect (mind you, there are actually three different buildings with three different series of scripts, but in order to keep this short, I'll only post one example) and the architect asks for a few days to rebuild the buildings. Now, the problem is that I can't seem to actually increment the "Days since asked architect" count.

For example, let's take a tower that has three floors. He asks you for three days to rebuild the first floor. So I set up three global variables :

-TowerFirstFloorStarted, which is set to 1 when you ask the architect.

-TowerFirstFloorDay, which is the "day count" - the number of days it'll take him to rebuild the first floor.

-TowerFirstFloorDone, which enables the quest to continue on to the second floor.

So, when you ask him, the following scripts are fired up :

-N°1 :

Spoiler
Begin ImperialBrotherhoodTowerThree

short doonce

if ( doonce == 0 )
Set TowerFirstFloorStarted to 1
Set TowerFirstFloorDay to Day
Set doonce to 1
endif

end

-N°2 :

Spoiler
Begin ImperialBrotherhoodTowerFour

short doonce

if ( doonce == 0 )
if ( TowerFirstFloorDay == ( TowerFirstFloorDay + 3 ) )
Set TowerFirstFloorDone to 1
"ib_imp_towerb_light_03"->Enable
"ib_imp_towerb_light_02"->Enable
Set doonce to 1
endif
endif

end

The problem lies within the second script. The game runs the first script correctly, but gives me a "right eval" error when it tries to run the second script, which makes me think the "+ 3" is the culprit. But I don't even know how to increment the count, and I don't know how to check for the incremented count afterwards.

As always, ideas, suggestions, criticism, and even insults to my awful scripting skills are welcome.

User avatar
Andrea P
 
Posts: 3400
Joined: Mon Feb 12, 2007 7:45 am

Return to III - Morrowind