using give score to implement simple battle systems?

Started by CB.., Wed 15/10/2003 01:03:38

Previous topic - Next topic

CB..

using givescore(-x) and a "go to room x" command if the score gets below a set amount...(with room x being a dead end with the message you have been killed (can use the reset game option to start game again or the gui to load a save)
am thinking about a bog simple battle system based on interactions between characters
(playing perhaps a combat animation instead of the talking view) where the conversation choices might somthing like  

player character topic choices

"strike with sword"
play talking view 1
random score reduction on NPC between x and x

"defend"
play talking view 2
random score increase for player character between x and x

"escape"
return to normal view end converstation
reduce player score by x


and the same options randomly chosen for the NPC

if it's not possible for the NPC to carry a score then perhaps

if in region x
if player score is above x
give player inventory item x
play animation /
remove NPC x from room/

i have only a limited ability to use the scripting st the moment.



CB..

#1
/////////

righto here we are an ultra  ultra simple battle system;


cursor 8 /rename to Attack


then in the enemy NPC character;
under the new attack character option



run script

int ran=Random(2);
if (ran==0) GiveScore(1);
else if (ran==1) GiveScore(2);
else GiveScore(3);

then add action after this;

run script

int ran=Random(2);
if (ran==0) GiveScore(-1);
else if (ran==1) GiveScore(-2);
else GiveScore(-3);


///////////


when you click on the NPC with cursor 8 (which can be a sword graphic etc)/
your score goes up and down according to action of the random scripts


all i need now is to get a

move character x to room x when score is x


and if the player score is below x he will be moved to the game over screen

and if the player score is above x the NPC is moved to room -1

then it's just a matter of adding animations sound and such like

seems a pretty flexible system capable of a lot of variation/elaboration

whaddya think?

it might be possible to stage a fairly dynamic large scale battle using lots of NPCs each running these tiny scripts?

CB..

is there a way to script this event?


move character x to room x when score is x


my eyes are going screwy reading and re reading the manual and tutorials and i can't find any reference to this any where , it must be there some-where but i just dont seem to be able to find it....the score must be used to trigger events surely?

sorry if it's in the manual etc , i just can't see it there... you know how it goes sometimes yu can stare at things for hours and just not see them  

Ishmael

Quotemove character x to room x when score is x

Code: ags
if (game.score == X) character[CHARID].room == x
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

CB..


CB..

my apolgies TK,
im getting a parse error using the script /at character in the line the script is on/
i'm using the script in the NPC character interaction
(this puts it in the global script section so that's ok?)


like this

if (game.score == 12) character[GERM].room == 4;


NPC character is called GERM  room 4 is the game over screen

have i interpreted the script correctly?
does it require place-ing in a different section or requier any extra scripting anywhere?

really sorry bowt this im right at the bottom of the learning curve

realy im trying to write this battle sysetm so that newbies like my self can make use of it
and the more i look at it; the more interesting this simple approach seems to be, am really anxiuos to get past the problem

i'll keep experimenting with it to see if i can see my mistake..could you add any info i might be missing re where to use the script?

edit;;

shud i be writing it like this

if (game.score == 12) {character[GERM].room == 4}


ill give it a go//



UP_DATE/


still can't get the script to work allways gives the error at chracter but yuve steared me in the right direction so it all helps


i did a bit more searching around and this works

placed in a run script after the original set

if (game.score < 5)
NewRoom(4);  


this moves the player to the game over screen if his score drops below 5 ;

which is ninety percent of the battle

so the battle system works like this so far;

//////////////////////

cursor 8 /rename to Attack


in the enemy NPC character interaction;
under the new attack character option



run script

int ran=Random(2);
if (ran==0) GiveScore(1);
else if (ran==1) GiveScore(2);
else GiveScore(3);

then add action after this;

run script

int ran=Random(2);
if (ran==0) GiveScore(-1);
else if (ran==1) GiveScore(-2);
else GiveScore(-3);

then add action after this;

run script

if (game.score < 5)
NewRoom(4);  

///////////////////////


room 4 being a game over screen with the reset game option/message ...press F9

if i set up a system whereby the enemy NPC can be removed from the room then all is well;

in the scenario im using to test this ,i've had the NPC triggered by a walk off region command,
allso at the same time removing a vital inventory item from the player; he can only get it back (or be re-issued it) by killing the NPC ..which sets up the need for the battle (other wise the player could just ignore the NPC completely)

perhaps i could set it up so if score is above x give player inventory item , then i can use the inventory item on the NPC to remove him from the room LOL i dunno



CB..

i added this as a way of controling wether the battle ends with game over or ending the battle with a win for the player;;

if
score less than 5
take player to game over screen/

else
if score is greater than 12
give player inventory item 3 (the item he lost after triggering  the battle )
restore the walkable area (which was disabled after triggering the battle)
displaying a message (stating the enemy is wounded and the player can now escape)

which looks like this in script;



if (game.score < 5)
NewRoom(4);  
else if (game.score > 12)
AddInventory(3) && RestoreWalkableArea(1) && DisplayMessage(527);




so far so good..i now have some sort of gameplay/battle element to use!


and because it's all in the NPC character interactions i can use this character over and over again thru out the game ;

which works ok for the game im making as a test/ because the NPC character is a first world war german foot soldier so he doesn't need to be altered for different rooms etc.
he takes a map off the player and i cannot travel from room to room without the map so i must attack him to get it back..so it works as a game... just about any way..

so for the newbies like  myself who woouldn't know what to do with a global variable if it bit him on the doobrie heres the whole battle system


////////////


cursor 8 /rename to Attack


in the enemy NPC character interaction;
under the new attack character option



run script

int ran=Random(2);
if (ran==0) GiveScore(1);
else if (ran==1) GiveScore(2);
else GiveScore(3);

then add action after this;

run script

int ran=Random(2);
if (ran==0) GiveScore(-1);
else if (ran==1) GiveScore(-2);
else GiveScore(-3);

then add action after this;

run script

if (game.score < 5)
NewRoom(4);  
else if (game.score > 12)
AddInventory(3) && RestoreWalkableArea(1) && DisplayMessage(527);


///////////

yu could use this instead of the final run script


if (game.score < 5)
NewRoom(4);
else if (game.score > 12)
Newroom(5);


if yur score goes below 5 yu go to game over room
if yur score gets above 12 yu go to a new room and can continue the quest/adventure  



or perhaps favourite is

if (game.score < 5)
NewRoom(4);
else if (game.score > 12)
Newroom(5);


if yur score goes below 5 yu go to game over room (room4)
if yur score gets above 12 yu go to the room you are actually allready in
and set the room interaction to remove the NPC when yu enter the room..there by removing the danger and winning the battle.... summat like that anway

CB..

this is use-full as well using the same script (hope no one minds me wittering on like this)

setting a region interaction
when player walks on to

run script  (click on edit script and enter the code in the window under the green header)

int ran=Random(2);
if (ran==0) GiveScore(1);
else if (ran==1) GiveScore(2);
else GiveScore(3);

then add action after this;

run script

int ran=Random(2);
if (ran==0) GiveScore(-1);
else if (ran==1) GiveScore(-2);
else GiveScore(-3);


////////

giving some dynamics to a room where yu need to accumalate points in order to escape/leave the room


adding action after this as

run script

if (game.score < 5)
NewRoom(4);
else if (game.score > 12)
Newroom(5);



where NewRoom(4)  is ROOM4  (change number in the brackets to change destination room)
and NewRoom(5) is ROOM5 etc

and editing the score amount in (game.score < 5)  the number  5 is the score amount and < means less than ;  > means more than ;

with some experimentation with the score amount and placement and number  of regions to create a good balance and adding scores to recieving objects/inventory items

would add a bit more replayability to a room


i want to look in to (for the battle system)
a way of triggering the battle script sequence when the NPC is within a certain distance of the player
i notice theres a way of referencing the distance for the NPC in the follow character scripts so it looks like it can be done (hopefully without a global variable as i have no idea how to script GV's at all)
this way i can have the enemy NPC wander round the room , perhaps give the player a stealth mode (or suggest it anyway) and raise some tension around wether the NPC walks close to the player and "finds" him'

im very much a begginer and really trying to address the problems im having understanding ,and using the custom scripts , bearing in mind that later on i will understand evrything better; but theres allways a period for every-one where even the simple things are too scary to attempt



putting this into the repeatedly execute interaction for the room (click on the "I" buton in room settings to bring up the room interaction screen)
does the same job for the low score ends game idea..

run script

if (game.score < 5)
NewRoom(4);  


tho if this is the first room in the game you need to give the player a score as he enters the room for the first time..to prevent him from dieing due to having no points at game start up

first time player enters screen

run script

GiveScore(155);


/////////

this gives the player 155 points/

then settings up regions

when player stands on region

run script

int ran=Random(2);
if (ran==0) GiveScore(-1);
else if (ran==1) GiveScore(-0);
else GiveScore(-0);



//////////


then while the player is on this region his score will drop by about 10 points a second  (use when the player has a large score)
and if he gets below 5 points he gets transfered to the game over screen..

creating a bit of panic.. you could have this region in front of an object the player needs to get to.
or as a haunted forest he must travel thru, or a mine field he needs to cross or similar .or an end of level boss etc...(there's a script for disable region some where so  use inventory item disable region would work)

.and you could allso have a region with

when player stands on region

if player has inventory item

run script

int ran=Random(2);
if (ran==0) GiveScore(1);
else if (ran==1) GiveScore(0);
else GiveScore(0);

followed by remove inventory object

for a score/health rejuvenation area which will only work if the player has a specific (and rare) inventory item..he of course loses the inventory item by use-ing the "health spar"l so he can't use it more than once

just thinking/learning out loud here...gathering enough easy/quick/re-usable script elements
to start to create the "game dynamics" then it's the really difficult bit, writing the plot..  




SMF spam blocked by CleanTalk