Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
jemahuk1

Questions!

Recommended Posts

trickstar34

I get a game crash myself when I try to make a marker and sphere with locals

Share this post


Link to post
Share on other sites
trickstar34

It's just an array, completely remove that from the parameter where the opcode looks like this and you can add any variable that is an actor to that parameter. Timelimit either is how long the character makes that action before stopping, or that is how long it can take (I may not be wording right), the time is in milisecinds, so how many seconds you want times 1000 is what you want to put there

 

 

05D9: AS_actor [email protected] run_to_actor $Player_actor timelimit 5000

 

 

Share this post


Link to post
Share on other sites
jemahuk1

What's the code to set certain peds to attack player & also attack certain actors

like ped #wmyconb attack player & his friends, so every #wmyconb will attack them.

Share this post


Link to post
Share on other sites
gtasearcher

 

What's the code to set certain peds to attack player & also attack certain actors

like ped #wmyconb attack player & his friends, so every #wmyconb will attack them.

You must use external threads. [only in main.scm confused.gif ]

First you need to define the external thread, find

DEFINE EXTERNAL_SCRIPTS 78 // Use -1 in order not to compile AAA script

Replace "78" with "79".

 

Then find

DEFINE SCRIPT HOTDOG AT @HOTDOGV       // 77

Add

DEFINE SCRIPT KILL AT @KILL

after that.

 

Then goto the end of the script, add

:KILLthread 'KILL':KILL2if andPlayer.Defined($PLAYER_CHAR)not Actor.Dead([email protected])jf @KILL305E2: AS_actor [email protected] kill_actor $PLAYER_ACTORwait 0goto @KILL2:KILL3Actor.RemoveReferences([email protected])end_thread

 

Then goto line 933.

 

Add after that line

0884: 'KILL' = init_external_script_named_handle 78 (KILL)

 

Then goto line 943.

 

Add after that line

08E8: assign_external_script_handle 'KILL' to_model #wmycomb

Save and compile.

Should work, I haven't tested it.

Share this post


Link to post
Share on other sites
jemahuk1

- Hey, what about the code to set the certain peds spawn at certain area?

- Then, what's the code to set some actors/peds to follow player but still with the walking style we've set

- What's the code to set peds'/actors' running speed?

Share this post


Link to post
Share on other sites
12jango

Hey, I see there's a newbie too here, if you don't mind I wanna ask for a question:

 

 

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 -6.0 0.3

 

 

What does it mean? For what?

Edited by 12jango

Share this post


Link to post
Share on other sites
trickstar34

 

- Hey, what about the code to set the certain peds spawn at certain area?

- Then, what's the code to set some actors/peds to follow player but still with the walking style we've set

- What's the code to set peds'/actors' running speed?

We have answered all of those questions already, are you even using them?

 

 

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 -6.0 0.3

 

 

That stores the location of the actor with a offset of whatever you put.

Edited by trickstar34

Share this post


Link to post
Share on other sites
12jango
- Hey, what about the code to set the certain peds spawn at certain area?

- Then, what's the code to set some actors/peds to follow player but still with the walking style we've set

- What's the code to set peds'/actors' running speed?

We have answered all of those questions already, are you even using them?

 

 

04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 -6.0 0.3

 

 

That stores the location of the actor with a offset of whatever you put.

Hmph....Still ain't understand! Just tell me what's that [email protected] [email protected] [email protected] (what kind of local variable that should I put here?) and that offset 0.0 16.0 0.3 (what I need to put? Player's position?)

 

Please answer! icon14.gif

Share this post


Link to post
Share on other sites
Dutchy3010

This opcode is used to obtain a location, relative to the players current location and orientation. The last 3 numbers are the offset from the player. The first number is left/right (I think left is -, so for example -2.0, but I'm not completely sure), the second number is forward/backward (backward is a negative number) and the third number is above/under (under is negative number).

 

If the last 3 numbers all are 0.0, it would be the same as:

 

00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]

 

Share this post


Link to post
Share on other sites
jemahuk1

 

042B: clear_peds_from_cube_cornerA 1721.117 -1967.489 11.0 cornerB 1904.391 1838.315 15.0

 

 

I thinks this opcode has function to clear pedestrians at certain area. Am I correct? If so, please tell me what's that cube_cornerA 1721.117 -1967.489 11.0 cornerB 1904.391 1838.315 15.0? And how to use that opcode?

 

Share this post


Link to post
Share on other sites
Dutchy3010

That's a bit difficult to explain, so I'll make a picture. Basically, it are coords of the opposite corners of a cube. In that cube, there won't be pedestrians. To make it more clear:

 

user posted image

 

If you want this cube, you have to use the coords of the corners of the same colour in the opcode.

Share this post


Link to post
Share on other sites
trickstar34

Nice representation Dutchy, I was trying to come up with a better way but I just couldn't.

Share this post


Link to post
Share on other sites
jemahuk1

 

05E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR

 

 

Hey, I used this opcode to make the actor attacking the player, but it didn't work! cryani.gif

The actor attacking if player attack him, if not he only standing! Tell me what's wrong.

Share this post


Link to post
Share on other sites
trickstar34

What, the actor is attacking the player, but you want him to stand still?

 

Here is the solution

 

0638: AS_actor [email protected] stay_put 1 05BE: AS_kill_actor [email protected]

 

 

or

If the actor is standing still he doesn't attack him?

Use the same code that I used up there, it makes the latest command more permanent than the other.

Edited by trickstar34

Share this post


Link to post
Share on other sites
jemahuk1
What, the actor is attacking the player, but you want him to stand still?

or

If the actor isn't standing still he doesn't attack him?

I want the actor attack the player as soon as possible (after he spawned)! icon14.gif

Share this post


Link to post
Share on other sites
Dutchy3010

Does the actor see the player? I believe that the opcode only works when the first actor sees the second.

Share this post


Link to post
Share on other sites
jemahuk1

Of course, the actor saw the player, but only standing. I had no idea why this opcode didn't work.

Share this post


Link to post
Share on other sites
trickstar34

That can't be why, the actor will search for a way to get to the second no matter how far away he is, I think it's because he didn't set accuracy high enough to hit him.

 

Actor.WeaponAccuracy([email protected], 1000)

 

 

Show your entire script so we can isolate your problem.

Share this post


Link to post
Share on other sites
jemahuk1

 

{$CLEO  .cs}thread 'H':LOADwait 0Model.Load(#WFYLG)Model.Load(#M4)if and   MODEL.Available(#WFYLG)   Model.Available(#M4)jf @LOADActor.Health($PLAYER_ACTOR) = 500Actor.Armour($PLAYER_ACTOR) = 50001B2: give_actor $PLAYER_ACTOR weapon 31 ammo 890 // Load the weapon model before using this [email protected] = actor.Create(CivFemale, #WFYLG, 2488.7537, -1656.54, 13.3669)Actor.Angle([email protected]) = 180.0Actor.Health([email protected])= 5000Actor.Armour([email protected])= 500005E2: AS_actor [email protected] kill_actor $PLAYER_ACTOR0850: AS_actor [email protected] follow_actor $PLAYER_ACTORActor.WeaponAccuracy([email protected]) = 1000wait 2500jump @LOAD      

 

 

There, a simple script.

Share this post


Link to post
Share on other sites
Dutchy3010

 

That can't be why, the actor will search for a way to get to the second no matter how far away he is, I think it's because he didn't set accuracy high enough to hit him.

 

Actor.WeaponAccuracy([email protected], 1000)

 

 

Show your entire script so we can isolate your problem.

That is also nonsense. 1) It doesn't matter what weapon accuracy it has and 2) that opcode doesn't work like that.

 

You are right about the sight, was confused with gangs. tounge.gif

 

I guess the problem is that you want the actor to follow the player immediately after you said he had to attack him. The "friendly" follow action will replace the attack. By the way, you know that it keeps spawning actors, right? The engine can only handle a limited number of actors. wink.gif

Share this post


Link to post
Share on other sites
trickstar34

Well first off you need to check if the actor is dead.

 

 

Actor.Dead([email protected])

 

 

and you need to end your thread. Also you don't need to add follow actor because he automatically does when you tell the actor to kill another, that opcode is for chases while a passenger attacks the player.

 

Here is the fixed version of your script

 

{$CLEO  .cs}thread 'H':LOADwait 0Model.Load(#WFYLG)Model.Load(#M4)if and  MODEL.Available(#WFYLG)  Model.Available(#M4)jf @LOADActor.Health($PLAYER_ACTOR) = 500Actor.Armour($PLAYER_ACTOR) = 50001B2: give_actor $PLAYER_ACTOR weapon 31 ammo 890 // Load the weapon model before using [email protected] = actor.Create(CivFemale, #WFYLG, 2488.7537, -1656.54, 13.3669)Actor.Angle([email protected]) = 180.0Actor.Health([email protected])= 5000Actor.Armour([email protected])= 500005E2: AS_actor [email protected] kill_actor $PLAYER_ACTORActor.WeaponAccuracy([email protected]) = 1000:CHECKwait 0if Actor.Dead([email protected])then jump @NEXTendjump @CHECKwait 2500:NEXTjump @LOAD0A93: end_custom_thread

 

 

 

That is also nonsense. 1) It doesn't matter what weapon accuracy it has and 2) that opcode doesn't work like that.

Right, but the actor will be too dumb actually manage to kill the player unless you don't because it will keep hitting near him, but not actually hitting him, however an occasional bullet will hit out of every 3 or so in my experience. Because if you leave it blank it will be equivelent of setting it at 0.

Edited by trickstar34

Share this post


Link to post
Share on other sites
jemahuk1

Hey, at last it work! icon14.gificon14.gif

Thank you! cookie.gifcookie.gifcookie.gificon14.gificon14.gificon14.gif

 

edit:

 

00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot 

 

 

This opcode.

I wonder whether this opcode can be use like this:

 

 

gosub @EFFECT:EFFECTif00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot then08B2: enable_thermal_vision 1jf @EFFECTreturn

 

 

I want to make every time the actor near the player, there will be a thermal vision. Is that correct?

 

 

 

 

Edited by jemahuk1

Share this post


Link to post
Share on other sites
Dutchy3010

Just a few suggestions to make the code even more clear:

 

1. You don't need end_custom_thread like trickstar says. You only need that when you don't have a loop in it. The code will never come to the end_custom_thread, so it isn't necessary.

 

2. I would rather use a repeat-wait-until:

 

repeatwait 100until Actor.Dead([email protected])

 

 

3.

jump @NEXT:NEXTjump @LOAD

 

If you want to do it like this, then why don't you jump immediately to LOAD?

 

4.

jump @CHECKwait 2500:NEXT

 

That wait is also useless, since the code doesn't come there.

 

So the code of Trickstar edited:

 

{$CLEO  .cs}thread 'H':LOADwait 0Model.Load(#WFYLG)Model.Load(#M4)if and Model.Available(#WFYLG) Model.Available(#M4)jf @LOADActor.Health($PLAYER_ACTOR) = 500Actor.Armour($PLAYER_ACTOR) = 50001B2: give_actor $PLAYER_ACTOR weapon 31 ammo 890 // Load the weapon model before using [email protected] = actor.Create(CivFemale, #WFYLG, 2488.7537, -1656.54, 13.3669)Actor.Angle([email protected]) = 180.0Actor.Health([email protected])= 5000Actor.Armour([email protected])= 500005E2: AS_actor [email protected] kill_actor $PLAYER_ACTORActor.WeaponAccuracy([email protected]) = 1000repeatwait 100until Actor.Dead([email protected])jump @LOAD

 

 

And then a suggestion for the code. Now there immediately spawns the actor after you killed the previous. You could also use a wait, or check if the people is outside a certain area with:

 

80EC:   not actor $PLAYER_ACTOR 0 near_point 2488.7537 -1656.54 radius 50.0 50.0 

 

Share this post


Link to post
Share on other sites
trickstar34

 

1. You don't need end_custom_thread like trickstar says. You only need that when you don't have a loop in it. The code will never come to the end_custom_thread, so it isn't necessary.

Right, but it's a good practice for when you don't and maybe he will change it someday then it will crash and he wont know why, so doing it anyway saves time for later and adds good practice for making big time mods.

 

 

I would rather use a repeat-wait-until

As I have said before, if you put something between the repeat and until, especially a if then it will mess up your script big time, but my way you can embed other if's in it and not have to worry about the compiler messing it up. While would be better to use then repeat because the compiler always interprets that correctly.

 

Instead of wasting server space and not making an extra post to go off-topic, I'll just reply in this post.

 

If you can remember my first mod and I needed a bunch of help with it and it kept crashing, then finally ZAZ said the problem was that I kept using repeats and in the decompiled version the if's pointed to wrong places which ruined my script, but once I changed it all to equevilent if's then it worked.

Edited by trickstar34

Share this post


Link to post
Share on other sites
Dutchy3010

Nonsense, I made many mods and I never had problems with repeat-wait-until structure with an if in it. I think you didn't understand good what other people said. smile.gif

 

For example, I use if in every repeat-wait-until in every menu I made, and I made LOTS of it.

 

But let's go back ontopic. smile.gif

Share this post


Link to post
Share on other sites
jemahuk1
00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot 

 

 

This opcode.

I wonder whether this opcode can be use like this:

 

 

gosub @EFFECT:EFFECTif00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot then08B2: enable_thermal_vision 1jf @EFFECTreturn

 

 

I want to make every time the actor near the player, there will be a thermal vision. Is that correct?

Hey, what about this? icon14.gif

Share this post


Link to post
Share on other sites
trickstar34

You mean how to use subscripts? Is that your question?

 

OK, a sub script is basicaly the SCM equivalent of a high-level user defind function, I figured this out when I first noticed the return. When you call a sub script it does whatever you defined it as in its label. I'll give an example of a re-usable sub script.

 

Lets pretend this is my FXT

 

EXAMPLE The square root of ~1~ is ~1~

 

 

 

{$CLEO .cs}thread "EXAMPLE"// This is a mathematic operation// I am using [email protected] and [email protected] as [email protected] = 4gosub @SQRRT02FD: show_text_2numbers_lowpriority GXT 'EXAMPLE' numbers [email protected] [email protected] time 5000 flag 1jump @END:SQRRT01FB: [email protected] = square_root [email protected]:END0A93: end_custom_thread

 

 

The sub script computes the square root of [email protected], then returns the value in the variable [email protected] and then it displays the text "The square root of 4 is 2"

Edited by trickstar34

Share this post


Link to post
Share on other sites
jemahuk1
You mean how to use subscripts? Is that your question?

Hmm....I mean I want to make a script :

If the actor stand near the player, then the player will be in thermal vision. icon14.gif

Share this post


Link to post
Share on other sites
Dutchy3010

 

Hey, what about this? icon14.gif

1. The gosub and the return are pretty strange...

2. You didn't use a wait in the loop.

3. You can't merge the if-then-end and the if-jf structures.

4. I don't know the rest of the code, so I can't judge that. Did you create the actor, for example.

5. It would be handy if you check if the player actor is outside the sphere, because else it would be getting the thermal vision over and over again:

 

80F2:   not actor $ACTOR_SWEET near_actor [email protected] radius 40.0 40.0 0 

 

 

Just made a simple script:

 

:EFFECTrepeat wait 100until 00F3:   actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 on_foot 08B2: enable_thermal_vision 1repeat wait 100until 80F2:   not actor $PLAYER_ACTOR near_actor [email protected] radius 2.0 2.0 0 jump @EFFECT

 

Didn't test it, your job. wink.gif

Edited by Dutchy3010

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.