Jump to content


Photo

Looking to make buffs/costly scripts not be executed more than once if


  • Please log in to reply
29 replies to this topic

#1 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 03:07 AM

As the title says.

Ok, since my script hotkey hackery is sometimes positional, it makes not much sense to activate all the non-modal actions of all characters.

For instance, pressing the "disarm trap" hotkey and having all characters checking to see if a trap is near enough them is wasteful. Only allow a single (!) selected char to access this ability (single, not neareast, because we can't know who is nearest... not without more slowdown at least) would be better.

This would probably be worthwhile so that people don't click the hotkey with all chars selected and slllooooooooowww down the the game for a while, and only slooooow it.
Looking for guidance here, is there any way to check for the selected state of a AI in bgscript? Ie: that the others are NOT selected?


Then there is the case of party wide buffs - in this case, we need to check:
1) If party is not already affected by the buff
2) If anyone doesn't have the buff
3) Prevent others from casting it unnecessarily.

Something like this:

IF
 !SpellCast(Player1, STATE_BLESS)
 !SpellCast(Player2, STATE_BLESS)
 !SpellCast(Player3, STATE_BLESS)
 !SpellCast(Player4, STATE_BLESS)
 !SpellCast(Player5, STATE_BLESS)
 !SpellCast(Player6, STATE_BLESS)
 OR(6)
  NotStateCheck(Player1, STATE_BLESS)
  NotStateCheck(Player2, STATE_BLESS)
  NotStateCheck(Player3, STATE_BLESS)
  NotStateCheck(Player4, STATE_BLESS)
  NotStateCheck(Player5, STATE_BLESS)
  NotStateCheck(Player6, STATE_BLESS)
 OR(2)
  TriggerOverride(Player1, HaveSpell(CLERIC_BLESS))
  See(Player1)
 OR(2)
  TriggerOverride(Player2, HaveSpell(CLERIC_BLESS))
  See(Player2)
 OR(2)
  TriggerOverride(Player3, HaveSpell(CLERIC_BLESS))
  See(Player3)
 OR(2)
  TriggerOverride(Player4, HaveSpell(CLERIC_BLESS))
  See(Player4)
 OR(2)
  TriggerOverride(Player5, HaveSpell(CLERIC_BLESS))
  See(Player5)
 OR(2)
  TriggerOverride(Player6, HaveSpell(CLERIC_BLESS))
  See(Player6)
 //I AM THE CHOSEN ONE!
 Range(LastSeenBy,0)
THEN
  Spell(LastSeenBy,CLERIC_BLESS)
  Continue()
END

It would still have problems if they were separated...
and if one that had it were invisible... pity that LastTrigger will not work for HaveSpell...
and i don't know if the
!SpellCast(Player, STATE_BLESS)
checks are needed.

And i'm not Sure if See(Myself) (or Player1 in this case for ex) will work, in which case, this idea is pointless.

Edited by i30817, 27 November 2011 - 03:18 AM.


#2 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 04:08 AM

Another question about something not on IESDP.

Do creatures who use Shout hear their own Shouts? If using a Heard trigger ofcourse.

If i want to use detectable spells in my mod to recognize already cast ones, should i depend on SCSII (that appears to have the latest version?) or embed the ancient 2005 version in gibberlings 3?

Edited by i30817, 27 November 2011 - 05:58 AM.


#3 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 11:12 AM

Do creatures who use Shout hear their own Shouts? If using a Heard trigger ofcourse.

Not that i'm aware of, but could possibly. you'd need to test with something that the shouter could perform like a displaystringhead. Tho using a combination of global variable checks works better cause you don't need to be concerned about distance between characters IF distance isn't really a factor for what you are doing...

If i want to use detectable spells in my mod to recognize already cast ones, should i depend on SCSII (that appears to have the latest version?) or embed the ancient 2005 version in gibberlings 3?

not sure about detectable spells stuff... probably best to use the most recently distributed version with permission of course. Check with DavidW about the detectable spells stuff in SCSII he should be able to point you in the right direction.

And i'm not Sure if See(Myself) (or Player1 in this case for ex) will work, in which case, this idea is pointless.

those won't work to pick out the specific party member BUT Range(Player1,0) will return only Player1 since characters cannot occupy the same space.


Looking for guidance here, is there any way to check for the selected state of a AI in bgscript? Ie: that the others are NOT selected?

No. at least not that I'm aware of. However you could solve it in one of two ways.

#1 script blocks using HotKey (or triggered by a global set by HotKey) will only work on SELECTED party members and not on all party members. So you could tell your mod users that to do the hotkey actions they should select only the appropriate character before pressing the hotkey else they could run into lag as all characters will be running the non-modal actions unnecessarily


#2 you can script in using GLOBAL variables a method to single out only one character, when the entire party is selected, to perform the necessary actions. consider something like this (would be part of a script running on each character)
psudeo code:
Spoiler

Only problem I foresee is if you make the checks too low and the character selected is lower leveled in the specific skill set than another party member. You could try combining the player selection blocks with the actual work block but then you'd have 6 blocks for each object rather than just 6 blocks to select party member and 1 block for the object work

Probably smartest way is to just tell the player to select only the party member they want to do the actions prior to pressing the hotkey. If they press the hotkey with everyone selected, well judicial use of checks may prevent some of them from trying to do the same tasks.


hope it was all useful and not a waste of me typing it out. you don't need to use the displaystringhead actions if you don't want. I just thought it might be a nice debug option till you knew it was working properly

Then there is the case of party wide buffs - in this case, we need to check:
1) If party is not already affected by the buff
2) If anyone doesn't have the buff
3) Prevent others from casting it unnecessarily.

Check out E-series. it's where I got a lot of ideas about dealing with spells etc. It uses a combination of LOCALS and GLOBAL variables as well as timers to do pretty much what you are looking at.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#4 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 05:19 PM

Very funny comments.

Code itself seems complex.

I was thinking of:
IF
          HotKey(~NM_KEY~)
          ActionListEmpty()
          OR(2)
            CheckStatGT(Myself,1,SETTRAPS)
            CheckStatGT(Myself,1,LOCKPICKING)
          !GlobalTimerNotExpired("gt#trapstimer","GLOBAL")//to guard against more than 1 npc doing this        
        THEN
          RESPONSE #100
          DisplayStringHead(Myself,@3)
          SetGlobalTimer("gt#trapstimer","GLOBAL",12) //2 rounds should be enough for the player to stop pressing NM_KEY
          ActionOverride(Myself,ChangeAIScript("gt#act",GENERAL))
        END

First one selected wins (though it would be nicer if it was the higher skilled selected one, but maybe not: since this is positional, the first one is probably nearer the mouse cursor click in group movement, and thus, nearer the lock or trap).

And let them pickpocket more than one at a time if they want. Is this error prone?

BTW, how can i display strings randomly without repetition?
        IF
...     
        THEN
          RESPONSE #100
               ...//required actions
          RESPONSE #50
          DisplayStringHead(Myself,@3)
          RESPONSE #50
          DisplayStringHead(Myself,@4)
        END
Seems that it might display both strings sometimes (which might provoke artifacts? Or the "last one wins", and there is no problem?)

Edited by i30817, 27 November 2011 - 05:36 PM.


#5 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 06:01 PM

Actually the above is not ideal either;

Since i'm using the same key for both pickpockets, lockpick and disarm traps (giving priority to pickpocket), to minimize user irritation, and because i'm already at 4 keys even overloading them;
It would be really nice to be able to see if a char is the only selected before it even attempts to change the AI script to check for locks or traps.

My code above is only preventing more than one trying, not "not even try" if you are not the only one selected.

Your code does that, but it needs to wait for the next AI update (for all the selected ones to have their globals updated), so it will induce a bit of lag.
I think i will use it thanks. And bother Ascension64 with another feature request.

ImTheOnlyOneSelected trigger or similar.

Edited by i30817, 27 November 2011 - 06:04 PM.


#6 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 07:36 PM

How about this (rather tricky):

Spoiler


First, when NM_KEY is pressed, a round is wasted for counting the selected characters.

It does this by using the property of HotKeys that they are only sent to selected chars, and using both a global (to count the chars) and a local (to prevent double counting if the HotKeys remains pressed more than 1 AI update).

Then, in the next AI update all chars will check for if Global("gt#selected","GLOBALS",1)
That is the sign of a single selected char. If it is so, the pickpocket conditions are checked, if it fails, then lockpicking and trap removal.

Pressing the hotkey and immediately releasing will run one of the non-modal actions the next round.

Keeping the hotkey pressed will allow to repeat (pickpocketing, or openlocks or trap removal) - since you often want to steal more than one item, or open a lock and disarm its trap.
Won't work because it would keep doing that forever and the reset would never happen. Better to reset and waste another turn to count the selected chars if the hotkey is still pressed.

Eventually, the player will stop pressing the hotkey but the LOCAL may still be set. Then the first char to notice that will clear the global and the locals.


Works? I'm assuming that a AI "round" is enough to count all chars, ie: the script engine executes the AI of player1... player6 in order and only then goes to player1 again. Otherwise there may be false positives where a char thinks it is the only one selected.

Edited by i30817, 27 November 2011 - 09:02 PM.


#7 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 08:12 PM

BTW, how can i display strings randomly without repetition?

        IF
...     
        THEN
          RESPONSE #100
               ...//required actions
          RESPONSE #50
          DisplayStringHead(Myself,@3)
          RESPONSE #50
          DisplayStringHead(Myself,@4)
        END
Seems that it might display both strings sometimes (which might provoke artifacts? Or the "last one wins", and there is no problem?)

your psudeo code wouldn't work as the RESPONSE #'s need to add up to 100. the number is a % chance of happening. You'd need to perform something more like...
Spoiler




I just had a sudden thought...
do something like I do for preventing spell casters from wasting healing spells on the same character...
Spoiler

obviously you'd need to modify it but the trick is in the timers. the global one keeps the other healers from casting a healing spell and the local one keeps the healer from starting any other spell (potentially causing the healing spell to fail). Ignore the text label for the numerical value. Was tweaking the scripts for just the right value to use. IWD was a full round, but BG seems to take twice as long even tho it's round is 6 instead of 7.

Example:

1 druid & 1 cleric
fighter is injured severely
cleric returns true first and goes to heal the fighter
druid does something else
timer runs out
fighter still injured
druid gets to the script block first this time and returns true instead so goes to heal fighter
cleric does something else
timer runs out
if fighter still injured one of 'em will heal
if not they all do something else


So you could have in your parent script:
Spoiler

then your gt#act script could have
Spoiler
So with this when one or more are selected that match the initial hotkey press checks their scripts will be changed. then as the thief script is executed those who have high enough skills for a given object will do the action, but set a timer so that others who could have to wait before attempting. If the first was successful then the block won't return true for the others to try. If the first failed then another can have a go at it or the first might get the chance to try again. might be a bit better than setting strict globals so that only one will ever do the work...

what you think?

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#8 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 08:58 PM

And you type this whilest I type the other....

How about this (rather tricky):

Spoiler


First, when NM_KEY is pressed, a round is wasted for counting the selected characters.

It does this by using the property of HotKeys that they are only sent to selected chars, and using both a global (to count the chars) and a local (to prevent double counting if the HotKeys remains pressed more than 1 AI update).

Then, in the next AI update all chars will check for if Global("gt#selected","GLOBALS",1)
That is the sign of a single selected char. If it is so, the pickpocket conditions are checked, if it fails, then lockpicking and trap removal.

Eventually, the player will stop pressing the hotkey but the LOCAL will still be set. Then the first char to notice that will clear the global and the locals.


Works?

no hotkey is not held down while actions take place
hotkey is pressed once then that block takes place
IF that block changes the script then anything in the new script will run till it is somehow removed
or if the hotkey sets a timer then anything depending upon the timer will run till the timer runs out
or if the hotkey sets a variable then anything depending upon the variable will be able to be ran until the variable is reset


I think you need to have multiple uses of the same hotkey so that

Spoiler

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#9 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 09:18 PM

I don't think that will work because ChangeAIScript delays the running of the changed script into the next AI update.

So you'd set the timer, change the script, wait a round, start doing work, and meanwhile the others would be doing it too, also wasting a round etc.

At the end, one of them would "win" but every member of the team would have wasted 2 turns (run the original script, run the the changed script and return to the normal one)
And that script is HUUUUUUGGGEEE.

Vs: 2 rounds, wasting one round to elect the selected for all selected (non selected others do whatever), then if 1 selected it runs the huge script with 1 round, and the rest do whatever.


Edit:
I don't understand your point about the hotkey. The pickpocket "wins" if there is a pickpocketing target there. If not it attempts the rest.

Maybe i should put a continue there to attempt the rest of the possibilities in that turn (or move the pickpocket block to the external file, though that would delay it until the next round because of the ChangeAIScript).

Edited by i30817, 27 November 2011 - 09:25 PM.


#10 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 09:44 PM

Edit:
I don't understand your point about the hotkey. The pickpocket "wins" if there is a pickpocketing target there. If not it attempts the rest.

you made it sound like the player was to press and hold in the hotkey for any of the actions to take place and that when they removed their finger from the hotkey then things would go back to normal


EDIT:

So you'd set the timer, change the script, wait a round, start doing work, and meanwhile the others would be doing it too, also wasting a round etc.

keep in mind that a script processing 'round' is not equal to a game round. The scripts are not read only 10 times in a turn. The scripts are continuously checked for something to be true no matter which script on which level it is when something is true they start over at the top level script else keep going down thru the scripts till it reaches the end. There may not be as much loss in time as you are thinking. Mainly the worst thing is having mods that add tons of stuff to the baldur.bcs that script is always running and this is why you chose to switch scripts.

Just think about this, you are scripting something that the user would have to stop and do. believe it or not you are still saving them time by having it automated at the press of a button. The user can still manually control other idle characters while the automated one does its tasks. That's why the blocks have ActionListEmpty() any of them that are valid will go do the job but only if the user hasn't told them to do something else

Edited by Sasha Al'Therin, 27 November 2011 - 09:57 PM.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#11 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 10:06 PM

Well, i had that idea before. That's why in the response you quoted above i didn't reset the global and locals when i ran the pickpocket and traps&locks block.

However i realized that that would mean that the variables would never reset so i edited it.
I decided to reset them in the blocks if they trigger and also if the hotkey is no longer pressed - it seems equivalent except the NPC's will waste another script "round" seeing if there is only one selected again if the hotkey is still on, since if the hotkey was still pressed in the last round they will elect again, and if they do, they will run the blocks in the next turn.

Edit:

keep in mind that a script processing 'round' is not equal to a game round. The scripts are not read only 10 times in a turn.

Ah, that just means that it's faster. But ChangeAIScript DOES waste a AI round. At least it took forever to do 6 changes when i tried my binary search for stats idea.
I'd put the pickpocket with the traps in the external file if it didn't. As it is, i prefer "responsive" pickpocketing than wait for the AI round to finish. And not continuing to the rest allows me to pickpocket again without having to run the other script.

If the AI rounds don't match script execution, the election shouldn't be so bad.
Though i'm still not sure:

I'm assuming that a AI "round" is enough to count all chars, ie: the script engine executes the AI of player1... player6 in order and only then goes to player1 again. Otherwise there may be false positives where a char thinks it is the only one selected.

?

Edited by i30817, 27 November 2011 - 10:30 PM.


#12 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 10:44 PM

Also, what do you think of this "balancing"?

@18 = ~Book of the versatile semi-thief~


@19 = ~This book can teach you most of the skills of a thief and to use them in a instant.
Thieves can use it to shortcut the use of their skills, but it's otherwise useless to them

Advantages:
*Can increase and use thieving abilities and backstab to +3 (at level 5 and level 13)
*Gain use any item at level 20
*Thieves recognize you as a honorary thief if equiped in a belt

Disadvantages:
*Monks can't increase detect traps, hide-in-shadows or move silently from studying the book
*Rangers can't increase hide-in-shadows or move silently from studying the book
*Bards can't increase pickpocketing from studying the book
*All characters that already have backstabs multipliers beyond 2 and 3 at the 5th and 13th level do not get them
*Only 20 skill points per levelup
*Can't increase each skill beyond 175 (not counting racial, item and dexterity bonuses)
*Can't steal from stores
*Can't create traps or use thief kit abilities (excluding use any item at level 20)~


Feel bad about lowering the "use any item" ability from level 24 to 20, but when you consider that most uses of this will be on multclassed chars...

Edited by i30817, 27 November 2011 - 10:46 PM.


#13 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 10:54 PM

since if the hotkey was still pressed in the last round

don't say this... it's failed logic to me

the hotkey is pressed and good for one use only. that's why variables or timers or script switch takes place.

let's play out the scenario so we both understand..
assigned hotkey is F
player presses and releases F
If there is a valid block with Hotkey(F) in the current script processing round on any script it will be processed and the hotkey value flushed from memory. If there is no valid block with Hotkey(F) then nothing happens since the value is flushed after the scripts have restarted processing.

whatever else takes place is totally dependent upon any variable, timer or change in script which took place on that initial block with Hotkey(). It can not be true two script rounds in a row unless the player presses and releases the key again.

with what you've been stating regarding Hotkey() this would make an endless loop:

IF
Hotkey(F)
Global("something","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("something","LOCALS",1)
DisplayStringHead(Myself,"Help!")
END
IF
Hotkey(F)
Global("something","LOCALS",1)
DisplayStringHead(Myself,"I've gone psycho!!!!!")
END
but that isn't the case. the player has to release the button and press it again for the 2nd block to ever return true. anything else that takes place based on the associated global variable takes place because of the variable value and not because the assigned letter key is having constant pressure applied to it.

Is it clear?

it may seem like nitpicking but if terms aren't understood then progress can't be made....



I'm assuming that a AI "round" is enough to count all chars, ie: the script engine executes the AI of player1... player6 in order and only then goes to player1 again. Otherwise there may be false positives where a char thinks it is the only one selected.

where did you find that at? would be nice to know who said it and to read whatever else may be associated with it.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#14 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 10:57 PM

Feel bad about lowering the "use any item" ability from level 24 to 20, but when you consider that most uses of this will be on multclassed chars...

I've never reached level 20... what's it like? and what do you mean by 'use any item'? you allow clerics to equip weapons they normally don't because they have read a book?

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#15 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 11:03 PM

Ah, it's press AND release? I thought it was just "while pressed".


Quote
I'm assuming that a AI "round" is enough to count all chars, ie: the script engine executes the AI of player1... player6 in order and only then goes to player1 again. Otherwise there may be false positives where a char thinks it is the only one selected.
where did you find that at? would be nice to know who said it and to read whatever else may be associated with it.


It's just the easiest way to program something like a script engine if you're not using threads. The other solutions to interleave execution without threads (like "continuations") are not popular in C++.
Guess Avenger on G3 is the person to ask.

Edited by i30817, 27 November 2011 - 11:06 PM.


#16 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 11:09 PM

Feel bad about lowering the "use any item" ability from level 24 to 20, but when you consider that most uses of this will be on multclassed chars...

I've never reached level 20... what's it like? and what do you mean by 'use any item'? you allow clerics to equip weapons they normally don't because they have read a book?


I don't know either :)
I normally use triple classes with party (and now, probably will attempt 3 triple F/M/C/(T) with level1npcs).

Use any item is the greatest thief highlevel ability, it allows you to equip and use items regardless of restrictions.

I don't mind clerics equipping weapons - they wouldn't have the proficiencies anyway at level 20.

Edited by i30817, 27 November 2011 - 11:13 PM.


#17 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 27 November 2011 - 11:16 PM

Use any item is the greatest thief highlevel ability, it allows you to equip and use items regardless of restrictions.

if that's the case, why lower it? the point of your mod is to allow thieving actions on non-thieves NOT make thieves of non-thieves I'd think that they should still be stuck with their official restrictions regarding items myself... but it's your mod

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#18 i30817

i30817
  • Member
  • 611 posts

Posted 27 November 2011 - 11:41 PM

You're right. However i originally thought of that because there is no other way to use "thieves only" items.

And frankly there is not much to look forward after level 13 (last backstab, lowered because this allows you whole team of backstabbers. Maybe i will lower it to max 2 even. Then the "Stalker dilemma" i've been having would go away (stalker ranger kit gets +2 backstab at level 9 and +3 at level 17, i'm unsure if i should copy that instead of the levels i have now)).

Triple-classes have near zero chances to reach level 24 with a party (except if the game is BGT modded to hell and back).

Maybe i will make it a component and allow choosing the level.

Edited by i30817, 28 November 2011 - 12:22 AM.


#19 phordicus

phordicus
  • Member
  • 212 posts

Posted 28 November 2011 - 12:03 AM

your psudeo code wouldn't work as the RESPONSE #'s need to add up to 100. the number is a % chance of happening.

Pretty sure this is incorrect. The number is just its weight compared to any other RESPONSE numbers.

From vanilla MAGE14D.BCS
IF
	See(NearestEnemyOf(Myself))
THEN
	RESPONSE #30
		ForceSpell(LastSeenBy(Myself),WIZARD_MAGIC_MISSILE)
	RESPONSE #30
		ForceSpell(LastSeenBy(Myself),WIZARD_CHROMATIC_ORB)
	RESPONSE #30
		ForceSpell(LastSeenBy(Myself),WIZARD_LARLOCH_MINOR_DRAIN)
	RESPONSE #30
		ForceSpell(LastSeenBy(Myself),WIZARD_BURNING_HANDS)
	RESPONSE #30
		EquipMostDamagingMelee()
		AttackReevaluate(LastSeenBy(Myself),15)
END
Five choices all with an equal chance of happening, though I believe there's a teeny-tiny slight bias towards the first option available among identical weights.

You can use any number as weights; it's only their relationship to each other that matters. From STEALTHF.BCS:
IF
	See([PC])
	Global("spoke","LOCALS",0)
THEN
	RESPONSE #100
		SetGlobal("spoke","LOCALS",1)
		DisplayStringHead(Myself,2435) // This is our territory.
	RESPONSE #100
		DisplayStringHead(Myself,4374) // You're stealing without permission, for that you're going to pay.
		SetGlobal("spoke","LOCALS",1)
	RESPONSE #200
		SetGlobal("spoke","LOCALS",1)
END

Druid Kit Enhancements 1.0 (requires Dispel Magic fix, whether ToBEx's or Taimon's)

#20 i30817

i30817
  • Member
  • 611 posts

Posted 28 November 2011 - 12:42 AM

Eh? 200%?