Annoying Scripting error

Neo Decoy

First time out of the vault
Its been a while since ive coded for FO, now im getting a strange syntax error( ; missing), i know ive forgotten something specifc to fo scripts can someone point me in the right direction

Code:
if ((get_critter_stat(self_obj,STAT_current_hp) <= (get_critter_stat(self_obj,STAT_max_hit_points)/10)) and HP_Regen <= 2; then begin
         set_critter_stat(Self_obj,STAT_current_hp, 500);
         HP_Regen:=+1;   
   end

is the code im playing with and any help is appreciated :)

Edit:
To make it a bit clearer this line is the one causing the errors(i commented out the rest to check)

Code:
set_critter_stat(Self_obj,STAT_current_hp, 500);
 
If critter current HP is less than 10% of his max HP and +1 less than 2
Then increase his HP to 500

I dont understand this bold fragment
I sugest:

variable HP_Regen
HP_Regen := x+1

where x is STAT_max_hit_points (?)
 
soz - the HP_Regen is a variable designed to count how many times it does it(so it dosnt indefinatly regen his hp - its designed to beat the 999 hp cap in a round about way)
 
Now i understand why you do this
I would make this on global vars:

if global var is 0 and
if critter HP is less than 100 points then
critter_heal(self_obj,999)
set this global var to 1
else
end

result: critter got 2 * 999 HP
 
Yeah i just realised(was watching myth bustors - see breaks do help!) harakun heals teh character so ill look that up after numbers(only night i watch tv lol) - thnx for your help - not sure about gloabl variables tho - just want locals so i can use the same code on multiple mobiles
 
Compiler does not understand that construction:
HP_Regen :=+1;
and indicates error for previous line.

Do this way and error will dissapear:
HP_Regen += 1;
 
switched it around to a set_local_var instead -had to change a few things around anyway - works perfect if anyone's wondering :)
 
On which procedure you put this code?

I made special arena for testing
-book that give PERK_bonus_awareness and SKILL_SMALL_GUNS =200
-gun that give 50/50 domage
-critter in cage with 999 HP and script:

Code:
#define LVAR_domage (0)

Code:
if (local_var(LVAR_domage) == 0) and 
(get_critter_stat(self_obj,STAT_current_hp) < 100) then begin
critter_heal(self_obj,999);
set_local_var(LVAR_domage,1);
 end else begin
end
end

Content i put to many procedures:
critter_p_proc
destroy_p_proc
damage_p_proc

But this not work
 
Try creating your own procedure, placeing it in there, then in every single procedure do a damage check and if true call on your main procedure BUT add a debug msg into your standard procedures - THAT way you know which procedure is flagging it.

PS: i deleted that script i made(was just playing around), working on a few things atm, but when i get the chance ill re-create the script and post it on here if you havnt gotten it working by then :)
 
From Fallout_Editor.Doc

Code:
Damage:
Something has occurred to damage this scripts’ object. This will almost always mean that a critter has been hit in combat. Here they could set hostile flags (that might affect dialog or quest statuses later), or they could heal themselves to prevent death (this isn’t good practice, but may be useful in one or two cases where you want to make sure the critter says something, does something, etc. before they actually die).

So code should be placed in damage_p_proc
I must check my code again

EDIT

I used new code on my arena

Code:
procedure damage_p_proc begin
if (get_critter_stat(self_obj,STAT_current_hp) < 100) then begin
critter_heal(self_obj,999);
end else begin
end
end

Result: critter is immortal, heal always after HP<100

So error was in LVAR, i need knowledge about using this var properly
 
Code:
#define self_hp    get_critter_stat(self_obj,STAT_current_hp)

variable hp_left;
variable hp2regen;

procedure map_enter_p_proc begin
 hp_left:=999;
 if self_hp<999 then begin
   hp2regen:=999-self_hp;
   hp_left:=999-hp2regen;
   critter_heal(self_obj, hp2regen);
 end
end

procedure damage_p_proc begin
 if (self_hp<999) and (hp_left>0) then begin
   hp2regen:=999-self_hp;
   if hp2regen>hp_left then hp2regen:=hp_left;
   hp_left:=hp_left-hp2regen;
   critter_heal(self_obj, hp2regen);
 end
end

It's very simple code. For ideal realisation 3 gvars usage needed.
 
dont use gvars - use MVAR's or LVAR's - you dont need it set for the entire world, plus if you use another critter with a GVAR of the same name, and set it up wrong your going to get some strange errors
 
Back
Top