Isegrim; many thanks after a major bit of head scratching i sussed the problem with the script for guageing the distance from the NPC for triggering events..
the problem with the script was that if the player was to the left of the NPC then he continued to trigger the event no matter how far away he was..(the script didnt take into acount the possibility of a minus x screen location for the player(the NPC in question is randomly moving)
finally after some trail and error
if ((character[EGO].x-character[GD].x<80 && character[EGO].x-character[GD].x>-80)){
GiveScore(-1);}
which translated into if the player is within an area that is both less than 80 pixels (to the right) and greater(meaning less in real terms) than -80 pixels (to the left) from the character then the event is triggered
need to combine this with the same sequence for the y co-ords to finish the job off..
but it works..many thanks again for getting me on the scent!!
and many thanks to evryone else allso, interesting stuff all this!! am slowly learning
UP-DATE;yup it works..bit clunky but works
if player is within 80 pixels North, South, East and West of the NPC event is triggered
if ((character[EGO].x-character[GD].x<80 && character[EGO].x-character[GD].x>-80 && character[EGO].y-character[GD].y<80 && character[EGO].y-character[GD].y>-80)){
GiveScore(-1);}
this would be great for populating a forest with invisable enemys (view set to transparent) randomly moving around as the player group walks thru it..if the enemy moves within 80 pixels of the player (or other group member) then set enemys view to non transparent and start the battle would certainly ad tension and replayability to scenarios..and gawd knows what else
maybe unlimited regions as this seems to create regions for triggering events ?
begginer stuff i know but it's part of the fun of AGS to slowly create a system from what little yu do know (with evry-ones help of course) for me anyhow
the problem with the script was that if the player was to the left of the NPC then he continued to trigger the event no matter how far away he was..(the script didnt take into acount the possibility of a minus x screen location for the player(the NPC in question is randomly moving)
finally after some trail and error
if ((character[EGO].x-character[GD].x<80 && character[EGO].x-character[GD].x>-80)){
GiveScore(-1);}
which translated into if the player is within an area that is both less than 80 pixels (to the right) and greater(meaning less in real terms) than -80 pixels (to the left) from the character then the event is triggered
need to combine this with the same sequence for the y co-ords to finish the job off..
but it works..many thanks again for getting me on the scent!!
and many thanks to evryone else allso, interesting stuff all this!! am slowly learning
UP-DATE;yup it works..bit clunky but works
if player is within 80 pixels North, South, East and West of the NPC event is triggered
if ((character[EGO].x-character[GD].x<80 && character[EGO].x-character[GD].x>-80 && character[EGO].y-character[GD].y<80 && character[EGO].y-character[GD].y>-80)){
GiveScore(-1);}
this would be great for populating a forest with invisable enemys (view set to transparent) randomly moving around as the player group walks thru it..if the enemy moves within 80 pixels of the player (or other group member) then set enemys view to non transparent and start the battle would certainly ad tension and replayability to scenarios..and gawd knows what else
maybe unlimited regions as this seems to create regions for triggering events ?
begginer stuff i know but it's part of the fun of AGS to slowly create a system from what little yu do know (with evry-ones help of course) for me anyhow