Scriptproblem with SIGNAL_ATTACKED

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Scriptproblem with SIGNAL_ATTACKED

Post by Moonraven » Mon, 18. Sep 06, 11:21

Hi everybody,

currently i'm playing around with signals, and so i came to a problem.

What i want to do is the following:

i create a TS (random race), give him wares to deal with and start
the "!job.freetrader" script.

after that, i create some pirates and give them the command to attack
the trader.

ok...so far it works. But now i want to give the player a message, when the
trader is attacked (might take a little time, because the priates first have to move to the trader).

My script looks like that:

Code: Select all


Script ur.test
Version: 0
for Script Engine Version: 32
Description
Description
Arguments

Source Text

001   *enable signal/interrupt handling: [TRUE]
002 @ $tship = [THIS] -> call script 'ur.lib.CreateTS' :  race of interrest=Argonen  sector and position=ARRAY ( 15205, -20089, -25084, Wolkenbasis SW )
003   $tship -> connect ship command/signal SIGNAL_ATTACKED to script 'ur.al.signal.attacked' with prio 101
004 @ START $tship -> call script '!job.trade.freetrader' :
005 @ = [THIS] -> call script 'ur.lib.CreateAttacker' :  race of interrest=Piraten  target=$tship
006   return null
The first scriptcall generates the TS and gives him wares.
the next starts the trading-job
and then i create the pirates.

As you can see i try to bind a own script for the SIGNAL_ATTACKED to the ship. But this script is never called.

I also played with the priority, but with no success.

Can anyone help me out ?
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Mon, 18. Sep 06, 11:52

have u trying removing the !job.freetrader script and just getting the pirates to attack and c if that works.

if it does, then its possible the freetrader reassignes the attacked signal to something else.

also not that the signal isn't sent the instant a ship is hit, they have to take a few hits first.

u could also test it by attacking the trader yourself, this should at least trigger the attacked signal

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Mon, 18. Sep 06, 12:21

I've tried the TS without any other command. And the TS is getting hitted manytimes (till it was destroyed). But no signal was send.

Well i trie to attack the TS by myself. But if this works, what can i do to get the event, when Pirates or Xenon or Kah'ak attack the TS ?
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Mon, 18. Sep 06, 12:30

Ok...i gave the TS simple the IDLE-command and attacked the TS by myself...and the event was triggert.

Thats mysterius....
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot » Mon, 18. Sep 06, 13:32

iirc you cant "just" use the free-trader script as it needs a ware-array to trade in .. so I guess the script simply deactivates and without a command running there will be no signals ...



G

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13296
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Mon, 18. Sep 06, 14:17

IMO Red Spot is right. You should be able to check that by targeting the trader and scroll down upper menue to see what script is currently on. Alternatively just debug it (needs some debug lines in your script).

Cheers Euclid

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Mon, 18. Sep 06, 14:26

its also worth noting that job scripts arn't the best to use on standard ships, they tend to get alot of values from the jobs file itself

u'll notice the various job commands like, <var> = get job id, <var> = get job flight type, etc

none of these commands will work if you just call it on a standard ship and can end up makign the whole thing not working.

the best thing would be to unpack it, then edit it yourself to make it standalone, thats what i did with the Spacefly hunters, althou i added alot of other stuff to it as well

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Mon, 18. Sep 06, 15:57

Ok...some try's later......


I give the TS only the command COMMAND_IDLE to fly around and do nothing, instade of start the job-script.

After that i hook my script to SIGNAL_ATTACK.


Then...the variances:


->Attack TS (Argon) by myself signal send
->Attack TS (Argon) by spawned Pirates no signal
->Attack TS (Player) by myself signal send
->Attack TS(Player) by spawned Pirates signal send

So...the signal is only send if the TS is a Playerowned ship or the TS would be attacked by the player :(
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13296
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid » Mon, 18. Sep 06, 19:21

I'd follow Cycrow's advice and unpack the script to modify it for standalone. I'm sure your find the lines where the get race -> attacker
is restricted to player. Change that.

Cheers Euclid

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Mon, 18. Sep 06, 20:04

@Euclid

?...sorry...but i think you missunderstand my last post.

I've komplettle remove the job-script.

My last test looks like this:

Code: Select all

Script ur.test
Version: 0
for Script Engine Version: 32
Description
Description
Arguments

Source Text

001 @ $tship = [THIS] -> call script 'ur.lib.CreateTS' :  race of interrest=Argonen  sector and position=ARRAY ( 15205, -20089, -25084, Wolkenbasis SW )
002   START $tship -> command COMMAND_IDLE : arg1=null, arg2=null, arg3=null, arg4=null
003   $tship -> connect ship command/signal SIGNAL_ATTACKED to script 'ur.al.signal.attacked' with prio 100
004 @ $aships = [THIS] -> call script 'ur.lib.CreateAttacker' :  race of interrest=Piraten  target=$tship
005   return null
001 Just creating the TS
002 Start moving around (I've checked the scripts behind, no attacker thing is in there)
003 hook the signal
004 create attacker (pirates) and let them attack.

Not working...:(

P.S. I think my english is a little rusty, sorry for that.
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Mon, 18. Sep 06, 21:16

Code: Select all

'ur.al.signal.attacked' 
post the code from here, if its big hyperlink the script
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Mon, 18. Sep 06, 22:25

Ok..its just simple.

Code: Select all

Script ur.al.signal.attacked
Version: 1
for Script Engine Version: 32
Description
process freigter is killed
Arguments

    * 1: Attacker , Var/Ship , 'Attacker'
    * 2: action , Var/Number , 'action'

Source Text

001   send incoming message 'Hilfe ich werte attakiert' to player: display it=[TRUE]
002   set player tracking aim to [THIS] ->
003   return null
*edit* This part is only for my testings.
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

User avatar
Moonraven
Posts: 968
Joined: Wed, 27. Aug 03, 11:13
x3

Post by Moonraven » Tue, 19. Sep 06, 19:18

I've got it.

Well...it seems not very logical to my, but after so many trys, the idea came in my mind, to set the Racelogic of the Attacker to false.

Now the signal is send.

Thanks to all, anyway :)
Gruß Moonraven
Wer lesen kann, ist ganz klar im Vorteil.
[ external image ]

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Tue, 19. Sep 06, 19:20

well race logics usually takes effect after a ship has been idle for awhile, then gives it commands depending on what race it is.

its possible these commands might have revert the signals back to the original

Post Reply

Return to “X³: Reunion - Scripts and Modding”