How to make snake attack me when entering the room? Or any enemy? SOLVED!!!!
Vitokin
03 Jun 2019, 15:05So i want any object/living with hostile to 1 or a flag as hostile to engage me in combat when entering a room and that object is inside the room, instead of making every single object by choice, a flag would be easier, im not sure where to begin tho please help I'm learning!
Edit: I'm going for turn-based not timer or action, currently i can attack the enemy object but it does not reply or engage when i enter the room I'm aiming for these things

Io
03 Jun 2019, 15:09I think you'd do it by setting, and pardon my psuedocode:
after I enter this room
if (EnemyObject.parent=TheRoomInQuestion)
{Run Enemy Attacking Code}
As for it responding after you attack, just end all your 'player attacks' code with 'and then the enemy attacks'. To simplify, I'd make a new function called EnemyAttacks, put your enemy attacking code in THERE, and have it like
//PlayerAttackingCode
EnemyAttacks()
Vitokin
03 Jun 2019, 15:14Thank you again for valuable help and information! This makes sense to me :)
Vitokin
03 Jun 2019, 16:09I keep getting the error EnemyObject is unknown object or variable even tho i added an attribute EnemyObject to my snake i'm so lost

Io
03 Jun 2019, 16:42Oh no, you misunderstood. EnemyObject was the example name of the object, because I don't know what you're calling the snake in your code. So it'd be more like WhateverYourSnakeIsCalled.parent
Remember, the .parent attribute is which room it's in. If the snake is ONLY EVER in that room and never leaves and always attacks when you enter, you can skip the 'if' stuff and just go for
After entering the room
SnakeAttackingCodeHere
Vitokin
03 Jun 2019, 16:49That worked great woot you rock!