Jump to content


Changing NPC attitude


  • Please log in to reply
5 replies to this topic
Vox Vox

Citizen

  • Member
    • Member ID: 10,098
  • 45 posts

Posted 08 September 2013 - 07:08 AM #1 Changing NPC attitude

For all the great scripting minds out there, or anyone who has any clue about creature scripts. I'm struggling lately with creating a creature script that corresponds with a potion or even a wand for that matter, that can change the attitude of the creature.

Currently I've tried creating a scen state that sets a flag, once the flag is set, I created a call in the creature script to change the attitude.

Everything works, up until the creature script. This is what it looks like:


beginstate INIT_STATE;

if (get_flag(50,1) == 1)
set_attitude(ME,3);
break;

For some reason, START_STATE doesn't recognise the get_flag call. So it wont work in there.
This seems to work in the INIT_STATE, but only before entering a town with that creature. But if I enter a town, and then use the supposed item which changes the flag, it won't have an effect on the creature's attitude until i leave and come back.

Does anyone have a work around? or solution to this matter? perhaps an alternative method? or even a cookie?

nikki. nikki.

Humany-Wumany

  • Global Moderator
    • Member ID: 2,313
  • 7,445 posts

Posted 08 September 2013 - 04:10 PM #2 Changing NPC attitude

Can't you call a town state from the START_STATE of the creature's script? That way you can use the get_flag call.

Vox Vox

Citizen

  • Member
    • Member ID: 10,098
  • 45 posts

Posted 08 September 2013 - 07:18 PM #3 Changing NPC attitude

Technically yes, but I would need to have it in every town, and it wouldn't work for outdoor encounters.

Kelandon Kelandon

!!!

  • Global Moderator
    • Member ID: 2,682
  • 9,786 posts

Posted 09 September 2013 - 11:45 AM #4 Changing NPC attitude

View PostVox, on 08 September 2013 - 07:08 AM, said:

For some reason, START_STATE doesn't recognise the get_flag call. So it wont work in there.
Um, what? This can't possibly be true, can it?
VCH: I believe we settled this way back when: Kelandon was the most attractive.
SoT: You'd be happy, too, if you were such a clever spider.
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!

Old MikeS Old MikeS

Zenmaster

  • Member
    • Member ID: 3,405
  • 52 posts
  • LocationHmmm, interesting...

Posted 09 September 2013 - 12:42 PM #5 Changing NPC attitude

From a quick look at some of the older scenarios, it looks like 'A Perfect Forest' uses several creature scripts with 'get_sdf' calls in the START_STATE.  At least both 'necrophil.txt' and 'pspirit.txt' use flags within the start state.  They might be good references to setup what is being attempted.

Vox Vox

Citizen

  • Member
    • Member ID: 10,098
  • 45 posts

Posted 09 September 2013 - 07:46 PM #6 Changing NPC attitude

Alright, i'll have to have another look a that. Each time I put a SDF call in the START_STATE it would come up with an error. And if i cut and pasted the exact same thing into the INIT_STATE it would suddenly work.

EDIT: Ok I realise now that in the START_STATE it only recognises get_sdf rather than get_flag. Thanks for that guys.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users