Jump to content


Photo

She only attacks when she wants to, please help


  • Please log in to reply
19 replies to this topic

#1 Keldon

Keldon
  • Member
  • 62 posts

Posted 21 February 2007 - 12:01 PM

Hi everyone!

I have a question that I hope will be quite easy to answer. I have coded my NPC so that, on two different occasions, she can go hostile and attack the PC.
Now, I have tried it with each entry going to their perspective attk1 and attk2, and both of them going to just attk2.
The reason for this is that in the first case, the NPC goes hostile but then just stands there, won't even attack back if the PC attacks her.
In the second case, everything goes exactly as I want it to, she goes hostile and attacks the PC.
Since there is no difference in the coding, how come she won't attack the first time but she will the second?
Does anyone know the answer to this?

Thank you
Keldon :new_thumbs:

#2 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 21 February 2007 - 01:30 PM

Is she in the party at both occasions?

EDIT: This should be in IE Help forums, not Modders' Room.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#3 Keldon

Keldon
  • Member
  • 62 posts

Posted 21 February 2007 - 04:41 PM

oops, sorry about posting in the wrong room =/

In both instances she and the PC are talking about wether she is going to join the party or not, then the PC insults her, she gets angry and attacks him/her......so to answer your question......ummm, kinda?

#4 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 21 February 2007 - 05:04 PM

Has she, in one of the occasions, already joined the party (as in Enemy() triggering after the JoinParty() action)?

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#5 Keldon

Keldon
  • Member
  • 62 posts

Posted 21 February 2007 - 06:38 PM

Yes, in the first situation, she has not joined yet, but is talking to the PC about possibly joining.

In the second one, she has been in, got kicked out, and is talking to the PC about possibly rejoining.

Does this help?

#6 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 21 February 2007 - 07:49 PM

Possibly. Are there any scripts assigned to the .cre-file, aside from override?

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#7 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 22 February 2007 - 05:55 AM

Perhaps, I am not understanding correctly, but why not script Attack(Player1), it seems to work for me. Kicked out, rejoining option and than going hostile.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#8 -Guest-

-Guest-
  • Guest

Posted 22 February 2007 - 06:10 AM

Hello,

No, there are no scripts, that I am aware of assigned to the .cre-file. So far all that I have created for her is the tp2, the exe, the .d, the area.baf, portraits (hmm, this might be attached to it?), the NPC.cre. and the attk.baf (to instruct her to attack any enemy she sees)


DeathsAngel
I am afraid I am new to this whole coding stuff, how would you code this "script attack(Player1)"? Perhaps this may be the answer to this puzzle.

#9 Keldon

Keldon
  • Member
  • 62 posts

Posted 22 February 2007 - 06:13 AM

Sorry, the above "guest" is me. I am on a different computer and forgot I had to log in. My other computer has me logging in automatically.

Keldon :new_thumbs:

#10 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 February 2007 - 06:25 AM

You will probably need to assign her a script. Unfortunately, all my examples are at home on my non-work computer.

If you include the following line in your tp2, it will assign her the override script MyScript. You would then put everything you wanted her to do, like attack Player1, in it. Unfortunately, I'm at work, so the long answers will have to wait until later.

In the tp2:

COPY ~MyMod/CRE/MyNPC.cre~ ~override~
//various sound assignments
WRITE_ASCII 0x280 #8 ~MyScript~ //I think that hex offset is right, but would someone be able to check?

Then later on, you would compile her script in the tp2:

COMPILE ~MyMod/BAF/MyScript.baf~

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#11 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 22 February 2007 - 06:42 AM

Taken from my released mod, it is just in the dialogue no script needed.

IF ~~ THEN BEGIN noofcy
SAY ~You will not offend Cyric in my presence so easily. You will die for your insolence!~
IF ~~ THEN DO ~Attack(Player1)~ EXIT
END

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#12 Keldon

Keldon
  • Member
  • 62 posts

Posted 22 February 2007 - 06:55 AM

Wow!

Deathsangel.....I am very excited about being able to put it in the .d the way you just suggested. It just seems so very simple and straightforward!
Thank you very much for that.

On a bit of a different note, one question that has crossed my mind a few times is....I am creating an evil NPC to share with the community, you are creating The Mod for the Wicked (which I am very excitedly awaiting). Maybe, with this similarity we share, we can collaborate and see if the two can become associated somehow? I don't know if this goes against any particular rules, and hope it in no way offends you....I was just thinking that it might be a neat thing to do. (How is the mod for the wicked coming along?)

Peace
Keldon :new_thumbs:

#13 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 22 February 2007 - 07:11 AM

That is a thing for the PM, and do not worry I am not offended. Though I have to say that I have 5 npc's in my mind (which will take a while for sure), so adding another to the true mod would be overkill, but PM is possible and talk it more out, that is not for the forums, clocking up the board.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#14 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 22 February 2007 - 02:35 PM

No, there are no scripts, that I am aware of assigned to the .cre-file. So far all that I have created for her is the tp2, the exe, the .d, the area.baf, portraits (hmm, this might be attached to it?), the NPC.cre. and the attk.baf (to instruct her to attack any enemy she sees)

The entire reason I'm asking the questions is that is you do have a script assigned to the character in any other slot than override, they get wiped when the NPC joins the party.

attk.baf, you say. Where are you using that?

COPY ~MyMod/CRE/MyNPC.cre~ ~override~
//various sound assignments
WRITE_ASCII 0x280 #8 ~MyScript~ //I think that hex offset is right, but would someone be able to check?

0x280 is the deathvariable. #8 is not necessary unless you're overwriting another string, and should be placed after the string (~~).

Also, WeiDU support certain constants, which makes it easier to remember than keeping all offsets in your head.

COPY ~MyMod/CRE/MyNPC.cre~ ~override~
WRITE_ASCII SCRIPT_OVERRIDE ~MyScript.bcs~ #8

Deathsangel.....I am very excited about being able to put it in the .d the way you just suggested. It just seems so very simple and straightforward!
Thank you very much for that.

That's one way to do it, but if you have a script, you should use that instead. Why? Because if you have a good script assigned to the NPC, he or she will actually do more than just swing his sword - use potions, combat tactics and whatnot. If it's a mage, he will cast spells, and so on.

Note that it doesn't applies if your script only says Attack() - that's just the same thing. I'm talking about if you have a good script assigned to the creature.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#15 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 22 February 2007 - 03:42 PM

Also, WeiDU support certain constants, which makes it easier to remember than keeping all offsets in your head.

COPY ~MyMod/CRE/MyNPC.cre~ ~override~
WRITE_ASCII SCRIPT_OVERRIDE ~MyScript.bcs~ #8


Bless you, from the bottom of my black little heart. I do so hate trying to keep those wretched offsets in mind. I have no memory for stuff like that.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#16 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 22 February 2007 - 04:00 PM

It does get a lot easier, doesn't it? ;)

These are the constants you can use: SCRIPT_OVERRIDE, SCRIPT_CLASS, SCRIPT_RACE, SCRIPT_GENERAL, SCRIPT_DEFAULT, DEATHVAR, DIALOG and AREA_SCRIPT

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#17 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 23 February 2007 - 03:12 AM

That's one way to do it, but if you have a script, you should use that instead. Why? Because if you have a good script assigned to the NPC, he or she will actually do more than just swing his sword - use potions, combat tactics and whatnot. If it's a mage, he will cast spells, and so on.

Note that it doesn't applies if your script only says Attack() - that's just the same thing. I'm talking about if you have a good script assigned to the creature.


I agree totally, but it seemed to be he just needed flat out attack. That is why I suggested it, but I agree with you Sebastiaan.


It does get a lot easier, doesn't it? ;)

These are the constants you can use: SCRIPT_OVERRIDE, SCRIPT_CLASS, SCRIPT_RACE, SCRIPT_GENERAL, SCRIPT_DEFAULT, DEATHVAR, DIALOG and AREA_SCRIPT


Hm... I already add all that stuff to the .cre file, not adding it by WeiDU. I know its possible, but I seem to miss the benefit of it. I am sure there is one, but I'm missing it.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#18 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 23 February 2007 - 03:17 AM

Sometimes, you need to add an NPC that isn't going to have a major role in the mod. This NPC might be fine using a template of another CRE, but you want to change his dialogue file/DV/script. This is a quick and easy way to do it without coming up with a completely new CRE.

COPY_EXISTING ~_servan.cre~ ~override/B!MESNGR.cre~
SAY NAME1 ~Temple Messenger~
SAY NAME2 ~Temple Messenger~
//various sound assignments
WRITE_ASCII SCRIPT_OVERRIDE ~B!MESNGR.bcs~
WRITE_ASCII DIALOG ~B!MESNGR.dlg~
WRITE_ASCII DEATHVAR ~B!MESNGR~

It's much easier than making up a new CRE that will be on screen for 30 seconds.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#19 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 23 February 2007 - 03:19 AM

Hm... I already add all that stuff to the .cre file, not adding it by WeiDU. I know its possible, but I seem to miss the benefit of it. I am sure there is one, but I'm missing it.

Personally, I find it way easier to add scripts to a number of creatures by copy/pasting code rather than opening them all up in NI to edit it individually. It's simply faster - especially if you have more than one creature.

It's even more useful when you use COPY_EXISTING, and want to patch creatures instead of adding new ones. (EDIT: Yeh, what BGhead said.)

Edited by SConrad, 23 February 2007 - 03:20 AM.

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#20 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 23 February 2007 - 03:36 AM

Hm... yes, I can see the point. Think I actually have examples where I can use that. Thanks both. As I said there must be an advantage or else you wouldn't make it, just didn't see it, but now I do.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~