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 - lafouine88

#81
Hi guys, some more RPG issues here :) This is more of a logical/structural question than coding I guess.

I've been struggling dor the past two weeks with a good looting system, meaning something flexible and not to greedy in ressource (I don't want to create 300 Invitems).
So basically this was my idea (I'll try not make it simple but can be more accurate if needed):

30 inventoryitems with no sprites or anyhting else, kind of the matter that would embody the different items (in the example lets say it correponds to 5 max equipped item+15 max items in the bag+5 max loot items+5 extras)

1 struct of arrays
Code: ags
Struct loot{
int sprite;
String Nameitem;
int bonus;
...
}
describing the icon,name etc of all the items. This one on the other hand could be big since I guess it doesn't take too much memory, say 200 different items (this is ambitious "^^).
so we have for instance :
loot[1].sprite=1;              loot[2].sprite=2;
loot[1].Nameitem=Blade;        loot[2].Nameitem=Shield;
loot[1].bonus=5;               loot[2].bonus=3;
....

So far I guess it's quite clear. Now this is where it becomes confused, and not so good :
Ennemies are defined with the same method
Code: ags
  ennemis[k].HP=200;
//...
and I added these lines
Code: ags
    ennemis[k].loot1=0;
  ennemis[k].loot2=0;
  ennemis[k].loot3=0;
  ennemis[k].loot4=0;
  ennemis[k].loot5=0;
  ennemis[k].baseloot=0;

Then,at map load, I attribute the loot to the different mobs with a function randomingly giving them the items with given probabilities.
Code: ags
attribuloot(k, 40,60, 100, 20, 20); //-->so 40% to have item1, 60% to have item 2...

So when the map is loaded, each munster has something like this :
ennemi[0].loot1=0;          ennemi[1].loot1=0;    ... 
ennemi[0].loot2=1;          ennemi[1].loot1=0;
ennemi[0].loot3=0;          ennemi[1].loot1=1;    ...
ennemi[0].loot4=0;          ennemi[1].loot1=1;
ennemi[0].loot5=1;          ennemi[1].loot1=0;

Anf finally when I loot the monster another function gives the image and attributes to the invitem based on the loot struct:(this becomes really messy :s)

Code: ags
  function Loot_attribution(Character*corps, int l){
    //l number of first loot item
//inventaireused is a global int to keep track of the number of inventory items I've used.
    nmobjets=ennemis[corps.ID].loot1+ennemis[corps.ID].loot2+ennemis[corps.ID].loot3+ennemis[corps.ID].loot4+ennemis[corps.ID].loot5;//how many more inv items are we using
   if(ennemis[corps.ID].loot1==1){
  corps.AddInventory(inventory[inventaireused]);//adds the next unused item inventory to the mob
   inventaireused++;
   inventory[inventaireused].Graphic=butin[l].sprite;    //gives the attributes
   inventory[inventaireused].CursorGraphic=butin[l].sprite;
   Lblloot1.Text= String.Format("%s",butin[l].Nomobjet);    //this label is next to the item to display its name
   Lblloot1.TextColor=butin[l].couleur;
   Lblloot1.Visible=true;
   }
      if(ennemis[corps.ID].loot2==1){
        corps.AddInventory(inventory[inventaireused]);
   inventaireused++;
//and same fo the 4 other items

In clear, each type of monster could carry a maximum of 5 items, and for each monster all 5 items must be defined each time, this is what the 'l' variable is here for-->monster type1 can loot loot[0],loot[1],loot[2],loot[3],loot[4] (l==0).monster2 can loot loot[5]...loot[9](l==5) etc. This is particularly bad because if i want monster1 to be able to carry loot[6] I must define this item twice, more if I want this item to be carried by more monsters. It seems like a huge waste of space...

Besides the whole thing is actually extremely heavy to manipulate and I start to get lost when I want to add items descriptions or some kind of icon overlay when the mouse is over it. When I started to make the items pickable this became nuts and I realized there might be some easier way to do this. problem is that now my mind is stuck on this idea and I can't find anything else X3

Would some of you have some suggestions I could use? I can give more details if needed but I feel like I've already given too many and lost most of you "^^

Thanks

#82
Thanks Kris, it's much easier like that :)
#83
Hey guys

I would like to create a targeting function, like when I left click on the character (on any map) he gets selected (and thus appropriate lifebars etc. can appear). Sounds easy, yet I can't find the right way.

I came up with something like that ('Target' is a Character GlobalVar to identify the right character), it sounded promising.
Code: ags
function on_mouse_click(MouseButton button)
{

    if(button==eMouseLeft){
      
            if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter)
      {
        Room.ProcessClick(mouse.x,mouse.y, eModeLookat);//----------and in character1.lookAt it goes "Target=Character1"
       LblEnnemyname.Text=String.Format("%s", ennemis[Target.ID-3].Nameennemy);//---so the lifebar displays the right name of the target contained in the struct 'ennemis'

      }
//...

but this does'nt work, for some reason the function seems to skip the 'room.process' which creates the Target variable, and goes straight to the next lines (which creates a problem because the target is'nt identified)

Any ideas? I can be more specific if needed.
Thanks a lot :)

EDIT : Writing it gave me the answer, I just needed to put the function in the lookat section rather than in the global script, this way it doesn't skip the interaction and it works fine now :)
#84
Thanks a lot for the advice. I ll try to make things as clean as possible and post again once I ve figured it put. Could be helpful for others
#86
Thanks guys.
 I've never used dynamic sprites but I'll definitely take a look at that, it seems very promising. I'll give this topic an update once I've figured out an easy way to use them.
 Otherwise I ll stick to the limb by limb method trying to arrange things as much as possible🙂
As crimson says I m still preparing things before getting into it but I m really excited about this possibility.

Please leave the topic open,I ll add things on it as they arrive, that way maybe we can have a similar topic to the rpg one

Thanks again and See you later👍
#87
Hi crimson, thanks for the quick reply
Ok so I didn't know about overlays(still working on 3.5) but i ll check it. I'm definitely more atracted to using characters than objects (unlimited and moveable easily).
Though, if I guess for mere walking the follow instruction could work out with a 0 tikerance and stick to the other parts, I can't figure how you would do for striking actions. Over the top of my head I'm thinking something like :

///on mouse click
Cbody.setview(1);
cbody.animate(0,5,eOnce,eNoBlock);

Chead.setview(2);
chead.animate(0,5,eOnce,eNoBlock);

Crightarm.setview(3);
crightarm.animate(0,5,eOnce,eNoBlock);
....

but that seems very tedious. Especially if I'm gonna repeat that in the repeatedly execute function
-->
if(cbody.animating==false&&cbody.view==1){
cbody.unlockview();
}
if(chead...)
...

Again I understand that ags is not designed for such things so I'm prepared to do a lot of tedious coding for that project, but still, any time I could spare is good to take :)

Thanks
#88
Hey guys!

Like so many before me, I want to push my ags creations a bit further and I am thinking of adding some diablo2-like hack and slash actions in it(why teleport from one place to the other when you can walk killing monsters😅?)

I ve read many things about rpg games but this question still isn t clear so far: how to organize things so that switching equipment can be visible? Meaning that if you equip an axe instead of a sword this shows on screen?

Creating views for every combination is out of the question since that makes the possibilities exponential.

 I found on the rpg topic something about singling out every limb (head,arms etc.) By using different characters using follow(0) the body. I haven t tried it yet since I don t have ags with me at the moment but it seems a bit weird.

Since the conversation was outdated I m mainly looking for an update on this, do you think this is the best option? Any ideas what else could be done?

One last thing, say this is the way, how would you arrange priority for limbs(the arm gets in front of the head...? Maybe there is no priority,just "holes" in the sprites?

Thanks a lot and sorry I ve been a bit long😅
#89
Ok thanks everybody.
It's weird what you say crimson because as i said earlier the hd vid full screen video does work, but it's smooth only on a good computer.
But I ll try to downgrade the quality a bit and see if it's more acceptable.

By the way,can you confirm that ffmpegtheora doesnt work anymore? I would have liked to try converting with it.
#90
Hi. Résolutionid 1920*1080. As i said,i did the video on adobe so it's quite high quality,abd even with h264 compression it's a heavy file.
#91
Hey guys
I'm facing problems with my intro and ending cinematic. Both of them are pretty heavy since I used good video quality (made with adobe suite).

The first one was around 150Mb in mpeg, then converted to 45Mb in OGV (using Xmediarecode)
Second one 720Mb converted to 120 Mb

Problem is, even with the ogv compression it still seems to be to much for the engine to display it properly. It actually works fine on my computer (which is a recent one) but on an older one it freezes and slows down a lot. Which is a problem because my 320*200 game is supposed to be working on any lousy computer.

Any hints? I tried to use ffmpeg2theora but it doesn't seem to work anymore(unless I didn't understand how it's supposed to work). Are there CODECS that need to be installed that I don't know about ?Any other idea?
Or do I have to reduce the quality of the video ? In which case, what would be an acceptable size for the video to play without problems ?

Thanks in advance for your help, my deadline is friday night and I'm a bit worried about this cinematic ruining the whole first impression :s
#92
You're so right snarky. This was waaaaay better than the limited eKeyCodes!
Thanks a lot :)
#93
Hi guys, I'm not really sure this is really the best way to ask but I did'nt want to create a new topic for such a stupid question.

I'm trying to apply keycodes, but I can't find on the manual (and I think I tried most of them one by one) the keycode for the 2 key, the one that is not on the keypad. Since my keyboard is a french one I guess the signs are not the same but from what I found it's supposed to be either ~ or é, or sometimes @. But none of them works.

So sorry again but I 've been postponing this resolution for a while now and the deadline for my games starts to loom ahead.

Thanks
#94
Actually after trying a bit, this locked-on system is pretty cool. So thanks a million for your help  :-D
One last thing, I changed the line 7 of late repeatedly execute :
Code: ags

Mouse.SetPosition(mouse.X,  mouse.Y); // locks the cursor position 


That way it just blocked the mouse cursor where it was.

->SOLVED
#95
Hi guys

Thanks a lot for your answers. I didn't know about the "do/while" thing. I've never used "do" actually^^ So thanks arjon and crimson for the debate :)

Matti I tried your code and that is what I wanted and tried to do but wasn't able to code properly :s.
It works very fine(juste needs to add "Charge_Counter=0; after line 14 of repetedly execute, and gChargeBarGUI.Width=1; after line 6 of "anyclick"). The cursor doesn't stay locked on the enemy and I don't really know how "late repetedly execute always" works. But after thinking about it I guess I'll leave the possibility of moving the mouse and charging "anywhere" but the damage will be dealt only if the cursor is on the monster when the bar is finished casting. If this is harder than I thought, maybe I'll come back "^^

Thanks again to everybody :)

EDIT : Locking the cursor does work, it just didn't because my monster's ID was 0, I guess because on other monsters it's ok.
#96
Hi again :)

Ideally, I want the player to click on the target and stay blocked on it( so no hovering out and in, but I think that will be a bit hard, so maybe just when you release the button, in the end).
Exactly as you said, you hold down the right button until the bar fills (I used an animation but it can be a gui too I guess, although I didn't manage to make it work), and the damage deals only when you release the button and the cursor is still on the target. it can be interupted any time but then no damage is dealt.
As for the animation, I thought the animation starts when you hold the bar and finishes naturally when the bar is full..can be interrupted too

Which makes me think...maybe I should simply use a timer. I'll try this :)

Thanks again
#97
Hey Matti, thanks for you help.

I tried your trick but it behaves the same way as when I used a bool that triggered only at the end of cast animation. It seems it checks if the conditions are filled at the moment you click. It does not take into account the button kept down.

Another idea I just tried was this :
Code: ags

int chan=0; ///on top
//.......
else if(mouse.IsButtonDown(eMouseRight)){    ///////////pretty much the same but damage is 3* higher   [RIGHTCLICKLINE]
if(chan==40){                       ///////time checker, supposed to work according to the guide
  shoot(3.0*damageplayer, armorMonster);
 Monsterdamagedisplay(IntToFloat(finaldamage));
chan=0;}
else{chan++;}
}


I was really optimistic about that but it did'nt work out and I don't know why :/
#98
Hey guys

I'm having trouble with the RPG phase of my game. Basically you can shoot the monsters using the mouse, left click is immediate shooting, right click is a long channelled shot.
And this is where I have difficulties...

So my system is probably veeeery unclean but so far it worked, here goes the system.

Code: ags
function on_mouse_click(MouseButton button)
{ 

     if (button == eMouseLeft)
{
    Room.ProcessClick(mouse.x,mouse.y, eModePickup);
  player.LockView(110);
  player.Animate(7, 1, eOnce, eBlock);        ///////////shooting animation
 player.UnlockView();   
}
else if(button==eMouseRight){
      Room.ProcessClick(mouse.x,mouse.y, eModePickup);
      oCast.Visible=true;
      oCast.SetView(117);
      oCast.Animate(1, 1, eOnce, eNoBlock);     ///////////////a castbar animation that fills itself (wow style)
    player.LockView(15);
  player.Animate(12, 20, eOnce, eNoBlock); //////////////the charged shooting animation    
}  
}


Then on the monster, I put an "anyclick" function :

Code: ags
function oMonster_AnyClick()             
{
if(mouse.IsButtonDown(eMouseLeft)){
  shoot(damageplayer, armorMonster);            ////////////goes to a shooting function that calculates the damage dealt according to armor...named "finaldamage"
 Monsterdamagedisplay(IntToFloat(finaldamage));          ///////////display function of the damage
 
}
else if(mouse.IsButtonDown(eMouseRight)){    ///////////pretty much the same but damage is 3* higher   [RIGHTCLICKLINE]
  shoot(3.0*damageplayer, armorMonster);
 Monsterdamagedisplay(IntToFloat(finaldamage));
}
 
}


That is all is needed I guess. I added a bunch of repetedly execute conditions to remove the castbar and unlock the player's view when he's done channeling. That's no problem and I don't think it's necessary to add the codes here.

So the problem is : How to add the condition to wait for the channel bar to be full before applying the damage?

I thought of adding a bool when the channel bar is full and added the condition (&&bool==true)in [RIGHTCLICKLINE], that would turn off when right clicking, but it does'nt work as planned. It applies the damage before waiting for the bar to be filled.

I don't know if all of this is very clear so I'm not going to add too many details. Maybe one of you already used this system and can help out ? I'm running out of ideas here.

Thanks a lot :)
#99
1)...very simple and clever😛

2)I don't know why I didn't see this one. I only saw "displayat"

Thanks a million,have a good day

#100
Hey guys
I'm facing 2 small issues about dialogs, does'nt seem so hard, maybe someone could help me :)

1) For one cutscene, I'm using a fade out. Then I want something to be said during the black screen, and then it comes back to normal with fade in. Problem is, when it's faded out, dialogs don't show. Any trick to handle this?
->I want to avoid moving the character to a blank room because I have a lot of roomloads/room first loads etc. that could create potential bigger issues since I didn't have this in mind when I created them. If it's possible I would reaaly prefer to stick to the room I'm in,"turn the lights out" with a fade, say the line(with audio speech) and then turn the light back on.

2)I'm playing 2 characters with an icon to switch from one another (DOTT style). Sometimes, they still talk to each other(even though they never are in the same room). But the lines of the charcater that is not being played (he's on a different map) appear above his current position on the map, which is pretty random. I would like to have the lines of the "absent" character always being displayed on top of the screen, and centered. Again, it's a detail but would add some accuracy to my game.

Thanks a lot again :)
SMF spam blocked by CleanTalk