Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,397 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Script help: Push a crate #203539
04/22/08 17:21
04/22/08 17:21
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
Hello, i need to build a script like this:

1) when the player hit a CRATE, this crate is moved away (like player is pushing the crate. The crate must be blocked by another object or waal, if in the wayr. Where should I started?

Thank you in advance

Re: Script help: Push a crate [Re: Al_Meyer] #203541
04/22/08 17:35
04/22/08 17:35
Joined: Oct 2007
Posts: 42
Minnesota, USA
Techd Offline
Newbie
Techd  Offline
Newbie

Joined: Oct 2007
Posts: 42
Minnesota, USA
Start with this:)

 Code:
define scan_mode,skill1; 
define speed_x,skill2; 
define speed_y,skill3; 
define scan_pushable,987.654;   // a unique number 
function push_me(); 

action push_able 
{ 
   my.scan_mode = scan_pushable; 
   my.enable_impact = on; 
   my.event = push_me; 
} 


function push_me() 
{ 
   if(!you) {return;} 
   if(you.z > my.z+my.max_z){return;} 
   if(you.scan_mode == scan_pushable) 
   { 
      my.speed_x = you.speed_x; 
      my.speed_y = you.speed_y; 
   } 
   else 
   { 
      my.speed_x = fcos(you.pan,5*0.9*time); 
      my.speed_y = fsin(you.pan,5*0.9*time); 
   } 
   move_mode = ignore_passable+glide; 
   ent_move(nullvector,vector(my.speed_x,my.speed_y,0)); 
}



Life is what you make it just like Games!
Re: Script help: Push a crate [Re: Techd] #203544
04/22/08 17:53
04/22/08 17:53
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
Thank you very much, TechEd. Very helpful

Re: Script help: Push a crate [Re: Al_Meyer] #203550
04/22/08 18:18
04/22/08 18:18
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
Hello. I´m newbie. I try to put this code without success. You can clarify me where i should put this scnippet and how to activate it? Thanks again

Re: Script help: Push a crate [Re: Al_Meyer] #203552
04/22/08 18:38
04/22/08 18:38
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
This line is giving me errors


ent_move(nullvector,vector(my.speed_x,my.speed_y,0));

Dangerous instruction in events

Thanks

Re: Script help: Push a crate [Re: Al_Meyer] #203562
04/22/08 19:31
04/22/08 19:31
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
Hello, it´s me again. I set warning level to 1 and stop the warning, but do you know what this error can be?

Re: Script help: Push a crate [Re: Al_Meyer] #203604
04/23/08 01:09
04/23/08 01:09
Joined: Oct 2007
Posts: 42
Minnesota, USA
Techd Offline
Newbie
Techd  Offline
Newbie

Joined: Oct 2007
Posts: 42
Minnesota, USA
You should define all variables at the top of your level.wdl(define scan_mode,skill1;)

Then put your Function first
 Code:
function push_me() 
{ 
   if(!you) {return;} 
   if(you.z > my.z+my.max_z){return;} 
   if(you.scan_mode == scan_pushable) 
   { 
      my.speed_x = you.speed_x; 
      my.speed_y = you.speed_y; 
   } 
   else 
   { 
      my.speed_x = fcos(you.pan,5*0.9*time); 
      my.speed_y = fsin(you.pan,5*0.9*time); 
   } 
   move_mode = ignore_passable+glide; 
   ent_move(nullvector,vector(my.speed_x,my.speed_y,0)); 
}
}


Then Your Action
 Code:
action push_able 
{ 
   my.scan_mode = scan_pushable; 
   my.enable_impact = on; 
   my.event = push_me; 
} 


this worked for me, but I put the code in a separate wdl(pushable.wdl) and included in my level.wdl(include <pushable.wdl>;)

Hopes this help!

also if you paste the code as is put another } at the end of

function push_me()


Life is what you make it just like Games!
Re: Script help: Push a crate [Re: Techd] #203668
04/23/08 11:42
04/23/08 11:42
Joined: Jan 2006
Posts: 11
A
Al_Meyer Offline OP
Newbie
Al_Meyer  Offline OP
Newbie
A

Joined: Jan 2006
Posts: 11
Thanks. It worked. I have made a external wdl and put it in templates folder. All the best


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