Special collectible gear for scripts and missions

5 replies [Last post]
Wuzzy
Wuzzy's picture
User offline. Last seen 25 weeks 22 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

I suggest a new gear: A new kind of collectible item, similar to the weapon crate but when you collect it, nothing happens except for playing the “collect” sound maybe. The gear could look like an ammo crate, but with an exclamation mark or some other symbol on it.

This gear can be used a a collectible in missions and scripts to trigger certain events, for example.

Such a gear would be similar to the target gear, which is also only used in missions.

Please note that thes same can be kinda (!) achieved with other crates, like a weapon crate with amNothing in it (or 0 of something) or a health crate when health bonus is set to 0. But this is still sub-optimal, as both trigger messages and the health crate still cures poison.

Hi, I am a Hedgewars developer. Smile

sheepluva
sheepluva's picture
User offline. Last seen 21 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

Please don't forget to check the script that checks for undocumented Lua-API calls Smile

Did you check following functions out?

SpawnFakeAmmoCrate
SpawnFakeHealthCrate
SpawnFakeUtilityCrate

They might do exactly what you want.
I think I used one of them in the Contact-Shoppa script.

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Wuzzy
Wuzzy's picture
User offline. Last seen 25 weeks 22 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

Thanks for pointing this out. I added the link to my bookmarks.
This page still doesn’t say how to use these functions, nor does it specify any parameters.

So I looked into the source code, and I guess I have found out the correct syntax.

For future generations, here I leave behind how to use these functions:

The syntax of all three functions is this:
(x, y, explode, poison)

x and y specify the position where the box is spawned.
explode is a boolean, if it is true, the box will explode when collected.
poison is a boolean, if it is true, the collector will be poisoned.

As far I can tell all parameters are mandatory.

I have tested the functions and they work so far. I was a bit disappointed as I didn’t hear a “collect” sound (I set both explode and poison to false in my test). (Maybe add this as a 5th optional parameter?)

But:
It is not my fault the wiki is soooo outdated and incomplete. :P

And how was I, as a non-core developer, supposed to find this obscure URL on my own?:

http://hw.ercatec.net/docs/lua_wiki_check.php

I never found this one in the wiki.

Hi, I am a Hedgewars developer. Smile

sheepluva
sheepluva's picture
User offline. Last seen 21 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

Wuzzy allegedly wrote:
This page still doesn’t say how to use these functions, nor does it specify any parameters.

Yes, because it's just a simple script that searches words in the code and on the wiki, based on some patterns.
Which then shows the difference.

That script doesn't know how to figure out the parameters ( => you have proven you're smarter than the script ).
It might be able to do so in the future.
Some while ago I started working on making the uScript.pas code more structured and self-documenting.

At some point I'll be hopefully able to generate a lua API wiki documentation automatically and completely (including descriptions etc.) from the code itself.

Also I added the feature that calling a function with wrong parameter count will give a syntax message listing the number and names of the parameters.

So just calling any function with empty brackets should do the trick.

Oh and also I added the "/lua" chat command that allows you to e.g. do such thing directly in a local/quick game...

Wuzzy allegedly wrote:
I was a bit disappointed as I didn’t hear a “collect” sound

Oh? I'll look into that, I guess.

Wuzzy allegedly wrote:
It is not my fault the wiki is soooo outdated and incomplete. :P

So you added your latest findings to the wiki, right? Great ;p

Wuzzy allegedly wrote:
And how was I, as a non-core developer, supposed to find this obscure URL on my own?

You weren't. It's just some lame script running on a lame server of mine.
I think I put it in the wiki the other day, but then removed it again - for some weird or obscure reason.
Ya know, like all my reasons.

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Wuzzy
Wuzzy's picture
User offline. Last seen 25 weeks 22 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

sheepluva allegedly wrote:

Wuzzy allegedly wrote:
It is not my fault the wiki is soooo outdated and incomplete. :P

So you added your latest findings to the wiki, right? Great ;p

No, I didn’t. But it is literally not my fault. I am not allowed to edit the wiki. Duh!

Hi, I am a Hedgewars developer. Smile

sheepluva
sheepluva's picture
User offline. Last seen 21 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

Wuzzy allegedly wrote:

No, I didn’t. But it is literally not my fault. I am not allowed to edit the wiki. Duh!

Yikes, sorry!
I forgot that thing needs special permissions to be edited (silly amiright?)

I gave "Edit Wiki"-permission to the account that you use for creating issues!

Thanks for contributing! Smile

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]