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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 832 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[solved] first script problem (with you) #333985
07/20/10 13:58
07/20/10 13:58
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Hi,

I am working on a simple shooter. For player controll, I worked with the tutorial "workshop 24:

this is my entity creation:

Code:
action spieler_aktion()
{
 spieler = my;
 my.STATE = 1;
	
  while(1)
  {

    ...
    if(last_bomb_x == 15) last_bomb_x = -15;
    else last_bomb_x = 15;
    ent_create("bomb.mdl",vector(my.x+last_bomb_x,my.y+10,my.z),move_bomb);
    ...

    wait(1);
  }
}



then my move-bom function

Code:
function move_bomb() 
{
 while(1)
 {
  c_setminmax(me);
  my.roll = your.roll;
  c_move(me, vector(0, 15 * time_step, 0), vector(0, 0, 0), GLIDE);
  wait(1);
 }
}



You see nothing complicated laugh The problem is "my.roll = your.roll;" If move_bomb() is called - I get error message "Crash in move_bomb:SYS"

I don`t know why laugh

Cheers

Ditje

---------------------------------------------------------

Edit: I found the solution. It was the collions mode. When I changed it to IGNORE_YOU it works fine.

I haven`t really understood where the confict between colision and my .roll-settings is, but there must be one laugh

Last edited by Ditje; 07/20/10 15:20.
Re: first script problem (with you) [Re: Ditje] #333987
07/20/10 14:17
07/20/10 14:17
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
versuch mal in move_bomb

...
while(your)
{
...

einzufügen, oder your anders zu prüfen ob es noch vorhanden ist.

Sieht aus wie ein null-pointer crash

Aus Übersichtsgründen solltest Du entweder me oder my
sowie you oder your verwenden, nicht vermischen.

Re: first script problem (with you) [Re: Damocles_] #333988
07/20/10 14:22
07/20/10 14:22
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
whow das ging ja schnell laugh ich habe your durch einen festen Wert ersetzt. Dann geht`s. Offensichtlich wird spieler.roll nicht als your übergeben aber ich verstehe nicht warum.

Hier noch mal das komplette if-statement, von wo ich move_bomb aufrufe

Code:
if(my.STATE == 2) // Schuss 1 
		{
			if(last_bomb_x == 15) last_bomb_x = -15;
			else last_bomb_x = 15;
			ent_create("bomb.mdl",vector(my.x+last_bomb_x,my.y+10,my.z),move_bomb);
			my.STATE = 3;
		}



Ditje

Re: first script problem (with you) [Re: Ditje] #334001
07/20/10 16:01
07/20/10 16:01
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Your ist ein pointer auf die entity die die Bombe erstellt hat.

Wenn diese entity verschwindet oder sich der pointer ändert gibts einen crash.

Re: first script problem (with you) [Re: Damocles_] #334008
07/20/10 16:46
07/20/10 16:46
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Danke - nö die entity, die die "Bombe" erstellt ist die Spieler-Entity und dessen Pointer ändert sich nicht bzw. kann noch nicht sterben - so weit bin ich noch nicht laugh

Hast du vieleicht überlesen. Ich habe es in Zwischenzeit gelöst - siehe Edit post 1

Re: first script problem (with you) [Re: Ditje] #334009
07/20/10 17:44
07/20/10 17:44
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
ok

Last edited by Damocles_; 07/20/10 17:57.
Re: first script problem (with you) [Re: Damocles_] #335179
07/27/10 06:54
07/27/10 06:54
Joined: Jul 2010
Posts: 32
E
EID Offline
Newbie
EID  Offline
Newbie
E

Joined: Jul 2010
Posts: 32
hello ,
all i need to know how to activate a code for a security card that open the door , we have an global variable that name card_check when the player got the card the card_check flag will be ON else it's off . if the card_check is ON the switch of the will work it's C_scan .now how to the player pick up the security card by event entity that===> that what i need grin and it's the simple code
//Actions library that contains some actions to be used in any game project
///////////////////////////////
#include <acknex.h>
#include <default.c>
#define ON 1
#define OFF 2
var card_check=OFF;
function entity()
{
if(event_type == EVENT_ENTITY)
{
card_check=ON;
}
}
function detect()
{
if (event_type == EVENT_DETECT)
{
}
}
function scan()
{
if(card_check==ON)
{
if (event_type == EVENT_SCAN && key_o)
{
key_check=ON;
}
else if (event_type == EVENT_SCAN && key_c)
{
key_check=OFF;
}
}
}
}
action card()
{
}
action switch_key()
{
var switch_scan_range = 80;
var switch_scan_cone_horizontal = 90;
var switch_scan_cone_vertical = 90;

my.emask |= ENABLE_DETECT;
my.event = detect;
while(1)
{
c_scan(my.x,my.pan,vector(switch_scan_cone_horizontal,switch_scan_cone_vertical,switch_scan_range),SCAN_ENTS | SCAN_LIMIT|IGNORE_ME);
wait(1);
}
}

action door()
{
var door_step=3;
var door_full_trip=200;
var counter=0;
var door_travelled_dist = 0.0;
while(1)
{
if( key_check==ON)
{
if (door_travelled_dist < door_full_trip)
{
door_travelled_dist += door_step*time_step;
my.z+=door_step*time_step;
}
else
{
my.z += door_full_trip -door_travelled_dist ;
door_travelled_dist = door_full_trip;
}
}
if(key_check ==OFF)
{
if (door_travelled_dist > 0)
{
door_travelled_dist -= door_step*time_step;
my.z-=door_step*time_step;
}
else
{
my.z -= -door_travelled_dist ;
door_travelled_dist = 0;
}
}
wait(1);
}
wait(1);
}

action Hero_Animation()
{
var walk_percentage;
var death_percentage;
var run_percentage;
var crouch_percentage;
var idle_percentage;
var crawl_percentage;
var jump_percentage;
var attack_percentage;

my.emask |= ENABLE_SCAN;
my.event = detect;
my.event = scan;
my.event = entity;

while (1)
{
ent_animate(my,"idle",idle_percentage, ANM_CYCLE); // "walk" animation loop
idle_percentage += 5 * time_step; // 3 = animation speed for "walk"
if (key_d)
{
my.pan += 10*time_step; // increase the pan angle of the car
}
if (key_a)
{
my.pan -= 10*time_step; // decrease the pan angle of the car
}
if(key_s)
{
c_move (me, vector(-5 * time_step,0, 0), nullvector, GLIDE);
ent_animate(my,"walk",walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 5 * time_step; // 3 = animation speed for "walk"
}
if(key_w)
{
c_move (me, vector(15 * time_step, 0, 0), nullvector, GLIDE);
ent_animate(my,"walk",walk_percentage, ANM_CYCLE); // "walk" animation loop
walk_percentage += 10 * time_step; // 3 = animation speed for "walk"
wait (1);
}
if(key_shift && key_w)
{
c_move (me, vector(15 * time_step, 0, 0), nullvector, GLIDE);
ent_animate(my,"run",run_percentage, ANM_CYCLE); // "walk" animation loop
run_percentage += 5 * time_step; // 3 = animation speed for "walk"
}
if(key_ctrl)
{
ent_animate(my,"crouch",crouch_percentage, 0); // "walk" animation loop
}
if(key_n)
{
c_move (me, vector(2 * time_step, 0, 0), nullvector, GLIDE);
ent_animate(my,"crawl",crawl_percentage, ANM_CYCLE); // "walk" animation loop
crawl_percentage += 3.5 * time_step; // 3 = animation speed for "walk"
}
if(key_space)
{
ent_animate(my,"jump",jump_percentage, ANM_CYCLE); // "walk" animation loop
jump_percentage += 10 * time_step; // 3 = animation speed for "walk"
}
if(mouse_left)
{
ent_animate(my,"attack",attack_percentage, ANM_CYCLE); // "walk" animation loop
attack_percentage += 10 * time_step; // 3 = animation speed for "walk"
}
wait(1);
}
}


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