Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Creator

#21
Have you created another character in the character editor pane? If you have, you may have put him in the same room and at the same coordinates as the player character.
#22
I don't know why everything would be moving extremely slow, but the thing about your colour changing is normal. I run all my games in 16-bit colour and the desktop colour scheme always changes to the basic setting when the game runs, and then changes back when the game closes.
#23
Sorry, I don't have anything to add, but:
My name! You stole my name!  :o
#24
Similar to steptoe's example, I always have an "End Dialog" option with the code being something like:

Code: ags

@4
EGO: Well, bye.
NPC: See ya.
stop


Khris's example will stop the dialog from running the only remaining option and will, instead, make the player have to choose said option.
#25
Quote from: Monsieur OUXX on Fri 23/09/2011 10:20:00
if you don't want to make your own plugin to address the issue (as Calin suggested), then use the Luags plugin (you can find it in Google). Ready-to-use top notch scripting.

It would make my own module in C++ if I knew how. My programming knowledge is quite basic when it comes to C++. I only did a year and I still struggle with dynamic memory (which was considered easy by my teacher).

The Luags plugin sounds interesting, but I couldn't find it on Google or on these forums (search function is back :D). Could you provide a link?
#26
Oh, right. Fair enough. Thanks for the reply. Pity that. Could make it a whole lot easier. Anyway, I now have the system down to about 4 different functions instead of the 10 I had.
#27
The only thing I can think of is because you set option to to option-off-forever. That means that you'll never be able to turn it on again, even if you ask for it.
Could you post you entire dialog script so we can have a better understanding?

EDIT - Reread your first sentence again. I think you have a conditional "if" script in dialog option one, yeah? Because you set it to eOptionOffForever (option-off-forever), the script will never run again. Firstly because you turned it off, but to make it worse, you turned it off forever which means calling option-on 1 still won't turn it on again. You need to turn option 1 back on to get the "if" to run.
#28
Snarky's method is probably the easiest to do going from what I already have, but I'll try your method first, Khris. Thanks for your help, guys.

I still would like to know why AGS doesn't allow pointers to non-managed types if there's any reason.
#29
I'm trying to create a battle system in my game and, without the ability to declare a pointer to my structure, it's making me have to created a seperate health down function for each character that mine attacks.
Code: ags

void peeps::HitTyler()
{
  if (didHit == true)
  {
    if (double == true)
    {
      Tyler.hp -= this.damage*2;
    }
    else
    {
      Tyler.hp -= this.damage;
    }
  }
}
//And so on for every other character.


Called by:
Code: ags

Blain.HitTyler();


It could be easier if, I could, in my attacking script, have the damage scripts available there.
Code: ags

void peeps::Attack(Character* person, Character* enemy, peeps* attacker, peeps* victim)
{
  //Play attacking animations and sound and show some text.
  victim.hp -= attacker.damage;
}


I've not studied C# much, nor do I know much about programming in general. I've only studied a year of C++ and that was last year. I've done very little programming since then. Is there any reason why AGS doesn't support pointers to custom structures and is there an easier way I can do my battle system (provided I gave you enough code to work with)?

PS. My attacking script is the exact same as I've shown, minus the peeps pointers. It just plays the animation and shows some text. The attacking script is called by
Code: ags

Blain.Attack(cBlain, cTyler);
Tyler.Attack(cTyler, cBlain);


I need the two character pointers in order the get both characters' names, so it shows "Blain attacked Tyler with fireball" and then "Tyler attacked Blain with freeze" and so on.

EDIT - Oh, and before I forget, obviously there's an error if I try to compile with pointers to my structure. It says: Cannot declare pointer to non-managed type.
#30
Quote from: Wyz+ on Sat 03/09/2011 15:15:39
Code: ags

player.AddInventory(iCash);
player.InventoryQuantity[iCash.ID] = 200;


Quote from: Khris on Sat 03/09/2011 17:11:34
The second line alone will do, unless there's on_event stuff happening.

Ah, OK. So there is a built in command to do that, sort of.  :P
Thanks, guys.
#31
Is there a way to add more than one item of the same type to a character? I want to add 3 of the same item to my character and, it seems tedious to write this 3 times.

Code: ags

player.AddInventory(iPotion);


Say I was using an inventory item as cash and wanted to add 200 currency to them. Writing it 200 times would seem tedious.

EDIT - Seems I'm a little slow today. Just as I hit post I remembered loops. The cash problem would be solved easily then.

Code: ags

int x = 0;

while(x != 200)
{
  player.AddInventory(iCash);
  x++;
}
#32
You could also make a function called repeatedly_execute_always in the global or room script. This allows you to have things running even while the game is blocked (like your clock, for example).

Code: ags

function repeatedly_execute_always()
{
  //Clock animation, other stuff, etc.
}
#33
I don't know why it's not changing, but try changing the actual mode instead of the graphic.

Code: ags

mouse.mode = eModePointer;


That's what I always do and I'm pretty sure it's always worked, so you can do that unless there's a specific reason to just change the graphic.
#34
YES! IT WORKS!!! :D

Thank you so much for you help, Wyz. This was driving me absolutely NUTS!
I can put another issue to rest.
#35
Quote from: Wyz on Thu 02/06/2011 17:15:01
Btw I missed a typo earlier: if (hit = 5) should be: if (hit == 5).

Yeah, I noticed that myself. It was the first thing I fixed after writing in your code.

The structure Blain is declared in BattlySystem.ash.
Code: ags

peeps Blain;


The variable are declared in game_start through another function.

Code: ags

//GlobalScript.asc above game_start
function initialisePeeps()
{
Blain.attack = "Punch";
Blain.damage = 30;
Blain.hp = 100;
}

//in game_start
function game_start()
{
initialisePeeps();
}


In repeatedly_execute, I have a label, as I said, that displays the variables, and they display correctly.

Blain.Attack(cBlain, oTyler); gets called at oTyler_Interact in room 305 (my battle room).

EDIT - Also tried doing "Blain.hp--;" in a room script and nothing. However, it works in the GlobalScript (as said in my previous post).
#36
Now I get "BattleSystem.ash(9): Error (line 9): Invalid syntax near 'void'".

Code: ags

struct peeps
{
  int hp;
  String attack;
  int damage;
  
  import void attack(Character* person, Object* enemy);
};


I was supposed to put the function inside the structure, yes?

EDIT - My attack function is identical to yours.

EDIT - Ah, I got it. Because I kept the function Attack with a small 'a' and I already have another variable called 'attack' (a String). I was so confused about it. Thanks Wyz. Without your help, I probably would have murdered my computer quite violently.
;D ;D ;D

EDIT 3 - When I try to run the function

Code: ags

Blain.Attack(cBlain, oTyler);


the game crashes and says "One of the sting arguments supplied is not a string"

Code: ags

//in void peeps::Attack(Character* person, Object* enemy)
Display("%s attacked %s with %s.", person.Name, enemy.Name, this.attack);

If I remove "this.attack" and the last "%s" it works but when checking variables after removing this.attack

Code: ags

Display("%s caused %d damage to %s", person.Name, this.damage*2, enemy.Name);


Blain.damage comes up as 0.

I have a label in the GlobalScript that shows me Blain.attack and Blain.damage and they show up properly.

Code: ags

/in GlobalScript.asc, repeatedly_execute()
lblBlainStats.Text = String.Format("Blain's Stats: Name: %s | Attack: %s | Damage: %d", cBlain.Name, Blain.attack, Blain.damage); //the label in-game shows "Punch" and "30" respectively.


I also wrote another function to double check.
Code: ags

//in BattleSystem.asc, included the import inside the struct in BattleSystem.ash
void peeps::Heal(Character* person)
{
  if (teamHeal > 0)
  {
    this.hp += 20; //doesn't work
    Display("%s healed himself by 20.", person.Name); //does work
    teamHeal--;
  }
  else
  {
    Display("You have no more healing items left.");
  }
}

//-------------------------------------------

//In GlobalScript.asc
if (keycode == eKeyHyphen)
{
  Blain.hp -= 1;
}
  
if (keycode == eKeyPlus)
{
  Blain.hp += 1;
}
//both of these work


Something weird is up. :/
#37
Quote from: Chosim on Wed 01/06/2011 21:19:04
Okay my first question is, must I make a Game in english?

No. You can make a game in any language you want, but you can also make translations for your game.  ;)
The "only English" rule applies to the forums only.
#38
ÃŒs it possible to create a reference to a struct with the ampersand (&) symbol. I tried making a pointer, but it gave me:

Quote
Cannot declare pointer to non-managed type

Basically, I'm creating an RPG type battle system. I created new script files (BattleSystem.asc & BattleSystem.ash) and here is my code:

Code: ags

//in BattleSystem.asc
function attack(Character* person, Object* enemy, peeps& peep)
{
  hit = Random(15);
  Display("%s attacked %s with %s", person.Name, enemy.Name, peep.attack);
  if (hit = 5)
  {
    Display("%s's attack missed!", person.Name);
  }
  else if (hit == 15)
  {
    Display("%s hit, and it was critical!", person.Name);
    Display("%s caused %d damage to %s", person.Name, peep.damage*2, enemy.Name);
  }
  else
  {
    Display("%s hit!", person.Name);
    Display("%s caused %d damage to %s", person.Name, peep.damage, enemy.Name);
  }
}


"peeps" is a structure:

Code: ags

//in BattleSystem.h
struct peeps
{
  int hp;
  String attack;
  int damage;
};

import function attack(Character* person, Object* enemy, peeps& peep);


However, if I try to save the game, it gives me:

Quote
Parse error at '&' //in BattleSystem.ash, where the "import function" line is.

I've created games in C++ before and this is how I passed structures into function paramaters, so, I don't know what to do. :/

I have created actual "objects" from the structure where needed:
Code: ags

peeps Person1;
peeps Person2;
etc...


EDIT - I can now save my game, but compiling gives the same parse error. It's like programming class all over again.  ::)
#39
Quote from: Khris on Mon 30/05/2011 20:36:29
But you can run the game from the editor without debug mode by pressing Strg+F5.

Which would be "Ctrl+F5" on non-German keyboards.  ;)
#40
Dualnames... thank you. :D

Apparantly the final paramater (4th) isn't optional, so I had to set it to true/false. No matter though. Thanks again.
SMF spam blocked by CleanTalk