Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : Scripting question: change a weapon's appearance
New Topic New Poll Post Reply
Poster Message
Rabscuttle
Level: Smitemaster
Avatar
Rank Points: 1960
Registered: 09-10-2004
IP: Logged
icon Scripting question: change a weapon's appearance (+2)  
Is it possible to change the appearance of a weapon with scripting?
For example, say I wanted to make the pickaxe look more like a battleaxe, or the spear to look like a trident.

Functionally they'd behave identically - the trident would stab forward, bump sideways, destroy tarstuff, you'd get one if you stepped on a spear token, etc.

Hmm. I guess an overlay thing would work, like how the bonus stage weapons are done in TSS (only without disarming Beethro first) But is there an simpler way?

[Last edited by Rabscuttle at 06-03-2019 02:16 PM]
06-03-2019 at 02:16 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Master Delver
Avatar
Rank Points: 222
Registered: 01-27-2017
IP: Logged
icon Re: Scripting question: change a weapon's appearance (+4)  
Well, I know of two options, but there might be more ways to deal with this.
1) No overlays
You can make a custom character. Then give this character sprites with your custom weapon. Then use 'set player role' to play as that character.
Pro: Easy, and no fiddling around necessary.
Con: Not flexible. The custom weapon stays there, also when a weapon is changed. So you'd have to detect weapon changes and then change your character to the correct one with the corresponding (custom) weapon.
2) Yes overlays
Overlays are not actually that difficult. I did a custom weapon with overlays in a beta hold that's about to be published now. It's a rainbow staff. It has a staff, with a rainbow on top of it. Fancy!

Secretized the code for your inspiration. Should be pretty clear what happens. Basically, it first clears all overlays (in my case, they were in layer 3). Then every turn, it applies them again in the updated user position.

Only part I don't understand anymore when looking back is the 'Set weapon off' part. I remember that there was some scripting quirk that needed mending.
Click here to view the secret text

Pro: No dedicated character needed, any size of weapon graphic will do. Even rotation could be done 'on the fly'.
Con: fiddling around to find the correct position to place the overlay will be necessary. Also, does not update in a timely mannner always. For instance, when dying, the overlay lingers on screen.
Lastly: the overlay will have to cover the original weapon completely, else it will still partly show and this is perhaps ugly (or it could be put to good use to only add the 'extra bit' to a default weapon).

Anyways, I think I'd use overlays in this case. It's ok, you can try even if you're afraid. Overlays definitely don't bite.

____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 06-03-2019 03:13 PM]
06-03-2019 at 03:13 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : Scripting question: change a weapon's appearance
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.