Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Pick up money #138606
06/28/07 13:36
06/28/07 13:36
Joined: Jun 2007
Posts: 2
M
Miami305 Offline OP
Guest
Miami305  Offline OP
Guest
M

Joined: Jun 2007
Posts: 2
First of all, hi everyone, this is my first post in this forum (even if i've been visiting it every once in a while...)

So, the other day, I was on acknex ulimited as I discovered a money wdl:
http://www.coniserver.net/coni_users/web_users/pirvu/au/scripts/Money_WDL.zip

Then I wanted to test that script, so I've made a demo level (with the shooter template) and assigned an action to a dollar model... there was some errors (i've fixed some of them, thought)

here is the modified code:
Code:
 // money.wdl by Matt Fritz
// WDL Script to handle money pickups

/////////////////////////////////////////////////////////////////////////
// Sounds and variables for picking up money
SOUND money_fetch <moneyPickup.wav>; // money pickup sound (beamer.wav) from template folder
var money = 0; // money ID
var m_bill = 0; // money value

/////////////////////////////////////////////////////////////////////////
// Strings for needing and picking up money
STRING got_money1_str "Got a 1 dollar bill!";
STRING got_money5_str "Got a 5 dollar bill!";
STRING got_money10_str "Got a 10 dollar bill!";
STRING got_money20_str "Got a 20 dollar bill!";
STRING got_money50_str "Got a 50 dollar bill!";
STRING got_money100_str "Got a 100 dollar bill!";
/////////////////////////////////////////////////////////////////////////

// Desc: controls the money pickup
function _money_pickup()
{
if(EVENT_TYPE == EVENT_SCAN && indicator != _HANDLE) { return; }
if(EVENT_TYPE == EVENT_PUSH && YOU != player) { return; }

if(m_bill == 1) { money = money + 1; msg.STRING = got_money1_str; }
if(m_bill == 5) { money = money + 5; msg.STRING = got_money5_str; }
if(m_bill == 10) { money = money + 10; msg.STRING = got_money10_str; }
if(m_bill == 20) { money = money + 20; msg.STRING = got_money20_str; }
if(m_bill == 50) { money = money + 50; msg.STRING = got_money50_str; }
if(m_bill == 100) { money = money + 100; msg.STRING = got_money100_str; }
if(MY.__SILENT != ON) { show_message(); }
snd_play(money_fetch,50,0);
wait(1);
remove(ME);
}

// Assign an action to a money entity and pick up the entity and watch the results!
// Or, just use the included sprite, money.bmp

ACTION money_one
{
m_bill = 1;
MY.EVENT = _money_pickup;
item_pickup();
}

ACTION money_five
{
m_bill = 5;
MY.EVENT = _money_pickup;
item_pickup();
}

ACTION money_ten
{
m_bill = 10;
MY.EVENT = _money_pickup;
item_pickup();
}

ACTION money_twenty
{
m_bill = 20;
MY.EVENT = _money_pickup;
item_pickup();
}

ACTION money_fifty
{
m_bill = 50;
MY.EVENT = _money_pickup;
item_pickup();
}

ACTION money_hundred
{
m_bill = 100;
MY.EVENT = _money_pickup;
item_pickup();
}



It still gives errors like :
(EVENT_TYPE == EVENT_SCAN && indicator != _HANDLE) >> parameter unknown indicator

If you could help, it would be very appreciated
bye guys

Re: Pick up money [Re: Miami305] #138607
06/28/07 19:06
06/28/07 19:06
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline
Member
dennis  Offline
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...

Well.....in my eyes there are many errors....but I can't say that precisely because I don't know waht's exactly in the shooter template.


I have modified it a bit...hope it works...i did not test it....

Just try out and just post the errors...I will take a look at them..;)


With your script you can only use predefined amounts of money (one, five, ten).

With the new code you can set the amount of money yourself in the WED and set a default value. Furthermore you can change the amount to 3, 8 or 154.

code:
"
//////////////////////////////////////////////////////////////////////
//
// money.wdl by Matt Fritz modified by Dennis
//
// -> WDL Script to handle money pickups
//
// version 0.1
//
//////////////////////////////////////////////////////////////////////

SOUND money_fetch <moneyPickup.wav>;

var MoneyAmountDefault = 10;

define MoneyAmount,skill50;
define Live,skill51;

string Temp_Str[1000];

function MoneyPickup_Event()
{

// Return other entities
if(EVENT_TYPE == EVENT_PUSH && YOU != player) { return; }
if(EVENT_TYPE == EVENT_ENTITY && YOU != player) { return; }

// Display it
str_for_num(Temp_Str,my.MoneyAmount);
str_cpy(msg.string,"Got");
str_cat(msg.string,Temp_Str);
str_cat(msg.string," euros/dollars");

// Player gets the money
player.MoneyAmount += my.MoneyAmount;

// Sound
snd_play(money_fetch,50,0);

// Removing through setting the "live"-skill to zero
// I think that prevents an error if your pc wants to
// access the money in its endless loop in the action-definition
wait(1);
my.Live = 0;

}

action Money_Act()
{

if(my.MoneyAmount == 0) { my.MoneyAmount = MoneyAmountDefault; }

// Init

my.Live = 1;

my.enable_push = on;
my.enable_entity = on;
my.event = MoneyPickup_Event;

// Endless loop
while(my.Live)
{

// Some item stuff....

// eg. rotating
my.pan += 1*time_step;

// or a light effect with a certain color

my.light = on;
my.red = 255;
my.green = 50;
my.blue = 50;

// add....more stuff here

wait(1);

}

// Kill...well...Remove me....
ent_remove(me);

}
"

Re: Pick up money [Re: dennis] #138608
06/28/07 21:18
06/28/07 21:18
Joined: Jun 2007
Posts: 2
M
Miami305 Offline OP
Guest
Miami305  Offline OP
Guest
M

Joined: Jun 2007
Posts: 2
First of all, thanks for your reply
So,i've tested and the script has no errors

but the problem is that character just passes through the money model: no money is added and the model doesn't disappear

Well, this is very strange.

PS: I've also tested the script with another project (the newton tutorial's car template) and it doesnt work neighter

Hope you have an idea why...
Thanks again

Re: Pick up money [Re: Miami305] #138609
06/29/07 07:40
06/29/07 07:40
Joined: May 2005
Posts: 819
U.S.
Why_Do_I_Die Offline
Warned
Why_Do_I_Die  Offline
Warned

Joined: May 2005
Posts: 819
U.S.
If the model just passes through try changing the money's push value , i.e. my.push = 10;
or something , i dont remember exactly but it should be higher or lower than the player, so try something like 20 or -20 , see if changing that value works. If not , you can also try event_impact. Thuogh I personally found using vect_dist to work very well , i.e. ,
if(vec_dist(my.x,player.x)<=5{money+=whatever;wait(1);ent_remove(me);}
I've used that before and it works very well. Good luck.

Re: Pick up money [Re: Why_Do_I_Die] #138610
06/29/07 12:45
06/29/07 12:45
Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...
dennis Offline
Member
dennis  Offline
Member

Joined: Jul 2006
Posts: 150
Deutschland/Germany, nahe Hamb...

I agree with "Why_DO_I_Die"....the vec_dist-function is a good solution although it's using more CPU...

That's why I would try changing the push value first.....


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1