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

#1
Cheers dkh. That did the trick.

I now have eagle-eyed guards pacing around the room!

Thanks for all the help Khris. You're a marvel.
#2
This line seems to be causing a Type Mismatch (Cannot convert 'float' to 'int'):

Code: ags
 if (l == 0) return true
#3
It seems to work brilliantly for one guard but if I add more I sometimes get a

'Error. Floating Point divide By zero.' message

on line

Code: ags
 x2 = x2/l; 


I'm reproducing this spotting check:   
if (cnameguardhere.Close(70) && cnameguardhere.InView(20))

for each guard. Could that be the problem?
#4

Thanks Khris.

I understand a tiny fraction of this so apologies if I'm doing something stupid:

Pasting the code into a very simple empty test room (player + one patrolling NPC) I get a "Array Index out of bounds" message on line:

Code: ags

c = character[i]; 


(index: 24 bounds: 0..23)

There was also an issue with 'Acos' in

Code: ags
float angle = Maths.RadiansToDegrees(Maths.Acos(x1*x2 + y1*y2));



"Not a public member of Maths"

I changed 'acos' to 'Arcos' just to see if it would run (which it did until it hit the Array Index out of bounds)
#5
These two threads are very relevant: 

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=41690.0

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=38687.0

I've bodged an extremely clumsy solution using another character and the follow command (in effect the following character is the NPC and the (invisible) character in front is his gaze) It kinda works, but I'd much rather use a vision cone that pointed exactly in the direction the NPC was moving (perhaps with some randomness tossed in to simulate occasional glances left and right).

Any idiot-proof advice would be much appreciated. Thanks.
#6
Can anyone help me add a vision cone to a patrolling NPC? I've read all I can find in the forum on the subject, but can't get my unmathematical head round it  :-[

The vector method sounds fantastic, but is beyond me unless I can paste some ready-made code straight into my script.

The situation: I have an NPC following a roughly circular patrol route made up of around 9 waypoints. I'd like to have him 'looking' directly in front of him as he goes (vision cone pointed in same direction as his direction of travel). If the player 'collides' with this vision cone there's a chance he's spotted.

Thanks in advance.

#7
Thanks. Almost there now.
#8
Thanks a lot Khris.

Still slightly confused, but I think I'm making progress.

I've used:

newsprite=DynS.CreateFromExistingSprite(1)

to create a dynamic sprite from my character sprite

and

newsprite=DynS.Rotate(newsprite, 5);

to rotate that sprite when the appropriate key is pressed.

What I can't seem to work out is how to draw the rotatable sprite in the appropriate place (ie - where my character is)
#9
I have a vehicle-like character that I'd like to be able to rotate left and right (with A and D keys) and move forward and back in direction of facing (with W and S keys).

Despite looking in confused awe at zabnat's Taxi demo source code:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36546.0

spending several hours trying to adapt Ryan Timothy's Road Racer rotation code:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=38401.0

and searching in vain for KhrisMUC's Dynamic Rotation Module:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33122.0

I don't seem to be able to achieve this end. Can anyone help me out with some guidance?

Thanks.
#10
Brilliant. I've just tried the quick clickable-state change, and that works perfectly.

Thanks a lot.
#11
I'm trying to create a puzzle where objects must be placed entirely within hotspots (no overlap) but can't seem to figure out how to do it.  Right now, if the bottom-left corner of an object is within a hotspot then the puzzle is solved (not what I intended).

I've tried various inelegant solutions including surrounding the hotspots with 'hidden' objects and doing a pixel-perfect collision detection check, but this only worked if I made the 'hidden' objects clickable (not acceptable).

All suggestions gratefully received.
#12
Brilliant. That works perfectly (as you suspected X/YOff must be declared outside of the repeatedly_execute).
Thanks again.
#13
The objects in my game are draggable and use fairly large sprites. Currently when I click on them, they 'jump', centring on the cursor. Can some wise soul tell me if it is possible to prevent this behaviour, and have objects dragged from the exact point the mouse clicks on them?
#14
Ah, perfect! My "dragging objects" search hadn't unearthed that thread.

Many thanks.
#15
Would anyone be kind enough to guide me through the code necessary for dragging and dropping objects with the LMB? I've tried adapting examples in other threads, but don't seem to be making any progress. :(     
#16
Brilliant. The added brace above else and declaring tobj as -1 has done the trick!  Many thanks for the help.
#17
Thanks for the advice. I think I'm nearly there. I've created my custom object property and inserted the code within the GlobalScript. Now I just need to work-out why I'm getting a 'Error running function repeatedly_execute: Error null pointer referenced' message. It's linked to the line:

if (o.GetProperty("tint")) {
#18
I'm a couple of days into my first AGS project and struggling to work out how to get the mouse to tint objects momentarily as it passes over them.

I've done a search, found, and attempted to utilise the code in this thread:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36056.0

but can't seem to get it to work. I keep getting a  'cannot assign intial value to global value pointer'.

If someone can explain the steps in a little more detail, I'd greatly appreciate it. I'm still not sure I've created the custom 'tint' property in the right place or fully understood how to create/position a rep_ex.

Thanks in advance.
SMF spam blocked by CleanTalk