Item Hotspots and Scripting

Started by FinalSin, Sun 27/06/2004 18:45:57

Previous topic - Next topic

FinalSin

Two questions, nice and simple.

1. Where is the best place to start learning AGS scripting from the very bottom up.
2. How do I change the area of an item that is used to 'click' on hotspots in the game. At the moment, it defaults to the middle of the item, and I can make a cute little cross there, but I'd rather it was the top left. Is it possible to change it, I can't find it in the manual...
The Blue Casket

Darth Mandarb

Quote from: FinalSin on Sun 27/06/2004 18:45:571. Where is the best place to start learning AGS scripting from the very bottom up.
Download DemoQuest and pick it apart ... it's how I learned.Ã,  And always keep the manual open for quick reference.Ã,  And, of course, don't forget the forums!!Ã,  (Just make sure you've checked the other sources (and searched the forums) before starting a thread!)

Quote from: FinalSin on Sun 27/06/2004 18:45:572. How do I change the area of an item that is used to 'click' on hotspots in the game. At the moment, it defaults to the middle of the item, and I can make a cute little cross there, but I'd rather it was the top left. Is it possible to change it, I can't find it in the manual...
If you're talking about the hotspots of the individual cursors, you just click on the image of the cursor (in the cursor section of the editor) to change the little hotspot!Ã,  (right below where it says 'Click on image to change' ;))

strazer

#2
1. The official AGS scripting tutorial
It's also in the manual I believe, but I like the HTML version better.

FinalSin

Thanks, guys, wonderful. Also, sorry to Darth for the obvious question about dual characters.... ahem  ;D

Can I ask another question? I've just been fiddling with some conditions, and I need a certain sequence to be conditional - if the player has an inventory item, run *this* and if he doesn't have it, run *this*.

Is there a way to attach a 'Condition - Player Does Not Have Inventory Item' without scripting?
The Blue Casket

Barbarian

You can set conditional/varibles using a room's "Interaction" button, the same goes for HotSpots, Objects, etc.

So, for example, let's say in your game you have the character push a switch (Using a HotSpot as a switch for an example), you select your HotSpot in the room editor, click on the "Interaction" button, then select: "Interact hotspot" then right-click on that and select "New action" then "Game - set variable value", then for "Where" click the "Change" button, then select "Variable" then "Edit variable" then "New variable" then type in your varibale name, for this example we use "push", then "Ok" and select for the Global option and hightlight "push", then "Ok". By default, a new variable is a value of zero: 0, so you can now change it to "New Value" then "Value" then "1".

Now let say you walk onto a Region in front of a door, to check a for the "push" varible value.
So, from the region, click "Interaction" button, then "Player walks onto region" then right-click then "New action" then "Conditional - if a variable is set to a certain value" and "varible" = "push" and "value" = "1" then you can have something happen, such as a door opening automatically or whatever you want to program to happen.

There's also command from the "Interaction" editors to check if a certain inventory item was used as well:
"Conditional - if inventory item was used" then you select the number of the inventory item you want to check for.
Maybe that's more what you're looking for?

Bah, sorry, it's late here, I need some sleep now, so if my explaination's a bit confusing I apologise. Hope it maybe helped a bit though. Read through the manual, tutorials, see the help-contents of the game, etc. You'll get the hang of it. Just experiment for a while and have some fun with it.

Good luck.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

FinalSin

Um... lovely as it is, and I can see what you're trying to explain to me here, can someone make it a bit simpler? Let me explain the whole conundrum.

There is a door.
If there person has a knife, he can leave. That's easy - "Conditional - If Player has Inventory Item (5)"
HOWEVER
If he doesn't have the knife, I want to display a message and not let him leave.

Is this possible?
The Blue Casket

TerranRich

Condition - If player has inventory item (5)
-----  (Whatever happens when player has knife)
-----  Stop running commands (forgot the exact phrase)
(Whatever happens when player doesn't have knife)

That's it.
Status: Trying to come up with some ideas...

LordHart

#7
I think it's best to write out the scripting yourself, that way, you teach yourself the basic of what the interaction editor does anyway. Now, for the little thingy about the knife... say you want the character to use the interact icon on the door to open it, and go through. It will check to see if he has the knife (which we will use the number 5 for as an inventory item)...

Heres what you would do:

Interact with hotspot - (select Run Script):
if ((character[EGO].inv[5]) == 1) { //if the player has the knife...
  DisplaySpeech(EGO, "I guess I have the knife... I'll go into the door.");
  NewRoom(2); //whatever room you want, or anything else to go here...
} else { //if the player doesn't have the knife, then it does this...
  DisplaySpeech(EGO, "I don't have the knife... I can't go into the door.");
}
Its quite an easy language to learn once you know the basic... hell, I only started really getting into it myself a few months ago.

FinalSin

The Blue Casket

SMF spam blocked by CleanTalk