Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Feature Requests : Behaviour: Lay Eggs (A small request.)
New Topic New Poll Post Reply
Poster Message
agaricus5
Level: Smitemaster
Avatar
Rank Points: 1839
Registered: 02-04-2003
IP: Logged
icon Behaviour: Lay Eggs (0)  
Would it be possible to include an option to allow characters to lay roach eggs (if this doesn't already exist)?

As far as I know, it is not possible to replicate a roach queen's behaviour with a scripted character (the closest I can get is to turn a roach queen character into a monster, but that ends the script).

____________________________
Resident Medic/Mycologist
04-01-2009 at 12:58 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Kwakstur
Level: Smiter
Avatar
Rank Points: 384
Registered: 05-05-2006
IP: Logged
icon Re: Behaviour: Lay Eggs (0)  
That's IMO too easy to script for what it's worth. Stick something like this in the code that runs each turn.


Note: By simulating a For loop for the Wait for open move directions and by using one of my algorithms here, you can make this much briefer, but I don't feel like doing that now.


If...
   Wait for event Monster stabbed
 Set var _MyScriptY = _MyY - 1
 Set var _MyScriptX = -9999
 If...
    Wait for open move northwest
  Set var _MyScriptX = _MyX - 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 If...
    Wait for open move North
  Set var _MyScriptX = _MyX
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 If...
    Wait for open move northeast
  Set var _MyScriptX = _MyX + 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 Set var _MyScriptY = _MyY
 If...
    Wait for open move West
  Set var _MyScriptX = _MyX - 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 If...
    Wait for open move East
  Set var _MyScriptX = _MyX + 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 Set var _MyScriptY = _MyY + 1
 If...
    Wait for open move southwest
  Set var _MyScriptX = _MyX - 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 If...
    Wait for open move South
  Set var _MyScriptX = _MyX
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
 If...
    Wait for open move southeast
  Set var _MyScriptX = _MyX + 1
  Generate entity Roach egg at (0,0)
  Set var _MyScriptX = -9999
 If end
If end



____________________________
Also known as ExpHP everywhere else.

[Last edited by Kwakstur at 04-01-2009 04:06 AM]
04-01-2009 at 03:57 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
agaricus5
Level: Smitemaster
Avatar
Rank Points: 1839
Registered: 02-04-2003
IP: Logged
icon Re: Behaviour: Lay Eggs (0)  
quote:
Kwakstur wrote:
That's IMO too easy to script for what it's worth. Stick something like this in the code that runs each turn.

Well, yes, but 1 line of script versus maybe 50 sounds like a good trade-off to me. Unless, of course, it would require the same number of code lines to make the engine assign egg-laying attributes to NPCs (which it could, I don't know).

quote:
Note: By simulating a For loop for the Wait for open move directions and by using one of my algorithms here, you can make this much briefer, but I don't feel like doing that now.

That isn't quite what I was thinking of.

Roach queens only lay one egg, and in the direction closest to you that is unblocked. Also, generating a roach egg isn't quite the same as growing one; it's only cosmetic, true, but it would be nice to strive for flawless consistency. However, saying that, this behaviour probably isn't too difficult to script, although it will involve some level of variable-wrangling to make it compact.

Also, just as a note, "Wait for event Monster stabbed" or "NPC killed" do not register until the move after the death or stabbing. "Wait for event Monster engaged" is the only command I can get to return true when the player is actually damaging something.

____________________________
Resident Medic/Mycologist
04-01-2009 at 11:55 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
zex20913
Level: Smitemaster
Avatar
Rank Points: 1721
Registered: 02-04-2003
IP: Logged
icon Re: Behaviour: Lay Eggs (0)  
Have you seen a level set called "Roach Queen"? Perhaps that can give you an idea of the appropriate scripting.

If you have, feel free to totally ignore this comment.

____________________________
Click here to view the secret text

04-01-2009 at 01:34 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Kwakstur
Level: Smiter
Avatar
Rank Points: 384
Registered: 05-05-2006
IP: Logged
icon Re: Behaviour: Lay Eggs (+2)  
quote:
agaricus5 wrote:
Roach queens only lay one egg,
Whoops.

quote:
Also, just as a note, "Wait for event Monster stabbed" or "NPC killed" do not register until the move after the death or stabbing.
A simple Wait for event will register on the same turn and continue execution on the next. A Wait for event used as an If... query evaluates and continues execution on the same turn.

Maybe Monster stabbed/NPC killed are exceptions (I haven't actually tested the code), but that's the general rule.


But anyways, personally, if I had a custom Roach Queen, I wouldn't want it to make standard Roach Eggs. The obvious solution to that is to also include some way to change which monster to lay. But those custom monsters would still not go through the 4 stages of growth like you mentioned.


But then again, now that I think more about it, we finally have Beam Attack behavior, and we have some others... Maybe this would be appropriate to add to the Behavior list, but something tells me that no sooner than it is implemented, somebody will make an FR entitled "Change monster for Lay Roach Egg behavior."

BTW here's the code optimized with my formulae:
Click here to view the secret text



____________________________
Also known as ExpHP everywhere else.

[Last edited by Kwakstur at 04-01-2009 09:12 PM]
04-01-2009 at 08:28 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Feature Requests : Behaviour: Lay Eggs (A small request.)
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.