Author |
Topic: moved trigger, scripting |
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
|
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD Mapping Posted: Monday, Apr. 9, 2012 06:58 pm |
|
|
|
|
|
|
Category: CoD Mapping Posted: Monday, Apr. 9, 2012 11:24 pm |
|
attachment: application(1,512.8Kb) |
hey, thanks for the link. I believe that was a full hit...
I copied out the relevant lines and fit it on my project on.
In my map are four targets. Two moving to the right and the other to the left and no more trigger...
but i get a script compile error..
//edit: sorry. I tested the thing once again. and the script compile error appears no more. problably because I chanched
scriptorg = getent("ziel1","targetname"); to
scriptorg = getentarray("ziel1","targetname");
but the targets not react still on shots.
I did it understand now so that the target it's own trigger is. is this possible..lol but look self..thx for that..
I do the map files and the example map in the attachment
my map gsc: (edited April 10th)
Code: main(){
maps\mp\_load::main();
setup_targets();
}
setup_targets()
{
scriptorg = getentarray("ziel1","targetname");
scriptorg2 = getentarray("ziel2","targetname");
for(i = 0; i < scriptorg.size; i++)
{
targeted = getent(scriptorg[i].target,"targetname");
ent = getent(targeted.target,"targetname");
targeted linkto (scriptorg[i]);
scriptorg[i] thread move();
targeted thread follow(ent);
ent thread target_hit(scriptorg[i]);
}
for(i = 0; i < scriptorg2.size; i++)
{
targeted = getent(scriptorg2[i].target,"targetname");
ent = getent(targeted.target,"targetname");
targeted linkto (scriptorg2[i]);
scriptorg2[i] thread move2();
targeted thread follow(ent);
ent thread target_hit(scriptorg2[i]);
}
}
target_hit(scriptorg)
{
while(1)
{
self waittill("trigger",other);
scriptorg rotateroll(90,.35);
wait .1;
scriptorg waittill("rotatedone");
wait .2;
scriptorg rotateroll( -90,.35);
scriptorg waittill("rotatedone");
}
}
move()
{
while(1)
{
while (1)
{
wait (randomint(8));
self movex( 500,(randomint(3)+4));
self waittill("movedone");
self movez( 80, 3);
self waittill("movedone");
self movex( -500,(randomint(3)+4));
self waittill("movedone");
self movez( -80, 3);
self waittill("movedone");
}
wait .05;
}
}
move2()
{
while(1)
{
while (1)
{
wait (randomint(8));
self movex( -500,(randomint(3)+4));
self waittill("movedone");
self movez( 80, 3);
self waittill("movedone");
self movex( 500,(randomint(3)+4));
self waittill("movedone");
self movez( -80, 3);
self waittill("movedone");
}
wait .05;
}
}
follow(ent)
{
while(1)
{
ent.origin = self.origin;
wait (.05);
}
}
greets hayx
edited on Apr. 9, 2012 04:25 pm by hAYX
edited on Apr. 10, 2012 12:55 am by hAYX |
|
|
|
|
Category: CoD Mapping Posted: Tuesday, Apr. 10, 2012 03:14 pm |
|
attachment: application(54.3Kb) |
hm... the script compile error is still appearing in the developer mod
******* script runtime error *******
cannot cast undefined to string: (file 'maps\mp\ziel.gsc', line 14)
targeted = getent(scriptorg .target,"targetname");
*
called from:
(file 'maps\mp\ziel.gsc', line 4)
setup_targets();
*
called from:
(file 'maps\mp\ziel.gsc', line 1)
main(){
but ok... or not?
I said that iI think that the targets are their own triggers and I have got a Quake C Scripting Reference and there is to read:
entity other; // entity that triggered event on 'self'
because of that: line 37 in the thread target_hit(scriptorg)
self waittill("trigger",other);
I do this reference in the attachment
edited on Apr. 10, 2012 08:23 am by hAYX |
|
|
|
Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
Category: CoD Mapping Posted: Tuesday, Apr. 10, 2012 04:13 pm |
|
1. The scripting language of COD is not Quake C. So, no point referring to it. COD has it's own hand-crafted language which is closer to C++ than it is C, and doesn't need to be compiled separately like Quake C does.
2. As for you code, try this:
Code: main()
{
maps\mp\_load::main();
thread setup_targets();
}
setup_targets()
{
scriptorg = getentArray( "ziel1", "targetname" );
scriptorg2 = getentArray( "ziel2", "targetname" );
for( i = 0; i < scriptorg.size; i++ )
{
targeted = getentArray( scriptorg[i].target, "targetname" );
for( j=0; i < targeted.size; j++ )
{
ent = getentArray( targeted[j].target, "targetname" );
for( n=0; n < ent.size; n++ )
{
targeted[j] linkto( scriptorg[i] );
scriptorg[i] thread move();
targeted[j] thread follow( ent[n] );
ent[n] thread target_hit( scriptorg[i] );
}
}
}
for( i = 0; i < scriptorg2.size; i++ )
{
targeted = getentArray( scriptorg2[i].target, "targetname" );
for( j=0; i < targeted.size; j++ )
{
ent = getentArray( targeted[j].target, "targetname" );
for( n=0; n < ent.size; n++ )
{
targeted[j] linkto( scriptorg2[i] );
scriptorg2[i] thread move();
targeted[j] thread follow( ent[n] );
ent[n] thread target_hit( scriptorg2[i] );
}
}
}
}
target_hit( scriptorg )
{
while( 1 )
{
self waittill( "trigger", other );
if( isPlayer( other ) )
{
scriptorg rotateroll( 90, .35 );
wait .1;
scriptorg waittill( "rotatedone" );
wait .2;
scriptorg rotateroll( -90,.35 );
scriptorg waittill( "rotatedone" );
}
}
}
move()
{
while( 1 )
{
wait( randomint(8) );
self movex( 500,(randomint(3)+4) );
self waittill( "movedone" );
self movez( 80, 3 );
self waittill( "movedone" );
self movex( -500,(randomint(3)+4) );
self waittill("movedone");
self movez( -80, 3 );
self waittill( "movedone" );
wait .05;
}
}
move2()
{
while( 1 )
{
wait( randomint(8) );
self movex( -500,(randomint(3)+4) );
self waittill( "movedone" );
self movez( 80, 3 );
self waittill( "movedone" );
self movex( 500,(randomint(3)+4) );
self waittill( "movedone" );
self movez( -80, 3 );
self waittill("movedone");
wait .05;
}
}
follow( ent )
{
while( 1 )
{
ent.origin = self.origin;
wait (.05);
}
}
This code is entirely untested, so I am not sure if it will work. |
|
|
|
|
Category: CoD Mapping Posted: Tuesday, Apr. 10, 2012 05:12 pm |
|
hey, very thanks for the information...this is interessting with the script language..
the script unfortunately threw out the same mistake again
looking forward
greets hayx |
|
|
|