Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Another Monster Script Not Working
New Topic New Poll Post Reply
Poster Message
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Another Monster Script Not Working (0)  
Ok I had this idea of a guard who walks north and south all the time, and when the player is too close to the light, the guard will see him, and he will disappear, and immediately a guard will appear who is scripted so that he follows the player. (The player cannot see the process of the guard changing into a different one, it's just the idea that it goes from 'Has not seen the player' to 'Spotted Player'.

I can do this with a guard that is standing still, but how do I do it with one that is moving? I've tried some things, but here is my script as I left it:

  Behavior 6
  Behavior 9
  Set var "_MyHP" = 100
  Set var "_MyATK" = 80
  Set var "_MyDEF" = 20
  Ambient sound 10634,1
  Move to 7,2,0,0
  Move to 8,2,0,0
  Move to 8,12,0,0
  Move to 7,12,0,0
  Go to 1
Label 1
  If ... 
        Wait for entity Player 8,0,9,2
     Disappear 
  Else 
     Wait for entity Player 9,3,9,3
     Disappear 
  Else 
     Wait for entity Player 6,2,6,2
     Disappear 
  Else 
     Wait for entity Player 6,3,7,5
     Disappear 
  Else 
     Wait for entity Player 6,6,6,6
     Disappear 
  Else 
     Wait for entity Player 6,7,7,9
     Disappear 
  Else 
     Wait for entity Player 9,9,9,9
     Disappear 
  Else 
     Wait for entity Player 8,10,9,12
     Disappear 
  Else 
     Wait for entity Player 9,13,9,13
     Disappear 
  Else 
     Go to 1
     Wait 0


I can see myself that I am doing something obviously wrong with the "else" command and the commands around it, but I don't know where to begin.

Thanks in advance!
02-19-2012 at 08:27 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Re: Another Monster Script Not Working (0)  
Oh, I already noticed some mistakes in that script, but that is due to me trying all sorts of things.

However I just realised that this is impossible with a second NPC (The one who appears when the player is spotted) because He couldn't know where the other guard was standing. Right?

Or can this all be done within one script?
02-19-2012 at 08:32 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Sillyman
Level: Smiter
Avatar
Rank Points: 339
Registered: 09-08-2006
IP: Logged
icon Re: Another Monster Script Not Working (+2)  
No, it's quite possible, thanks to a thing called Generate Entity. From the NPC scripting screen, hit Characters. Make a new character from there, called Spotted (or, you know adjust the script). Then:

Set var "_MyScriptX" = _MyX
Set var "_MyScriptY" = _MyY
Disappear
Generate entity Spotted,0,0,northwest
Set var "_MyScriptX" = -9999
Set var "_MyScriptY" = -9999
End

Put that where you want to trigger the change of script. Then, put your "chase the player" script in Spotted's default script, and so on. Ask again if you don't know how to do that.

____________________________
Who, me?
FNORD

[Last edited by Sillyman at 02-20-2012 04:48 PM]
02-20-2012 at 04:44 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Niborius
Level: Goblin
Rank Points: 17
Registered: 10-23-2011
IP: Logged
icon Re: Another Monster Script Not Working (0)  
Oh, I see what you did there.

I still cannot get it to work however

  Behavior 6
  Behavior 9
  Set var "_MyHP" = 100
  Set var "_MyATK" = 80
  Set var "_MyDEF" = 20
Label 2
  If ... 
        Wait for entity Player 8,0,9,2
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 9,3,9,3
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 6,2,6,2
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 6,3,7,5
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 6,6,6,6
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 6,7,7,9
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 9,9,9,9
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 8,10,9,12
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Wait for entity Player 9,13,9,13
     Set var "_MyScriptX" = _MyX
     Set var "_MyScriptY" = _MyY
     Disappear 
     Generate entity Bedroom Guard (Spotted you),7,12,northwest
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     End 
  Else 
     Move to 7,2,0,0
     Move to 8,2,0,0
     Move to 8,12,0,0
     Move to 7,12,0,0
     Wait 0
     Go to 2


Yeah it is a bit messed up, and the last thing I tried was put the "Move to" command at the end of the script, which only broke it even more, but what I cannot get to work:

-The guard walking more than 1 round around (It only goes a circle once and then stops)

-The guard only spots the player when he is on one of those specific area's, instead of all of them

-If the guard changes into one that spotted the player, it is invisible.

Thanks for helping!

02-21-2012 at 10:13 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Another Monster Script Not Working
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.