The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Script begginer, My first script...
egm
post Jan 7 2005, 06:10 PM
Post #1


Eminence Grise Machiavelic
Group Icon

Mod Developer
Posts: 244
Joined: 12-November 04
From: Monthléry




banghead.gif

Here what I want: make a container invisible for everybody unless a thief (or a character with the detect traps skill) detect a special trap. Detecting invisible container should reward XP. I have a container named "Cont01" and a trap "Traps01". i decided to code that in the area script (AREATEST)

Here it is:

QUOTE
IF
  True()
THEN
  RESPONSE #100
ContainerEnable("Cont01",0)
END

IF
  Detected("Traps01")
THEN
  RESPONSE #100
RemoveTraps("Traps01")
ContainerEnable("Cont01",1)
DisplayStringHead("Cont01",XXXXX)//You have detected a secret container!
AddexperienceParty(YYY)
DisplayString((),ZZZZZ)//You win YYY XP
END


Is it correct?
Go to the top of the page
 
Quote Post
Vlasák
post Jan 7 2005, 08:31 PM
Post #2


Mathematical poet


Retired team member
Posts: 159
Joined: 9-July 04
From: Prague, Czech Republic




First: In your first block, you have there True() in triggers. That means that this block is always proceeded. When the block is proceeded, the scripts restarts to its beginning -> you have the infinite loop with this first block. Use there some variable to ensure that the container is disabled only once.

Second: Detected...

0x0054 Detected(O:Object*)
Only for trap scripts. Returns true only if the specified object detected this trap in the last script round.



- detected() can be used only in trap script and with correct object. ([ANYONE], [PC],...)

So I suggest something as:

in area script:

CODE
IF
 Global("ContainerStuff","ARxxxx",0)
THEN
 RESPONSE #100
 ContainerEnable("Cont01",0)
 SetGlobal("ContainerStuff","ARxxxx",1)
END


in trap script:

CODE
IF
 Detected([ANYONE])
 Global("ContainerStuff","ARxxxx",1) //ensure that party got the XP only once and all the stuff is proceeded just once
THEN
 RESPONSE #100
   RemoveTraps("Traps01")
   ContainerEnable("Cont01",1)
   DisplayStringHead("Cont01",XXXXX)//You have detected a secret container!
//I'm not sure whether this works with containers... whether they have any "head" (technically;))) if not, you can simulate it via invisible creature stands near this container and ActionOverride("my_invis",DisplayStringHead(myself,XYZ))
   AddexperienceParty(YYY)
   DisplayString((),ZZZZZ)//You win YYY XP
   SetGlobal("ContainerStuff","ARxxxx",2)
END



This may work... happy.gif

BTW just an addition: AddexperienceParty(N) provides the displaying of "Party gains N XPs" - so dispalystring((),'Party gains N XPs') is not needed after it...


--------------------
Baldur's Gate II add-on CZ - TC from Dalelands
http://addoncz.gamestar.cz

English forums are opened!
Go to the top of the page
 
Quote Post
egm
post Jan 7 2005, 10:00 PM
Post #3


Eminence Grise Machiavelic
Group Icon

Mod Developer
Posts: 244
Joined: 12-November 04
From: Monthléry




okay, I understand,

And for the DisplayStringHead, I think I will display on "LastTrigger" instead

Thanks!!!
Go to the top of the page
 
Quote Post
egm
post Jan 8 2005, 01:09 PM
Post #4


Eminence Grise Machiavelic
Group Icon

Mod Developer
Posts: 244
Joined: 12-November 04
From: Monthléry




Champagne for everybody!!! smoke2.gif

It takes me hours to fully tested and understand how it works, but now its works!!!
Attached File(s)
Attached File  scripttest.png ( 71.89k ) Number of downloads: 4
 
Go to the top of the page
 
Quote Post
egm
post Jan 10 2005, 09:12 AM
Post #5


Eminence Grise Machiavelic
Group Icon

Mod Developer
Posts: 244
Joined: 12-November 04
From: Monthléry




By, the way, it seems that the trigger Detected () isn't triggered by the spell effect: find traps. I mean, when its Yoshimo with its class ability, it works, but when it's Jaheira with a spell, it doesn't.
Go to the top of the page
 
Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 6th June 2025 - 07:14 PM