Jump to content


Photo

Making an NPC go hostile and attack


  • Please log in to reply
11 replies to this topic

#1 Blitz

Blitz

    Tabby Master

  • Member
  • 337 posts

Posted 22 November 2004 - 01:03 PM

How do I make a group of NPCs go hostile and attack the party?
I'm kind of confused on that subject...

#2 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 22 November 2004 - 01:28 PM

ActionOverride("scriptname",Enemy())

The actual fighting and spellcasting and whatnot should be handled by their scripts.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#3 Blitz

Blitz

    Tabby Master

  • Member
  • 337 posts

Posted 22 November 2004 - 01:31 PM

ActionOverride("scriptname",Enemy())

The actual fighting and spellcasting and whatnot should be handled by their scripts.

View Post


Will this cause the entire group to go hostile, or just one of the soon-to-be enemies?

#4 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 22 November 2004 - 01:31 PM

One 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


#5 Blitz

Blitz

    Tabby Master

  • Member
  • 337 posts

Posted 22 November 2004 - 01:47 PM

How do I get all nearby soon-to-be enemies to go hostile? Do I make a seperate script for each one?

#6 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 22 November 2004 - 01:53 PM

Just group them together in a DO action or in a script block:

ActionOverride("creature1",Enemy())
ActionOverride("creature2",Enemy())
ActionOverride("creature3",Enemy())
ActionOverride("creature4",Enemy())

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#7 Potencius

Potencius
  • Member
  • 114 posts

Posted 22 November 2004 - 02:15 PM

If they have the same death variables, you'll be better off setting a global.

SetGlobal("GoHostile","MYAREA",1) in the dialog.

IF
Global("GoHostile","MYAREA",1)
!Allegiance(Myself,ENEMY)
THEN
RESPONSE #100
Enemy()
END
The Glory of Istar - A Dragonlance Total Conversion

I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. - Umberto Eco

The truth of #meeting:
KenTeamBG: a/s/l
Deano: 14/f/in ur heart
* KenTeamBG it's getting hot so i remove my jacket
Daxziz: Oooh
* Echon, MaxTeamBG and Hlidskialf all get naked.
* SimDing0 has joined #meeting
SimDing0: Eew.
* SimDing0 has left #meeting
* KenTeamBG sets mode: +b SimDing0

#8 Blitz

Blitz

    Tabby Master

  • Member
  • 337 posts

Posted 23 November 2004 - 04:06 PM

I'll try dawg's method.

IF
Global("GoHostile","AR0400",1)
THEN
RESPONSE #100
ActionOverride("r#knive",Enemy())
ActionOverride("r#knive",Enemy())
ActionOverride("r#knive",Enemy())
ActionOverride("r#knive",Enemy())
ActionOverride("r#knive",Enemy())
ActionOverride("r#sven",Enemy())
END

Does that look alright?

I couldn't get Potencius' to work, sorry.

Edited by Blitz, 23 November 2004 - 04:20 PM.


#9 Blitz

Blitz

    Tabby Master

  • Member
  • 337 posts

Posted 23 November 2004 - 04:31 PM

That didn't work, but this KINDA did.


ActionOverride("NKNIVE",Enemy())
ActionOverride("NKNIVER",Enemy())
ActionOverride("NKNIVER",Enemy())
ActionOverride("NKNIVER",Enemy())


I used this (surronding code not shown, but don't worry, it worked)

I have three "copies" of an NPC fighter with death variable KNIVER and one captain with KNIVE.

This made the captain and only one fighter go hostile.

What did I do wrong? Perhaps I misunderstood your instructions?

#10 neriana

neriana
  • Member
  • 139 posts

Posted 23 November 2004 - 05:59 PM

That didn't work, but this KINDA did.


ActionOverride("NKNIVE",Enemy()) 
ActionOverride("NKNIVER",Enemy())
ActionOverride("NKNIVER",Enemy())
ActionOverride("NKNIVER",Enemy())


I used this (surronding code not shown, but don't worry, it worked)

I have three "copies" of an NPC fighter with death variable KNIVER and one captain with KNIVE.

This made the captain and only one fighter go hostile.

What did I do wrong? Perhaps I misunderstood your instructions?

View Post

Change the death variables of the fighters to NKNIVER1, NKNIVER2, and NKNIVER3, and change the Enemy() code accordingly. It should work then. Right now, the game is just referencing the same .cre three times.

#11 Sillara

Sillara

    He made me love him without looking at me.

  • Member
  • 537 posts

Posted 23 November 2004 - 07:13 PM

I find it easiest, when dealing with a pack of identical .cre enemies and a leader, to set a global in the dialogue, something like this:

~Blah, blah. Let's fight.~
IF ~~ THEN DO ~SetGlobal("LetsFight","GLOBAL",1)~
EXIT
END

Then, I make a .baf and assign it to the little goons' .cre. In that .baf file, it would say something like this:

IF
Global("LetsFight","GLOBAL",1)
Global("FightOn","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("FightOn","LOCALS",1)
Enemy()
END


This allows other scripts to check for the LetsFight Global to be 1. You can either make the leader an enemy in the dialogue or add a similar block of code to his .baf.

Sillara

P.S. Sorry if that was just confusing rather than helpful. :unsure:
Check out my RPG forum!

#12 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 23 November 2004 - 07:26 PM

Yeah, multiple creatures with identical DVs is generally not good practice. Either rename them using neriana's suggestion or use Sillara's.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.