Written like so:
IObject ratatat = Game.SpawnProjectile(6,LeftNut.GetWorldPosition(), new.Vector2(108));
Column 74 is giving me the Type Expected error (CS1031)
So... Whaddup?
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
SpawnProjectile still expecting "type"
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- TheOriginalCj
- Moderator
- Posts: 177
- Joined: Tue Mar 15, 2016 10:28 pm
- Title: Lifetime Sentence to SF Wiki
- SFD Alias: RedneckJed
- Started SFD: PreAlpha 1.1.0
- Location: USA
- Gender:
- Contact:
SpawnProjectile still expecting "type"
0 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!
- ShutDownMan
- Fighter
- Posts: 32
- Joined: Sat Mar 19, 2016 7:17 pm
- Title: Yeah, science!
- SFD Alias: ShutDownMan, Devil Shut
- Started SFD: 1.2.something
- Location: Hu3, Brazil
- Gender:
- Age: 24
- Contact:
- TheOriginalCj
- Moderator
- Posts: 177
- Joined: Tue Mar 15, 2016 10:28 pm
- Title: Lifetime Sentence to SF Wiki
- SFD Alias: RedneckJed
- Started SFD: PreAlpha 1.1.0
- Location: USA
- Gender:
- Contact:
The Error is in char 74, not 1. It's still asking for the type.ShutDownMan wrote:Simple, this function returns you void and not IObject '-'
EDIT: Clarifying the error, it seems to be Vector2 that's sending the error, perhaps it's not compatible in this command?
0 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!
- ShutDownMan
- Fighter
- Posts: 32
- Joined: Sat Mar 19, 2016 7:17 pm
- Title: Yeah, science!
- SFD Alias: ShutDownMan, Devil Shut
- Started SFD: 1.2.something
- Location: Hu3, Brazil
- Gender:
- Age: 24
- Contact:
Ýeah, I just saw an error before it appeared =P
There's a lot of wrong things there, so I think it's better I show you the right way to set up a SpawnProjectile:
In this example:
You can see that the first argument is put in this way: ProjectileItem.M60
There's no problem if you put ProjectileItem.6, but I find the first way better when debugging code.
The second argument is just the position of the "shooter", and the third argument is the subtraction of the position of the second object from the first one.
Hope I helped, at least a bit.
There's a lot of wrong things there, so I think it's better I show you the right way to set up a SpawnProjectile:
In this example:
Code: Select all
public void ActivateShooter(TriggerArgs args){
IObject obj01 = Game.GetFirstObject("Object01") as IObject;
IObject obj02 = Game.GetFirstObject("Object02") as IObject;
if(obj02 != null){ // if object01 still exists
Vector2 pos01 = obj01.GetWorldPosition();
Vector2 pos02 = obj02.GetWorldPosition();
Vector2 direction = pos02 - pos01;
Game.SpawnProjectile(ProjectileItem.M60, pos01, direction);
}
}
There's no problem if you put ProjectileItem.6, but I find the first way better when debugging code.
The second argument is just the position of the "shooter", and the third argument is the subtraction of the position of the second object from the first one.
Hope I helped, at least a bit.
0 x
~ShutDownMan
- TheOriginalCj
- Moderator
- Posts: 177
- Joined: Tue Mar 15, 2016 10:28 pm
- Title: Lifetime Sentence to SF Wiki
- SFD Alias: RedneckJed
- Started SFD: PreAlpha 1.1.0
- Location: USA
- Gender:
- Contact:
You didn't only help a bit, you helped alot. Thanks for the help ShutDownMan.
EDIT: As a side note, the Numeric ID for ProjectileItem does not work. You have to use the ID of the weapon.
EDIT: As a side note, the Numeric ID for ProjectileItem does not work. You have to use the ID of the weapon.
1 x
Superfighters Wiki Founder
The Superfighters Wiki
Join the Wiki!
The Superfighters Wiki
Join the Wiki!
Danger Ross wrote: What are you doing here wiki-slave?! GET BACK TO WORK!
-
- Fighter
- Posts: 10
- Joined: Sun Mar 20, 2016 10:45 am
- Title: 0110111101101011
- SFD Alias: chelog
- Started SFD: The first public version
- Location: Saint-Petersburg, Russia
- Gender:
- Age: 27
- Contact:
Shut was a lil' wrong (or he may mistype). Actually, you can use just 6 instead of ProjectileItem.M60. But the thing that if Gurt changes numerical index of projectiles in future, your script may spawn some other projectile instead of M60 one. So you'd better use Enumerations as ShutDownMan said.TheOriginalCj wrote:EDIT: As a side note, the Numeric ID for ProjectileItem does not work. You have to use the ID of the weapon.
1 x