AGS: Can I Make an RPG with AGS?

Started by TerranRich, Mon 03/05/2004 05:56:47

Previous topic - Next topic

.M.M.

Yes, it is in game_start. Do you see any other problems?

Gord10

#201
*Cough cough*
I knew I have forgotten something. I forgot giving the news of something.

I had released the source codes (the AGS template, actually) of Asporia: Hidden Threat.
http://dosya.coolbluegames.com/gizlitehdit_kaynak.zip
But it is an old game; doesn't use the new object based AGS scripts.

This could be helpful to the ones who would want to make a RPG with AGS, though.

@Mirek
Maybe the problem is on GUI itself (like its Z coordinate being below any other GUI). Have you tried running this code on somewhere else (like a hotspot code) in order to see whether the problem is the GUI/GUI code itself or the block you use for repeatedly_execute?
Games are art!
My horror game, Self

Dualnames

No trouble using it on AGS 2.72
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ashen

Mirek:
The only problem I have running that as-is (in 2.72), is that there's nothing that stops GI5 being more that GI8, so it just repeatedly levels up until I Alt-X out of the game. But that might be taken care of in another block of code.
You said the problem was gLevelup staying invisible - does that mean everything else (e.g. DisplayTopBar and updating the character stats) runs OK? As Gord said, check the positioning of your GUI, to make sure it's not just hidden behind something, or is off-screen, etc. If it's not running at all, insert some Display commands somewhere (e.g. on_key_press to make sure your GIs are what you think they are (that is, that GI5 actually is greater than GI8 - and remember that it won't currently run if GI5 = GI8).

Slightly off topic, I prefer to use custom variables for this sort of thing. if (exp >= neededexp) is much easier to read, IMO, than if (GetGlobalInt(8 ) < GetGlobalInt (5))

Gord:
Nice, thanks for releasing. Shame it uses old-style code and (going on the tutorial files) the Interation Editor though.
I know what you're thinking ... Don't think that.

.M.M.

#204
QuoteYou said the problem was gLevelup staying invisible - does that mean everything else (e.g. DisplayTopBar and updating the character stats) runs OK?
Yes, everything (except GUI) works well.
QuoteHave you tried running this code on somewhere else (like a hotspot code) in order to see whether the problem is the GUI/GUI code itself or the block you use for repeatedly_execute?
Yes, with hotspot, character and object it works well, so I really don´t know where the problem is.
QuoteI prefer to use custom variables for this sort of thing. if (exp >= neededexp) is much easier to read, IMO, than if (GetGlobalInt(8 ) < GetGlobalInt (5))
I didn´t know if the problem isn´t in bad number of GlobalInt.

[EDIT]: I fixed it now!

beomoud

Hi everyone. This is actually my first post here. I have been working on my first game which is a RPG using 3d models. So far i have completed the character creation, the stat board, the skill tests and i'm currently working on buying and selling but i've run into problems, can anyone help?

I created a second inventory GUI for the MERCHANT who i intend to change his wiew and his trades in each room so that it look like he is a different person. I have assigned BUY and SELL buttons and i want, when you click buy having a Merchant's inventiry item selected to give the player that inventory item, but as soon as he picks it i get a message that the item doesn't exist in the player's inventory (thus i cannot hold it). I haven't so far found a way to assign script on an inventory box click. With selling i have made it so that if you click it the Player's inventory box appears in the place of the Merchan't but haven't gone any further than that. any ideas? I have seen some suggestions as to ssign buttons that give the player an inventory item, but that way i wouldn't be able to just have one GUI and only give the Merchant different goods in each room, i would have to design many GUI's and other than that i get that there must be an easier way. Any thoughts?

(After that i'm going to work on the battle system, any thoughts on how to define the rounds, you know... how to have rounds changing)

Ashen

By default, AGS treats a eModeInteract click on an Inventory Item as 'set this as the Active Inventory' - and you've discovered what happens if you try to set as Active an item the player does't have. The most obvious solutions would be: change the Cursor mode to someting other the eModeInteract (and stop the player being able to change back while the shop GUI is open) or make the Merchant character the player Character while you're in the shop.

Quote
I haven't so far found a way to assign script on an inventory box click

Do a forum search for 'Handle Inventory clicks in script'. The manual is a bit vague, but it's been dealt with enough times that you should be able to find a decent description somewhere. (But just not using eModeInteract is much easier...)
If you've already got 'handle inv clicks in script' checked and didn't realise (e.g. from some template/tutorial), you should be able to edit the on_mouse_click function to react to what GUI is open, so it doesn't generate the error you're getting

Quote
but that way i wouldn't be able to just have one GUI and only give the Merchant different goods in each room, i would have to design many GUI's

Not quite true. You could set up conditions to change the Button graphics before opening the GUI (changing the 'stock' of the store), and within the Button Control functions to sell different items based on some other variable (Room number, Button graphic, etc), so it'd behave in a similar way to using an Inventory window. The Inventory method would be a LOT easier, though...

How to handle changing rounds... There're a couple of fighting game engines available already (e.g this one, Gord's Template a few posts up, or these Coding Contest entries) - they probably won't be exactly what you're after, but they should give you a few ideas.
I know what you're thinking ... Don't think that.

beomoud

I don't mean to tire you with these but it really looks hard to me. I defined a new cursor mode but i still don't seem to be able to get an "Active Inventory" with an inventory click. I run through the post you suggested but i seem to get the same problem as that guy. My code is:

#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else {   // right-click, so cycle cursor
    mouse.SelectNextMode();
  }

if ((button == eMouseLeftInv) && (Mouse.Mode == eModeTrade)) {
player.ActiveInventory=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
character[EGO].AddInventory(player.ActiveInventory);
Mouse.Mode=eModeUseinv;
gStock.Visible = false;
Display ("You got new equipment");
}
}
============================================================

But the conditions never seem to come true (the cursor mode is on trademode by the way)

Ashen

OK, here's the most obvious problem with that code:
Code: ags

player.ActiveInventory=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
character[EGO].AddInventory(player.ActiveInventory);
Mouse.Mode=eModeUseinv;


Remember, you can't set as Active an Item the player doesn't have, which is what you're still trying to do. You need to add the Item THEN set it as active. Try:
Code: ags

Item *Clicked = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
character[EGO].AddInventory(Clicked);
player.ActiveInventory = Clicked;
// Cursor mode automaticaly changed to eModeUseinv when ActiveInventory is set


Also:
* Do you really want to set the newly-added Item as active? You don't have to, to 'select' the Item from the shop, is there some other reason you're doing it?
* Is there no check for "Are you sure you want to buy (whatever)?" (or even whether the player can afford the item)?

There was a Coding Contest about Trading as well, maybe you could get some ideas from there?
I know what you're thinking ... Don't think that.

beomoud

I'm sorry to have bothered you for this but i am a newb and this is my first game, it took me endless hours to find the mistake, but it turns out that one of the reasons was that i hadn't checked on the "handle inv clicks in script" option in the General Settings, it all works fine now, as i said i'm new to this. Anyway thanks for the input.

.M.M.

You don't have to use buttons, you can create new inventory window with script name for example Buy_Sell and in game_start call
Code: ags
 invBuy_Sell.CharacterToUse = cMerchant ; 
and when you need to have another items just use
Code: ags
 cMerchant.AddInventory (iScriptNameOfItem); 
.

ncw14

When i follow the instructions on the tutorial for rpg making it tells me

Error

there is a parse with:

and it tells me that with almost everything i script from instructions

Ashen

We can't really help unless you tell us the exact error message(s), and the line(s) mentioned.
"There is a parse with" doesn't really mean anything, but if you give us examples of the actual errors and code you use, we should be able to tell you where you're going wrong.

Make sure you've checked the manual, BFAQ and search the forum for working code examples before you ask, though.
I know what you're thinking ... Don't think that.

ncw14

#213
Fixed above problem,

3 things though the Gui only says "hp: @SCORE@" and stuff like i made it say but i want it to display the hp or score, i want to be able to display current hp and xp

also In scripting some of commands people type dont work, like Strformat. i have to use Sting.format instead is this cause i have an older version or something.

and last, can i make 2 hotspots with different commands in one area i dont know how

Khris

You need global variables storing hp and xp. Then add a line in repeatedly_execute in the global script:
Code: ags
  status.Text=String.Format("Score: @SCORE@     HP: %d      XP: %d", hp, xp);

In the GUI editor, look up the name of the text label, then use that name instead of "status".

The tutorial is probably for AGS 2.62 and older. String.Format is new code.
If you're using a pre-2.8/3.0 version, uncheck "Enforce object-oriented scripting" in General settings.

You can't make two hotspots in one area, no. How's that supposed to work?
If you want to change the reaction to e.g. interacting the hotspot after the player has done something, use variables.


ncw14

Khris i just did that it says parse error FindGUID line 37

this is line 37

STATUSLINE.Text=String.Format("Score: @SCORE@     HP: %d      XP: %d", hp, xp);}

Khris

You've got to use the name of the label, not the GUI itself. In the GUI editor, click on the label, you should now see the four corners marked with yellow dots. Now check the small properties window for the scriptname.

Btw, this is getting more or less off topic, so if you've got any other general technical questions (as opposed to AGS-RPG-questions), I guess it's better to open a new thread.

firestarrules

can someone tell me how i can put in the script for my guy fighting something else to hit random attack points between 0-5?im making a runescape like game,with a little pokemon,so it would also help if u could also tell me how to make seperate inventorys where i could put the monsters and where i could show my stats.



Thanks!

derboo

I'm trying to create a tile engine for AGS, thought it might fit in here as well.
What i'm doing right now is using a Black background, getting it as a Drawing Surface and use .DrawImage to get the tiles on it. This leaves me with 2 Problems:

1. Is it possible to define walkable areas through the script during runtime in a similar manner? I gave switching walkable areas on and off a thought, but since one is limited to 16 areas per room, that is not an option...

2. If I'm going to load a new black background image for every room, I'll be wasting a lot of space. Is there a possibility to use the same image for multiple backgrounds? Maybe like you use objects' graphics from the game's sprite pool?

Khris

1. No. In my tile engine I use keyboard movement; as soon as the walking direction changes, the boundary of the actual (non-AGS) walkable area is calculated, then the char is moved using WalkStraight(end_x, end_y);
If your character's supposed to be sent around the usual point'n'click way, you have to calculate her path using one of the tons of A* tuts floating around in the net.

2. Why use a new AGS-room for every new game-room? You won't be using room-specific hotspots etc. anyway, right? Create a huge room by importing a, say, 1280 x 800 black pic (uniform black shouldn't waste too much space), then use it all the time.

SMF spam blocked by CleanTalk