Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Help me with 'gun' script
New Topic New Poll Post Reply
Poster Message
Resert On
Level: Goblin
Avatar
Rank Points: 26
Registered: 05-02-2017
IP: Logged
icon Help me with 'gun' script (0)  
Hello, today I'm trying to make a 'gun' script. But it seems not work properly. Can someone give suggestion to this script work?

Here the script work I expect :
Click here to view the secret text


Click here to view the secret text


____________________________
Don't take it seriously.
Click here to view the secret text


Hold that need (more) tester(s):
Click here to view the secret text


Projects:
Click here to view the secret text


08-29-2017 at 10:12 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 1307
Registered: 07-11-2014
IP: Logged
icon Re: Help me with 'gun' script (0)  
I pasted your script into a custom character's default script then set that character as my accessory, and the script seems to work fine, but you've not specified what problem you're having.

First time you use it it reloads, then you get six shots, after which you will reload again. But you only get the explosion if one of the items the script checks for is in the square directly in front of where you are facing. It does not trigger when facing a monster because in the Wait for Entity command you did not select any entities from the list to actually check for.

Can you clarify exactly which behaviour you are expecting is not happening?

____________________________
(07:23 PM) Pearls: Kieran is correct.

[Last edited by kieranmillar at 08-29-2017 09:21 PM]
08-29-2017 at 09:21 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Resert On
Level: Goblin
Avatar
Rank Points: 26
Registered: 05-02-2017
IP: Logged
icon Re: Help me with 'gun' script (0)  
Behavior of the gun 'i exceptpect :

1. "gun shooting" script was equipped to 'command' attribute.
2. "check remaining ammo in gun" script was equipped to 'armor attribute.
3. Range of the gun is line of sight (one room).
4. All I told before in first post (check secret box under 'Here the script work I expect :' text.)

____________________________
Don't take it seriously.
Click here to view the secret text


Hold that need (more) tester(s):
Click here to view the secret text


Projects:
Click here to view the secret text


08-30-2017 at 07:08 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 1307
Registered: 07-11-2014
IP: Logged
icon Re: Help me with 'gun' script (0)  
I'll be honest, I'm a bit confused by your response, because you mention 2 scripts but only posted one.

I'd recommend you keep it all in the same script. You can always just have the script check what other Equipment you are holding by reading the _Sword or _Shield or _Accessory variable and looking for the id number of the character (as shown on the character screen, it's usually a number around 20000).

To get the gun to extend beyond the tile in front of you, you'll need to put the entire "trace of shoot" section along with all of the item checks into a loop, and then leave the loop if either _MyScript X or _MyScriptY goes under 0 or over 15.

I likely won't have time to look at this again until Monday as I'm off on holiday, so give it a go yourself and I'll be back next week if you need more help.

____________________________
(07:23 PM) Pearls: Kieran is correct.
08-30-2017 at 11:06 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
superluminal
Level: Delver
Rank Points: 56
Registered: 05-26-2016
IP: Logged
icon Re: Help me with 'gun' script (+1)  
I don't know if this is exactly the behavior you're looking for, but it's a start:

Gun default script:
Click here to view the secret text

Bullet default script:
Click here to view the secret text

Finally, you need to initialize the script:
  Set var "_GR" = 6
  Set var "_REP" = 23
  Equipment 0,4,20000

Your gun script might not be custom character number 20000. If it's not, then replace that 20000 in the code with the character number of the gun script.

____________________________
spacelike
08-30-2017 at 11:27 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Resert On
Level: Goblin
Avatar
Rank Points: 26
Registered: 05-02-2017
IP: Logged
icon Re: Help me with 'gun' script (0)  
quote:
superluminal wrote:
I don't know if this is exactly the behavior you're looking for, but it's a start:

Gun default script:
Click here to view the secret text

Bullet default script:
Click here to view the secret text

Finally, you need to initialize the script:
  Set var "_GR" = 6
  Set var "_REP" = 23
  Equipment 0,4,20000

Your gun script might not be custom character number 20000. If it's not, then replace that 20000 in the code with the character number of the gun script.

Thanks for the code. I will put it in 'crossbow' script. But seems I did a big mistake when trying to describe the behavior.

I was looking for a script that when the gun fired, it will go until hit something (like a laser).

____________________________
Don't take it seriously.
Click here to view the secret text


Hold that need (more) tester(s):
Click here to view the secret text


Projects:
Click here to view the secret text


08-31-2017 at 09:50 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
superluminal
Level: Delver
Rank Points: 56
Registered: 05-26-2016
IP: Logged
icon Re: Help me with 'gun' script (0)  
quote:
Resert On wrote:
I was looking for a script that when the gun fired, it will go until hit something (like a laser).
That's no problem either. Here's an updated bullet code that crosses the room immediately:

Bullet default script:
Click here to view the secret text


____________________________
spacelike
08-31-2017 at 06:31 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Help me with 'gun' script
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.