Jump to content


Photo

Creature Script Vs. Area Script


  • Please log in to reply
12 replies to this topic

#1 LugNut

LugNut
  • Member
  • 9 posts

Posted 13 November 2006 - 05:40 AM

I have been having an issue: I want to have a treant drop it's "HOLDRING" so that it can cease being inert and attack the party. The problem is, no matter how I script it, it will not drop/destroy this item.

I have tried:

DestroyItem("HOLDRING")
ActionOverride(MYSELF,"HOLDRING")
TakeItemReplace("HOLDRING","RING09",MYSELF)

An I have also tried using the creatures death variable in place of MYSELF.

If the creature is frozen still by holdring, will it NOT execute it's own script? I want to toss these treants in several wooded areas and do not want to write different scripts.


LugNut

#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 13 November 2006 - 05:56 AM

How does your code look like? It should be smth like
IF
  HasItem("HOLDRING",Myself)  // <Invalid Strref -1>
THEN
  RESPONSE #100
	DestroyItem("HOLDRING")  // <Invalid Strref -1>
	Continue()
END

Retired from modding.


#3 LugNut

LugNut
  • Member
  • 9 posts

Posted 13 November 2006 - 06:09 AM

It is:

IF
See(PLAYER1)
Global("TreeAttack","LOCALS",0)

THEN
RESPONSE #100
SetGlobal("TreeAttack","LOCALS",1)
DestroyItem("HOLDRING")
Wait(4)
Enemy()
Attack(PLAYER1)

END



I use a similar script to get some statues to come alive in another area. However, I have to use the area script to do an ActionOverride on those creatures in order to lose the ring. I would like to avoid that line of code when doing these guys.

Lug

#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 13 November 2006 - 07:05 AM

Strange. That script works fine when assigned to creature. Maybe you somehow misspelled itemname and script destroys (or rather tries to do it) another, non-existing ring. Or, though it's much less likely, treant can't see player (is blind, for example) due to some effect, which prevents it from firing script.

Edited by GeN1e, 13 November 2006 - 07:11 AM.

Retired from modding.


#5 pro5

pro5
  • Modder
  • 722 posts

Posted 13 November 2006 - 08:23 AM

What effects did you put on that ring? I'm not sure but it's possible that stunned and held creatures stop running their scripts.

In that case yes, use area script instead; or you could use another creature's script.

#6 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 13 November 2006 - 08:45 AM

holdring includes an effect to remove feet circles and I believe that effect also prevents them from running 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.


#7 LugNut

LugNut
  • Member
  • 9 posts

Posted 13 November 2006 - 10:29 AM

Well, I am thining it is more the "Hold Creature" that is doing this. I have stripped the feet-circles themselves with an effect and the script still ran. This is how I first used the Treant, I had him hiding in the dryad area in Irenicus' dungeon. That script worked well, however, the creature's standing movements made him stand out. I am trying to get a more "difficult to see" effect by haging him motionless among the trees and then suddenly come to life and attack. I am certain I can do this with the Area .BCS, I just would like to do it with the .CRE BCS.

If I remember the first level of Watcher's Keep correctly, there is a similar script to what I used for my statues, and it is all ActionOverride to get the "HOLDRING" out of the inventory.

The problem with using an Area script is, how to I trigger the proximity? With the Creature Script, I can use "See([PC])" whereas with the BCS I immagine I would need a trap or trigger to activate it. And since the creature script is not working, I can't use the creature to set the variable.


Any suggestions?


Lug

#8 pro5

pro5
  • Modder
  • 722 posts

Posted 13 November 2006 - 10:50 AM

You can probably use an invisible undetectable creature standing next to your treant and running proximity checks. When checks come true, "animate" the treant and destroy self (i.e. invisible creature).

#9 Sticz

Sticz

    Monkey - In the time of Chimpanzees

  • Member
  • 385 posts

Posted 14 November 2006 - 06:09 AM

I fiddled with this last night, thinking this would be good for statues myself: I could not get the script to fire when the creature was "held". I could make the creature unselectable with a custom ring, but to have the creature totally imobilized... I could not get them to drop the "HOLDRING". Short of adding a trap or invisible creature to the area, I do not know the answer to this one...

If you are in the dryad area of Irenicus'd dungeon you could add variables?

If you kill any of the dryads the tree could come to life via area script.

Or if you talk to any of the dryads... or if you come within range.

You could also use the undetectable trap that summons the golemns to his bedroom.


Just my two copper.


Sticz :cheers:
"For a crazy person, you don't drool much." Complement from Dilbert's Wally.

#10 seanas

seanas
  • Modder
  • 1906 posts

Posted 15 November 2006 - 01:08 AM

the problem here seems to be the HOLDRING and it's associated effects: so why not just give yr treants a different ring and have them drop that? why beat yrself up trying to make the effect with that one item work when you can choose a whole bunch of other items that do similar things to HOLDRING without losing the foot circle and thus making scripts non-functional?

you could choose MINHP1, MONHP1 or SUREHP1, just off the top of my head - or you could create a custom item of yr own that did everything you wanted but didn't have the foot circle issue. there's no reason why you have to use HOLDRING, after all.

"A simple test of the relative merits of science and religion is to compare lighting your house at night by prayer or electricity" - A. C. Grayling
"EFF files have saves, too." - CamDawg
|| this is radio seanas || BP Series v3 || seanas at work ||


#11 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 15 November 2006 - 05:24 AM

Off-topic, but question: with Fixpack's minhp1 fixes, is surehp1 needed any more?

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.


#12 LugNut

LugNut
  • Member
  • 9 posts

Posted 15 November 2006 - 05:54 AM

Unfortunately the effect I am looking for requires all of the attributes of HOLDRING. I need the Treant to be totally unselectable, and lacking all movement. I am wanting him to almost seem part of the area graphics, but then come alive when the PC comes near.

As posted above, this may prove challenging as I do not know exactly how to script a new trap in an existing area with WeiDu. I really am not in favor of the invisible .cre there to perform the actions.


Lug.

#13 Sticz

Sticz

    Monkey - In the time of Chimpanzees

  • Member
  • 385 posts

Posted 15 November 2006 - 07:21 AM

Not sure if this help, I believe it is an old example on how to add traps. Since I couldn't find one aywhere else I saved it for later use. I cannot tell you where I got it because I really dont remember.


I do remember that it had a disclamer about not being very effective, perhaps someone can "prrofread" this or get you a better link:

//******************************************************************
//*Notes:
//* You may use this code for your own mods. Simply change
//* whatever RESREFs you need.
//* Do not change any of the variables that have already been
//* made up, particulary those that alter offsets as it
//* will mess up the area file.
//* If you plan on adding more than one type of header (such as
//* two actors, you'll need to duplicate this code exactly.
//* Of course, you can alter any of the X,Y points to your own decimals.
//* I've only included the most popular changes to headers, so
//* if you need to change the number of times an actor has been
//* spoken to, for example, you'll have to figure out the offset.
//* When adding this code to your own .TP2, do not include these notes or
//* the BEGIN 'How to....' line
//*
//******************************************************************

BEGIN ~How To Add Triggers To ARE files With Weidu.~
//Which File are we going to edit:
COPY_EXISTING ~AR0020.ARE~ ~override/AR0020.ARE~

//Prepare for the area modification.
//---------------------------------DO NOT ALTER FROM HERE TO THE FOLLOWING BREAK.
READ_SHORT ~0x058~ ~#ofActor~
READ_SHORT ~0x054~ ~actorOff~
READ_SHORT ~0x05a~ ~#ofTrigg~
READ_SHORT ~0x05c~ ~triggOff~
READ_SHORT ~0x064~ ~#ofSpawn~
READ_SHORT ~0x060~ ~spawnOff~
READ_SHORT ~0x06c~ ~#ofEntra~
READ_SHORT ~0x068~ ~entraOff~
READ_SHORT ~0x074~ ~#ofConta~
READ_SHORT ~0x070~ ~contaOff~
READ_SHORT ~0x076~ ~#ofItems~
READ_SHORT ~0x078~ ~itemsOff~
READ_SHORT ~0x080~ ~#ofVerti~
READ_SHORT ~0x07c~ ~vertiOff~
READ_SHORT ~0x082~ ~#ofAmbia~
READ_SHORT ~0x084~ ~ambiaOff~
READ_SHORT ~0x08c~ ~#ofVaria~
READ_SHORT ~0x088~ ~variaOff~
READ_SHORT ~0x09c~ ~#ofExplo~
READ_SHORT ~0x0A0~ ~exploOff~
READ_SHORT ~0x0A4~ ~#ofDoors~
READ_SHORT ~0x0A8~ ~doorsOff~
READ_SHORT ~0x0AC~ ~#ofAnima~
READ_SHORT ~0x0B0~ ~animaOff~
READ_SHORT ~0x0B4~ ~#ofTiled~
READ_SHORT ~0x0B8~ ~tiledOff~
READ_SHORT ~0x0BC~ ~songsOff~
READ_SHORT ~0x0C0~ ~restcOff~
READ_SHORT ~0x0C8~ ~#ofAutom~
READ_SHORT ~0x0C4~ ~automOff~
//Increase the number of TRIGGERS and correct the offsets
WRITE_SHORT 0x05a (~%#ofTrigg%~ + 1)
WRITE_SHORT 0x060 (~%spawnOff%~ + 196)
WRITE_SHORT 0x068 (~%entraOff%~ + 196)
WRITE_SHORT 0x070 (~%contaOff%~ + 196)
WRITE_SHORT 0x078 (~%itemsOff%~ + 196)
WRITE_SHORT 0x07c (~%vertiOff%~ + 196)
WRITE_SHORT 0x084 (~%ambiaOff%~ + 196)
WRITE_SHORT 0x088 (~%variaOff%~ + 196)
WRITE_SHORT 0x0A8 (~%doorsOff%~ + 196)
//Complete the prep work by adding a bunch of blank bytes.
INSERT_BYTES (~%triggOff%~ + ~%#ofTrigg%~ * 196) 196
//Prep work is done.
//-----------------------------DO NOT ALTER ANYTHING ABOVE HERE TO THE TOP BREAK.

//Set up the vertices you'll be adding.
WRITE_SHORT 0x080 (~%#ofVerti%~ + 8)
//NOTE: YOU CAN CHANGE THE "8" TO HOWEVER NUMBER OF VERTICES YOU ARE
// ADDING FOR YOUR TRIGGER.
INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 32
//In the above two lines, only change the "32". That numeral should be
//THE NUMBER OF VERTICES YOU'RE ADDING TIMES 4.

//Correct the offsets
WRITE_SHORT 0x0A0 (~%exploOff%~ + 228)
WRITE_SHORT 0x0B0 (~%animaOff%~ + 228)
WRITE_SHORT 0x0B8 (~%tiledOff%~ + 228)
WRITE_SHORT 0x0BC (~%songsOff%~ + 228)
WRITE_SHORT 0x0C0 (~%restcOff%~ + 228)
WRITE_SHORT 0x0C4 (~%automOff%~ + 228)
//IN THE ABOVE SECTION, THE "228"s CAN BE CHANGED.
//IT SHOULD BE (196 + (~#newVertices~ * 4)), so this example adds 8 vertices.
//196 + 8*4 = 228.


//-------------------------------------INSERT SPECIFICS BELOW.
//Now, you can start adding in the actual code for whatever you are inserting.

//Name
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196) ~Your_New~
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 8) ~Trigger1~
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 16) ~~
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 24) ~~

//Trigger Type
WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 32) 01
//01=Info
//02=Travel
//03=Proximity

//Trigger Icon
WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 52) 22
//22=Info Question Mark
//28=Inside Exit (stair)
//30=Outside Exit (door)

//Destination Area RESREF
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 56) ~~

//Exit point
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 64) ~~

//Flags:
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 96) 04
//04=Party Required

//Trigger Text
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 100) 5185
//Replace the "5185" with your chosen dialog string for Info Points.
//You can use SAY here, just replace "WRITE_LONG" with "SAY" and "5185" with "@#"

//Trap Detection %
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 104) 00

//Trap Removal %
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 106) 00

//Is Trapped Flag
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 108) 00
//0=no
//1=yes

//Trap Already Detected Flag
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 110) 00
//same as above?

//Trap Location:
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 112) 244
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 114) 746

//Key Type
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 116) ~~

//Associated Script
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 124) ~~

//Associated Dialog
WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 188) ~~

//Now, we've got to set up the vertices. I suggest you use IETME to make the graphical
// representation, then view the numbers with NI
//bounding box:
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 34) 568
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 36) 175
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 38) 676
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 40) 337
//CHANGE YOUR POINTS TO THE BOUNDING BOX.
//#vertices
WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 42) 8
//CHANGE THE "8" TO HOWEVER NUMBER OF NEW VERTICES YOU'LL BE ADDING.
//vertex index
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 44) ~%#ofVerti%~

//Now, write the new vertices.
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 589
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 2) 332
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 4) 568
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 6) 235
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 8) 587
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 10) 189
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 12) 620
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 14) 174
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 16) 667
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 18) 182
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 20) 676
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 22) 217
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 24) 661
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 26) 337
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 28) 589
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 30) 332
//Of course, you can alter the points above to match your trigger
//as well as add new points, AS LONG AS EVERYTHING FOLLOWS THE PATTERN!


Enjoy,


Sticz
"For a crazy person, you don't drool much." Complement from Dilbert's Wally.