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 - CB..

#41
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
#42
many thanks ! will take a look at the plug in allso
#43
i think it should read more like this

if (AreCharactersColliding(EGO,HOME)==1){
int ran=Random(5);
if (ran==0) DisplaySpeech(HOME, "ARRRRRRRRRRR! Youd best be getting out of way! You little scrub!");
else if (ran==1) DisplaySpeech (HOME, "Why I outta mop the floor with ya!");
else if (ran==2) DisplaySpeech (HOME, "Move out of the way lad!");
else if (ran==3) DisplaySpeech (HOME, "You'd best consider moving boy!");
else if (ran==4) DisplaySpeech (HOME, "MOVE! lad!");
else DisplaySpeech (HOME, "I am warning you! GET OUT OF MY WAY!");
}


not tested it tho
#44
i wouldn't mind see-ing the battle system yu created delta if yu want to post some xtracts from the scripting here that would be great food for thought..


for the Hp health system i keep reading this from erica's tutorial

If you have characters to follow the player and every one of them has: int skill and int damage (note: you can`t have strings in structs, sorry) you can do this:



struct Character

{

int skill;

int damage;

};



Then:



Character char1, char2, char3;



Then:



char1.skill = 3;

char1.damage = 0;



char2.skill = 5;

char2.damage = 0;



char3.skill = 1;

char3.damage = 50;



- - - - - - - - - - - - - - - - -



That`s all. It`s very simple and very easy. If you didn't have structs you'd probably have to do some stupid thing like this:

int char1skill, char2skill, char1damage, char2damage;

Which obviously is hard to do and gives you a lot of problems when scripting. Not to mention adding a 4th character will be very annoying.



/////////

tho i havent had the courage to try and implement it yet..

im still pottering around trying to use the distance between NPC's as a trigger for combat..

i found this here on the forums a while ago (sorry can't remeber who posted it)

if ((character[GD].x<120) || (character[GD].y<120))


which i think refers to an action triggered if the NPC gets within 120 pixels of the player character..which is very interesting tho i can't get it to work i must admit..
if i can get it to work (or if anyone can clear it up for me)
then yu could use it in a dynamic batle script ..

ie

if NPC1 gets within 120 pixels of NPC2 then he will shoot  an arrow at  NPC1
with an appropiate reduction in the NPC's heath..(will have to use a timer or similar system to prevent constant attacking and allow for the transition from one weapon to another)
if NPC1 gets within 80 pixels of NPC2 then he will throw a spear at NPC1
with a different reduction in NPC1's health
and if is colliding then he will use a sword..etc...
using a randomised script for the reduction in health on each occasion..and a whole lot of NPC's on each side ; with this script and random movements ,and or instructions to chase the other NPC's if they are within his line of sight ,then a very entertaining and dynamic battle would ensue..the out come of which would be unpredictable and most likely different each time it was run..

then perhaps looking at ways to give the player some tactical control over his NPC's
ways of altering the health etc by equiping them with items and so on
but im just pottering around at the moment and havent really spent a lot of time on it..

it doesnt sound too far fetched tho (and im sure it's allready been done at some point)
but it's giving me something to mess around with
the main jist being the desire to give the NPC's some individual life of their own
summat like that anyway
#45
this is probably not what you are after but im interested in the same subject..
and slowly learning how to give the NPC's some sort of AI behavuior and sensors

this code uses a random movement script to move the NPC (in this case a gaurd) and at the same time moves his line of sight  to simulate him looking around (really just using another character tied to the NPC's movements)


 // script for room: Repeatedly execute
if (IsTimerExpired(1)==1)
{int ran=Random(1);
if (ran==0) MoveCharacter(GD,character[GD].x,character[GD].y-70);
else MoveCharacter(GD,character[GD].x,character[GD].y+70);
SetTimer(1,200);
}    
if (IsTimerExpired(2)==1)
{character[SIGHT].x=character[GD].x + 42;
character[SIGHT].y=character[GD].y - 2;
SetTimer(2,200);
}    
if (IsTimerExpired(3)==1)
{if (AreCharactersColliding(EGO,SIGHT)==1){
PlaySound (3);}
SetTimer(3,40);
}  




then if the player walks into the gaurds line of sight (ie they collide)
in this case the gaurd shouts "alert"
which is PlaySound (3)

using the timers set in as the room loads (thanks Timosity for that!)

this keeps both the guard and his line of sight constantly moving and acting independantly from the player

if yu can set up a health score system for each NPC and use the
(AreCharactersColliding(EGO,SIGHT)==1)
to trigger a random reduction in health for the NPCS in question

perhaps like this instead of my playsound

if (AreCharactersColliding(EGO,SIGHT)==1){
int ran=Random(2);
if (ran==0) GiveScore(-10);
else if (ran==1) GiveScore(-0);
else GiveScore(-5);

then yu can have a dynamic extremely unpredictable battle system that has a life of it's own independant from the player characters actions..

but im afriad im still a begginner and havent figured out how to assign a seperate health/score for each NPC ..but the idea is there..
#46
put the interaction in the character section of the AGS
use the if item number# was used conditional
#47
excellent stuff
many thanks !
#48
i seem to be struggling a little with this one..
the graphic overlay appears as prescibed..but im getting confused with the correct way to remove it

the manual list the text overlay removal script which names the overlay in order to remove it..but the graphical overaly hasn't got a similar name and im a bit lost as to the way to remove it..

im using the overlay as the roof of a house,
as i walk into the house (it's a top down view)
i need to remove the overlay revealing the interior of the house (which is drawn on the background but hidden by the overlay)
i could use the move overlay script but might be neater to remove it entirely.

#49
if the give score event is tied to a hot spot/region
then disabling the hotspot or region after wards should prevent the player getting the points more than the once..
or yu could give the player a minor inventory item
make the givescore conditional on having that item ,then immediately remove the item..bit daft but works

or use this sort of thing

if (game.score < 15)
GiveScore(10);
else if (game.score > 15)
GiveScore(-0);


ie if the player has less than 15 points; he gets ten points
if he has more than 15 points he gets nothing..

could perhaps do something similar with the dialog and a region..
if player has an item when he walks onto a region run dialog..when he walks of remove item..i dunno bit basic and klunky again but thats my level at the moment

or make it dependant on the score to tie it in with the score event somehow..for continuity?


#50
Quote from: SSH on Wed 29/10/2003 16:48:39
No there isn't!

FollowCharacter(BIRD, -1);

will stop them following anyone


many thanks! that seems to do the job! ;D
#51
ah got it!. .hadn't thought of that..!
#52
allso how about using the animated backgrounds with a slow animation speed ?
 
#53
all brilliant stuff and duly noted down for study!


the

FollowCharacter(BIRD, -1);


sounds handy
i need to keep the NPC in the same room..

i'm trying to develop some basic AI behavuoir for  NPC's
in this case i have a guard who randomly patrols an area ,
and searchlights that do the same..if the player enters the beam of the moving searchligt then the guard starts chasing the player...(works well)
but in order for it to be satisfying and be usefull for other areas aswell i need a way to escape from the guard without the NPC or the player leaving room

ie if the player uses a stealth item
or enters a unlit area the guard no longer follows the player..or similar..

if

FollowCharacter(BIRD, -1);

does the trick without bouncing the NPC to room -1 (have i read that right?) then bingo!
im happy!
#54
Nice one T
i knew there was a better way..
whilst were here tho
can yu answer a question for me

is there a

StopFollowCharacter option ?

for the life of me i can't find it anywhere (tho im sure i've seen it)
#55
you could experiment with the

interaction

run script  

FollowCharacterEx(BIRD,EGO,0,80);

this i think will bring the bird in from room -1

or place the bird in room -1 right at the edge of the screen then use the
move NPC to a different room
and it should appear in the desired room at the same co-ordinates yu set for room -1

then use

run script

MoveCharacter (BIRD, 160, 100);
MoveCharacterPath (BIRD, 50, 150);
MoveCharacterPath (BIRD, 50, 50);  
MoveCharacterPath (BIRD, 50, 150);
MoveCharacterPath (BIRD, 50, 50);
MoveCharacterPath (BIRD, 50, 150);


to have the bird fly where yu want him to..

the 50,150 are the mouse co-ordinates in the room
#56
yur a sheep?
#57
check the

PlayAmbientSound

information in the help files

here yu go this is what it says


PlayAmbientSound
PlayAmbientSound (int channel, int sound, int volume, int x, int y)

Plays a looping sound effect in the background.
CHANNEL is the sound channel number. Currently this must always be 1, but in future multiple ambient sounds at once may be supported in which case you would be able to specify a different channel.

SOUND is the sound number, which identifies the file to load. The game will try to load SOUNDx.MP3 and SOUNDx.WAV, where X is the sound number you specify here.

VOLUME is the volume of the sound. This can be from 1 to 255, where 255 is the loudest. Generally you won't want to make this very loud since it's only supposed to be a background noise, such as a humming machine room or flowing water.

X and Y allow you to specify co-ordinates if you want a directional ambient sound. If you just pass X and Y as zero, the sound will be played at the specified volume throughout the room. However, if there is a certain spot in the room where the sound is emanating from, you can pass its co-ordinates here, and the sound will get louder as the player approaches that spot in the room. In this case, the VOLUME parameter specifies the maximum possible volume, when the player is standing right on the spot.

NOTE: The sound will stop when the player leaves the room.

NOTE: In order to optimise the looping of the sound, the entire sound effect is loaded into memory. Therefore, do not use this function to play normal background music with, since music files tend to be very large and are better streamed from disk with the normal music functions.

Example:

PlayAmbientSound (1, 10, 150, 250, 110);

starts SOUND10.MP3 playing in the background, at a medium volume and coming from co-ordinates (250, 110).
#58
good stuff glad I helped!
#59
place the music file in the folder with the rest of yur games files
#60
just as a quick way to get the ball rolling

save yur music as SOUND0.wav (or mp3 etc)

create yur room then click on the settings and then on the "I" button

then select when player enters the room after fade in

then select

game play sound

from the list

and choose 0 as the number of the sound file
then when yu enter the room the music will play..


this isnt exactly the correct way to do it but it will get you started..  


oops sorry SSH ;we posted at the same time
SMF spam blocked by CleanTalk