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 - The creature

#21
I'll check out the module CW. it might make things more manageable as I'll need a lot of timers for different NPC's going about.

X
#22
Thanks, that works great Laura. Looking at the code it makes perfect sense but it's not something I'd have figured out myself.

So thank you again 💖
#23
Ok, I may need a little help as this isn't going well haha

Code: ags
// room script file
function room_AfterFadeIn()
{
  SetTimer(1, 200);
}


function room_RepExec()
{ 
  if (!cMan1.Moving)
  {
    if (IsTimerExpired(1) && cMan1.x==327)
    {
      cMan1.Walk(564, 372, eNoBlock, eWalkableAreas);
      cMan1.FaceDirection(eDirectionUp, eNoBlock);
      SetTimer(1, 200);
    }
    if (IsTimerExpired(1) && cMan1.x==564)
    {
      cMan1.Walk(418, 406, eNoBlock, eWalkableAreas);
      cMan1.FaceCharacter(cFemale4, eNoBlock);
      cFemale4.FaceCharacter(cMan1, eNoBlock);
      SetTimer(1, 240);
    }
    if (IsTimerExpired(1) && cMan1.x==418)
    {
      cMan1.Walk(563, 372, eNoBlock, eWalkableAreas);
      cMan1.FaceDirection(eDirectionUp, eNoBlock);
      SetTimer(1, 240);
    }
    if (IsTimerExpired(1) && cMan1.x==563) //Start Location
    {
      cMan1.Walk(327, 487, eNoBlock, eWalkableAreas);
      cMan1.FaceDirection(eDirectionDown, eNoBlock);
      SetTimer(1, 240);
    }
  }
}


That's what I have in my room script, it's probably terrible but I'm no coder....and as predicted my NPC is doing some odd things.
#24
Thanks guys, I don't need to see any code, I was just curious if there were different ways. Timers will suffice  (nod)

Cheers
#25
Hi all

I'm wanting NPC characters to walk around in the background, wait for a little while and then move to a new point. I was wandering if there is Wait(#) but a wait that doesn't block. Or would I require timers? I'm just asking because I can't find anything in the manual but could just be searching for the wrong thing...

Would would be the best practice??
#26
And that's why coding at 3am is a bad idea....

Thank you CW <3

I'm using this a lot of times so I thought it would be wise to capture the distance amount:

Code: ags
function SearchSpot_Reveal(float distance)
{
  float Dist=distance;
  
  float x1 = IntToFloat(player.x - cSearchSpot1.x);
  float y1 = IntToFloat(player.y - cSearchSpot1.y);
  float dist1 = Maths.Sqrt(x1*x1 + y1*y1);
  if (dist1 < Dist)
  {
    cSearchSpot1.Clickable=true;
    cSearchSpot1.Transparency=0;
  }
   if (dist1 > Dist)
  {
    cSearchSpot1.Clickable=false;
    cSearchSpot1.Transparency=100;
  }


Works great
#27
I have been busy so, only just been able to get on and try this....and I do apologise for my ineptness in simple coding...but I can not seem to get it to work :(

function room_RepExec()
{
  float x = IntToFloat(player.x - oTest.Y);
  float y = IntToFloat(player.y - oTest.X);
  float dist = Maths.Sqrt(x*x + y*y);
  if (dist < 4.0)
  {
    oTest.Visible=true;
  }
}

I don't seem to produce any errors but when I stand by the object it doesn't appear :( I was actually also thinking of switching to characters for the objects as I'll need so many (that should be easy enough to do once the script is working). Do you have any ideas why it might not be working? :(
#28
I'm using regions for other things actually, otherwise that would be a good option otherwise.

I tried your code CW and I'm getting a mismatch: cannot convert 'int' to 'float' error?

Code: ags
function room_RepExec()
{
  float dist = Maths.Sqrt((player.x - oTest.X)*(player.x - oTest.X) + (player.y - oTest.Y)*(player.y - oTest.Y));
  if (dist < 30.0) 
     {
      oTest.Visible=true;
      }
}


I'm sure it's me and I just dont quite understand the usage of the formula.

#29
Hi

I'm a bit stuck with something that I know is probably easy. I want an object to become visible when the players gets within a set distance of it. Googling it, someone did ask a similar question and presented their code:

Code: ags
  if (player.x - oTest.X <30 && player.y - oTest.Y <30)
  {
    oTest.Visible=true;
  }
  else oTest.Visible=false;


The problem is it doesn't really work, if he player is obviously approaching from the left side of the object it will be visible. Is there something simple I'm missing, or is this more complicated?

Kind Regards
C
#30
Does anyone have an experience working with this module?

As I don't have the example demo project I'm not sure how to initialise the function. I essentially want to create shoals of fish and have my test fish spite (350) but thats about it.

In my Room Load I created my initial variable: SteeringBehaviors Fish();  but I'm not sure what I need to do, the documentation is quite scary that comes with the script files.

I know there is this function:
Code: ags
function boid_set_boid (int flock, int boid, enBoidType type, float mass,  int graphic = -1,
                          int view = -1, enViewType view_type = vtNone, bool rotate = false);


But, the predictive text for the code soesnt seem to find the function so I'm not sure what I'm really doing.

Any help is greatly appreciated :(

TC
#31
Does anyone still have this module and example ags file? The download links are missing the files?

That would be great.

TC
#32
Is this too complex to fix with the latest version of the AGS Engine?

I'm just wondering because if it is, I will start transferring everything over to the previous 3.4.0 - as I know the script works fine in that version (even if it shouldn't).


SCRATCH THIS.
I managed to fix it.
#33
Sure here is a link to the original script:

https://drive.google.com/open?id=1Ea5OD1j-xTMuNuXmOW8mYxrYXM_mof-p

But the Code is as follows:

Code: ags
// new module script

DynamicSprite* _is[];
int _os[];

FontType _iFont;
int _fontColor;
bool _ShowOne = false;
int _iw, _ih;

static void StackingInv::Setup(InvWindow* invWindow, FontType font, int color, bool showOne) {
  _iFont = font;
  _fontColor = color;
  _ShowOne = showOne;
  _iw = invWindow.ItemWidth;
  _ih = invWindow.ItemHeight;
}

static int StackingInv::GetItemSlot(InventoryItem* item) {
  if (item == null) return 0;
  return _os[item.ID];
}

void _update(int iid) {
  _is[iid] = DynamicSprite.Create(_iw, _ih, true);
  int iq = player.InventoryQuantity[iid];
  if (iq == 0 || iq == 1 && !_ShowOne) return;
  String q = String.Format("%d", iq);
  int w = GetTextWidth(q, _iFont);
  int h = GetTextHeight(q, _iFont, w + 10);
  DrawingSurface *ds = _is[iid].GetDrawingSurface();
  //ds.DrawImage((_iw - Game.SpriteWidth[_os[iid]]) / 2, (_ih - Game.SpriteHeight[_os[iid]]) / 2, _os[iid]);
  ds.DrawImage(0, 0, _os[iid]);
  ds.DrawingColor = _fontColor;
  ds.DrawString(_iw - w - 2, _ih - h - 2, _iFont, q);
  ds.Release();
  inventory[iid].Graphic = _is[iid].Graphic;
}

void game_start() {
  _is = new DynamicSprite[Game.InventoryItemCount+1];
  _os = new int[Game.InventoryItemCount+1];
  for (int i = 1; i <= Game.InventoryItemCount; i++) {
    _os[i] = inventory[i].Graphic;
    _update(i);
    inventory[i].Graphic = _is[i].Graphic;
  }
}

void on_event(EventType event, int data) {
  if (event == eEventAddInventory || event == eEventLoseInventory) {
    _update(data);
  }
}

bool _wasEMUI;

void late_repeatedly_execute_always() {
  bool _isEMUI = mouse.Mode == eModeUseinv;
  if (_isEMUI && !_wasEMUI) {
    int slot = _os[player.ActiveInventory.ID];
    mouse.ChangeModeGraphic(eModeUseinv, slot);
    mouse.ChangeModeHotspot(eModeUseinv, Game.SpriteWidth[slot]/2, Game.SpriteHeight[slot]/2);
  }
  _wasEMUI = _isEMUI;
}



Thank you!
#34
Good afternoon

I have started a project that I finally would like to use this wonderful stacking script in but I'm hitting a compile error:

StackingInv (1).asc(18): Error (line 18): Local variable cannot have the same name as an import

It seems to be a problem with the latest 3.4.1 build as there is no compile issues with 3.4.0. I was curious if anyone else has been using this script in  3.4.1?

The C.
#35
Yeah, I'll need to play around but I'm not using any ignore walk behind.
#36
Well I'm using hardware rendering, in the winsetup I'm using dx9 although I'm not convinced that the acsetup is used anyway. I've tried hardware pixel perfect and that also does the same. I suppose I could try software.
#37
I've noticed that non of the walkebhinds work on android (at least my build) I was wondering if anyone else has had any issues with this? They work perfectly fine when the exe is just run from the PC.

I may add, when I run the game files through the AGS android emulator it's fine. The walkbehind issue is only when it runs as a stand alone apk game.

C
#38
OK.

In my obb root I just have:
GAME.EXE
acsetup.cfg
android.cfg

With the config_enabled set to '1' it seems to use the settings defined by me. So I have no other directories in my obb. This couldn't have been possible without any of your help and especially your patience - especially Enrico and his original 'Let's Build an android release' post. This was amazing. I found I did have to rebuild the ags libs as there seemed to be an issue with them, but once that was done things started working fine. For those looking at doing this, you will need to sign up over on the google play console and pay the fee to set up a new app pretty early on.

I dont think you can get very far without having an RSA_public_key. This is a "license key" which can be found in the google Play Console under Development tools -> Services & API, a Base64-encoded RSA public key that you must copy and paste into the RSA public key in 'private.xml'

But it all seems to be working. Good timing really as I'm flying away next week to a funeral :(

I've never released anything to mobile, so it will be an interesting test for sure. Thank you again, if you need any more help though, I'll see what I can do.
C
#39
Sure, I'll do some more tests and see where the config files need to exactly be.

Cheers.
#40
That's pretty incredible, setting that flag to 1 fixed the issue! I'd have never seen that I'd it hadn't been pointed out. Thankyou all so, so much!!

It's looking incredible now 😊
SMF spam blocked by CleanTalk