Jump to content

Action: IncrementGlobal()


Echon

Recommended Posts

The game crashes when I try to use this action. I would like somebody to confirm that it does not work. The script I used it in is as follows:

 

IF
See(Player1)
GlobalGT("Spell","LOCALS",4)
THEN
RESPONSE #100
 ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
END

IF
See(Player1)
GlobalLT("Spell","LOCALS",5)
THEN
RESPONSE #100
 IncrementGlobal("Spell","LOCALS",1)
END

 

-Echon

Link to comment
The game crashes when I try to use this action. I would like somebody to confirm that it does not work. The script I used it in is as follows:

 

IF
See(Player1)
GlobalGT("Spell","LOCALS",4)
THEN
RESPONSE #100
 ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
END

IF
See(Player1)
GlobalLT("Spell","LOCALS",5)
THEN
RESPONSE #100
 IncrementGlobal("Spell","LOCALS",1)
END

 

-Echon

 

 

You have made a little fault in this script, that I usually like to do too :)

 

Your Char is hanging in a loop, because he will try tot spell the given spell over and over. Try to change it like this:

 

IF

See(Player1)

GlobalGT("Spell","LOCALS",4)

GlobalLT("Spell","LOCALS",6)

THEN

RESPONSE #100

ForceSpell(Player1,WIZARD_MAGIC_MISSILE)

IncrementGlobal("Spell","LOCALS",1)

END

 

IF

See(Player1)

GlobalLT("Spell","LOCALS",5)

THEN

RESPONSE #100

IncrementGlobal("Spell","LOCALS",1)

END

 

I guess, then the game will like you more.

 

Because of the lack of many usefull trigger in BG1 that are possible in BG2, scripting in BG1 is almost ever to got long ways to your goal. In the example above the Trigger *HaveSpell...* would be very usefull - but - it is not existent in BG1 - sadly.

 

 

Roana

Link to comment
You have made a little fault in this script, that I usually like to do too :)

Your Char is hanging in a loop, because he will try tot spell the given spell over and over.

 

That is not an error but a feature. I often have the test creature cast the same spell over and over and it does not make the game crash.

 

Because of the lack of many usefull trigger in BG1 that are possible in BG2, scripting in BG1 is almost ever to got long ways to your goal. In the example above the Trigger *HaveSpell...* would be very usefull - but - it is not existent in BG1 - sadly.

 

http://iesdp.gibberlings3.net/scripting/bg1triggers.htm ->0x4031

 

Without HaveSpell(), scripting spellcasters would be impossible.

 

-Echon

Link to comment
Even that wouldn't save his butt as nothing would move the variable away from 5.

Before casting the spell, reset the variable.

 

Yup. This *might* do it:

 

IF
 See(Player1)
 GlobalGT("Spell","LOCALS",4)
 GlobalLT("Spell","LOCALS",6)
THEN
 RESPONSE #100
    ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
    IncrementGlobal("Spell","LOCALS",1)
END

 

-Y-

Link to comment
Even that wouldn't save his butt as nothing would move the variable away from 5.

Before casting the spell, reset the variable.

 

Yup. This *might* do it:

 

IF
 See(Player1)
 GlobalGT("Spell","LOCALS",4)
 GlobalLT("Spell","LOCALS",6)
THEN
 RESPONSE #100
    ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
    IncrementGlobal("Spell","LOCALS",1)
END

 

 

-Y-

 

IF
 See(Player1)
 Global("Spell","LOCALS",5)
THEN

 

Seems easier.

Link to comment
I tried your suggestions but the game still crashes. It does not even give me an AssertionFailed error.

Mmmm. Okay, using my code suggestion, try using a hotkey trigger and a line-by-line reintroduction until it crashes e.g.

 

//Try 1
IF
HotKey(T) 
// See(Player1)
// GlobalGT("Spell","LOCALS",4)
// GlobalLT("Spell","LOCALS",6)
THEN
RESPONSE #100
   ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
//    IncrementGlobal("Spell","LOCALS",1)
END

//Try 2
IF
HotKey(T) 
See(Player1)
// GlobalGT("Spell","LOCALS",4)
// GlobalLT("Spell","LOCALS",6)
THEN
RESPONSE #100
   ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
//    IncrementGlobal("Spell","LOCALS",1)
END

//Try 3
IF
HotKey(T) 
See(Player1)
// GlobalGT("Spell","LOCALS",4)
// GlobalLT("Spell","LOCALS",6)
THEN
RESPONSE #100
   ForceSpell(Player1,WIZARD_MAGIC_MISSILE)
   IncrementGlobal("Spell","LOCALS",1)
END

//etc

 

Sooner or later you'll identify the crash line, at which point I'm quite willing to try and reproduce the fault. The idea of the HotKey is simply to give you full control over when the script section fires.

 

-Y-

Link to comment

I have identified the problem.

 

This block crashes the game:

 

IF
True()
THEN
RESPONSE #100
 IncrementGlobal("Test","LOCALS",1)
END

 

These two work:

 

IF
True()
THEN
RESPONSE #100
 IncrementGlobal("Test","GLOBAL",1)
END

IF
True()
THEN
RESPONSE #100
 IncrementGlobal("Test","AR2600",1)
END

 

-Echon

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...