Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Trouble in scripting (Bow and arrows for it)
New Topic New Poll Post Reply
Poster Message
McLaren0109
Level: Goblin
Avatar
Rank Points: 17
Registered: 05-26-2010
IP: Logged
icon Trouble in scripting (+1)  
I want to make a bow or crossbow that would shoot arrows damaging monsters.

I made a crossbow that shoots arrows in the right direction to me, he's got the charges, that's all good.

Click here to view the secret text


Created "Arrow"

This arrow properly "fly" around the room, regularly gets stuck in the doors and burned on a hot tiles. My arrow can interact with the position in which it is: if the arrow crosses the position, for example, (2,2), then it works, if for example (2,2) - this is a hot tile. But how to use the arrow to the monster, mirror, etc., which are on the adjacent square with an arrow, I did not understand. :(

Click here to view the secret text


I would appreciate if someone can help!
01-24-2014 at 02:54 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Someone Else
Level: Smitemaster
Avatar
Rank Points: 2398
Registered: 06-14-2005
IP: Logged
icon Re: Trouble in scripting (+2)  
Unfortunately, an NPC can't directly change the HP of any monster or a different NPC. There are two ways that I can think of to do this:

1) Make every monster an NPC that checks if an arrow has hit it each turn. This is difficult.

2) Make the arrow move until it hits something. Then, it checks what it was it hit:
- A monster: build a hot tile under it with hot tile damage set to -_ATK (or whatever value you want, negative values are fixed damage amounts), leave it one turn, then remove the hot tile.
- An orb: activate the orb.
- A mirror: remove it.
- Anything else: do nothing.
Or whatever interactions you want.
01-24-2014 at 03:09 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
McLaren0109
Level: Goblin
Avatar
Rank Points: 17
Registered: 05-26-2010
IP: Logged

File: McLaren_Hold_Demo.drh (9.9 KB)
Downloaded 47 times.
License: Public Domain
icon Re: Trouble in scripting (+1)  
Someone Else wrote:
Unfortunately, an NPC can't directly change the HP of any monster or a different NPC. There are two ways that I can think of to do this:

1) Make every monster an NPC that checks if an arrow has hit it each turn. This is difficult.

2) Make the arrow move until it hits something. Then, it checks what it was it hit:
- A monster: build a hot tile under it with hot tile damage set to -_ATK (or whatever value you want, negative values are fixed damage amounts), leave it one turn, then remove the hot tile.
- An orb: activate the orb.
- A mirror: remove it.
- Anything else: do nothing.
Or whatever interactions you want.

In this case, the arrow damages "ArrowsDamage", which does not depend on the protection of a monster or NPC.

Can you give an example of code "Make the arrow move until it hits something. Then, it checks what it was it hit:"?

A first option, I would still consider myself, but I realized that maybe there are more simple things.

I have seen the damage by a bomb in a position of monster or NPC with the string:
_Explosion =-ArrowsDamage

I enclose a demo file, which already has a crossbow, arrows and partially working code.

Yes I myself finally did it! ;)

If the arrow can move, it moves. Else a NPC "Arrow Hit" which, depending on _MyO ( owned by arrow ) is created at the point _MyX, _MyY instead arrow.

NPC "Arrow Hit" creates Explosion, dealing damage "-ArrowsDamage", at _MyScriptX, _MyScriptY (depending on the position of the Arrow).

Receive a demonstration, though, do not know whether it makes sense... Only beeps if sometimes a little arrow caters to pass into another room. More beeps when two arrows facing. Otherwise, everything works fine. Created a monster "Crossbow Soldier", which rotates clockwise or counter-clockwise and shoot in eight directions.

[Last edited by McLaren0109 at 01-27-2014 03:30 PM]
01-24-2014 at 03:35 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Trouble in scripting (Bow and arrows for it)
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.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.