Combat System for Horror Game
jaktube
04 Oct 2014, 23:30I am revamping the combat system for my current horror game. I would like it to go some thing like this:
You enter room where there is a monster.
You get the message: You hear growling.
You have 3s/1turn to get out of the room before being attacked.
Also, the monster is roaming, so i need the game to check each time you enter a room if the monster is there. I have tried everything i can think of. If possible please explain in the GUI editor, I'm bad at coding.
You enter room where there is a monster.
You get the message: You hear growling.
You have 3s/1turn to get out of the room before being attacked.
Also, the monster is roaming, so i need the game to check each time you enter a room if the monster is there. I have tried everything i can think of. If possible please explain in the GUI editor, I'm bad at coding.

HegemonKhan
06 Oct 2014, 00:25I can't explain via the GUI~Editor very well, but hopefully I can provide some guidance, which you can figure out how to do it in the GUI~Editor, though hopefully someone else will help you with doing it in the GUI~Editor, anyways here's my attempt, lol:
there's two global checking options for what you want to do:
1A. add a 'changedparent' Script Attribute to your 'XXX' Player Object:
1B. same as 1A, but for your 'monster' Object, instead.
'player' Player Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: changedparent
Attribute Type: script
Attribute Value_or_Expression: (see below)
run as script -> add a script -> scripts -> if -> [EXPRESSION] -> write~type in (see below):
your_monster_name.parent = your_player_name.parent
or, in Code: if (your_monster_name.parent = your_player_name.parent) { scripts }
then, add a script -> output -> print a message -> [MESSAGE] -> You hear growling.
or, in Code:
and lastly,
you need to create a global Timer (see below using the 2. Turnscript option of how to create a global Tmer, it's last script is to disable it after the 3 seconds), which you then enable within this (changedparent) script:
(same indenting level as your first 'then' script) -> add a script -> ??? -> enabled timer -> name_of_your_timer)
lastly for the /1 turn, create a global turn:
'game' Game Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: turns
Attribute Type: int (integer)
Attribute Value: 0
and also this too:
'game' Game Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: old_turns
Attribute Type: int (integer)
Attribute Value: 0
and *back within your global timer*, add these 2 scripts at the bottom~last:
run as script -> add a script -> variables -> set a variable or attribute ->
left of the equal sign: game.old_turns
right of the equal sign: game.turns
game.old_turns = game.turns
run as script -> add a script -> variables -> set a variable or attribute ->
left of the equal sign: game.turns
right of the equal sign: game turns + 1
in code: game.turns = game turns + 1
and at the start~top of your global timer, add this script:
your global Timer's code in full:
2. global Turnscript:
(too tired at the moment, lol, if I can I'll get around to explaining how to do it this way)
-------------
hopefully, this is error free... but that's unlikely, lol.
ask if you need help with any of this stuff...
------------
ach, this is incorrect design... for the global timer, as the 'if' conditional part of the scripting needs to be removed from the global timer, to instead as a 'changedturns' script on~in~within the 'game' Game Object. meh... sorry...
there's two global checking options for what you want to do:
1A. add a 'changedparent' Script Attribute to your 'XXX' Player Object:
1B. same as 1A, but for your 'monster' Object, instead.
'player' Player Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: changedparent
Attribute Type: script
Attribute Value_or_Expression: (see below)
run as script -> add a script -> scripts -> if -> [EXPRESSION] -> write~type in (see below):
your_monster_name.parent = your_player_name.parent
or, in Code: if (your_monster_name.parent = your_player_name.parent) { scripts }
then, add a script -> output -> print a message -> [MESSAGE] -> You hear growling.
or, in Code:
if (your_monster_name.parent = your_player_name.parent) {
msg ("You hear growling.")
}
and lastly,
you need to create a global Timer (see below using the 2. Turnscript option of how to create a global Tmer, it's last script is to disable it after the 3 seconds), which you then enable within this (changedparent) script:
(same indenting level as your first 'then' script) -> add a script -> ??? -> enabled timer -> name_of_your_timer)
if (your_monster_name.parent = your_player_name.parent) {
msg ("You hear growling.")
// enable Timer script, I'm not sure what it is in code, lol. Maybe it's just a 'call', thus using merely it's name, but I'm not sure.
}
lastly for the /1 turn, create a global turn:
'game' Game Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: turns
Attribute Type: int (integer)
Attribute Value: 0
and also this too:
'game' Game Object -> Attributes (Tab) -> Attributes -> Add ->
Attribute Name: old_turns
Attribute Type: int (integer)
Attribute Value: 0
and *back within your global timer*, add these 2 scripts at the bottom~last:
run as script -> add a script -> variables -> set a variable or attribute ->
left of the equal sign: game.old_turns
right of the equal sign: game.turns
game.old_turns = game.turns
run as script -> add a script -> variables -> set a variable or attribute ->
left of the equal sign: game.turns
right of the equal sign: game turns + 1
in code: game.turns = game turns + 1
and at the start~top of your global timer, add this script:
if (game.turns = game.old_turns + 1) {
// your 'fight~encounter' scripts
}
your global Timer's code in full:
if (game.turns = game.old_turns + 1) {
// your 'fight~encounter' scripts
// 'disable this global Timer' script
}
game.old_turns = game.turns + 1
game.turns = game.turns + 1
2. global Turnscript:
(too tired at the moment, lol, if I can I'll get around to explaining how to do it this way)
-------------
hopefully, this is error free... but that's unlikely, lol.
ask if you need help with any of this stuff...
------------
ach, this is incorrect design... for the global timer, as the 'if' conditional part of the scripting needs to be removed from the global timer, to instead as a 'changedturns' script on~in~within the 'game' Game Object. meh... sorry...