Page 1 of 1

Stopping critters attacking

Posted: Fri Jan 30, 2004 1:32 am
by pillbrain
Hey

Ok, I have a kinda newbish question, and im pretty annoyed since i just lost the whole damn thing, anyway

Ok, so my first real adventure into scripting involves making a small change in arroyo, so that the plants dont attack on sight, and give you a mission to kill the shamen if you talk to them.

Now the problem arrises when you actually attack the guy, if you kill him without accepting the mission, you get no exp an oof message, and the tribe should muller you, if you take the mission, the tribe shouldnt care and you should get exp

the oof message was to see if everything was excecuting instead of just some of it.

however, the tribe seem to attack you no matter what, the strange thing is, if you kill him then re enter the map, they dont keep attacking you, they just act normally.

so im at a loss as to what I need to do to stop them.

The code for killing critter is

if(not(global_var(GVAR_KILL_MAGE) == QUEST_ACCEPTED)) then begin
inc_good_critter
set_global_var(GVAR_TOWN_REP_ARROYO, global_var(GVAR_TOWN_REP_ARROYO) - 50);
end

else if(global_var(GVAR_KILL_MAGE) == QUEST_ACCEPTED) then begin
set_global_var(GVAR_KILL_MAGE,QUEST_COMPLETED);
display_msg(mstr(300));
inc_general_rep(REP_BONUS_KILL_MAGE);
give_xp(EXP_KILL_MAGE);

end


the code for damaging critter is

if (not(global_var(GVAR_KILL_MAGE) == QUEST_ACCEPTED)) then begin
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Personal_Enemy,1);
set_global_var(GVAR_ENEMY_ARROYO,1);
display_msg(mstr(301));
end
end
else if (global_var(GVAR_KILL_MAGE) == QUEST_ACCEPTED) then begin
if(source_obj == dude_obj) then begin
attack(dude_obj);
end
end

and I even changed the speech node where he gets annoyed and tries to beat 7 worlds of hell out of you.

GVAR_KILL_MAGE is set to QUEST_ACCEPTED when you speak to the plants, and also checks out, because of the whole exp versus no exp thing.

If anyone could suggest a reason and a possible solution as to why they keep attacking, id appreciate it.

Thanks
Pill

Posted: Fri Jan 30, 2004 11:35 am
by Jargo
I see you made code ok. The problem with other vilagers attacking player is that Hakunin have same TEAM ID like others: TEAM_ARROYO.
Change it to another and it should help. You can change it in mapper or in script like this:

Code: Select all

critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,7);

Posted: Fri Jan 30, 2004 2:36 pm
by pillbrain
thanks a lot, ive changed that, added a new team to the team header, but the gits still attack, ironically on last test, more did than before, so im wondering if there could also be something in his AI thing, but it seems to be nice and illusive, so ill try hunting that down and see what happens.
thanks

Edit: Ahh, now i see, it was because the team was being initilized on map load, and since i was loading from a save game, it wasnt loading the new team, now it seems to work fine, they only deliver hell if you havent taken the mission.
Thanks a lot, saved me hours of brain racking there.

Posted: Sat Jan 31, 2004 5:22 pm
by Jargo
No prob :)